• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

taosdata / TDengine / #4869

26 Nov 2025 05:46AM UTC coverage: 64.539% (-0.09%) from 64.629%
#4869

push

travis-ci

guanshengliang
Merge branch '3.0' into cover/3.0

771 of 945 new or added lines in 33 files covered. (81.59%)

3214 existing lines in 124 files now uncovered.

158203 of 245129 relevant lines covered (64.54%)

113224023.06 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

87.8
/source/dnode/mnode/impl/src/mndDef.c
1
/*
2
 * Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
3
 *
4
 * This program is free software: you can use, redistribute, and/or modify
5
 * it under the terms of the GNU Affero General Public License, version 3
6
 * or later ("AGPL"), as published by the Free Software Foundation.
7
 *
8
 * This program is distributed in the hope that it will be useful, but WITHOUT
9
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10
 * FITNESS FOR A PARTICULAR PURPOSE.
11
 *
12
 * You should have received a copy of the GNU Affero General Public License
13
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14
 */
15
#define _DEFAULT_SOURCE
16
#include "mndConsumer.h"
17
#include "mndDef.h"
18
#include "mndStream.h"
19
#include "taoserror.h"
20
#include "tunit.h"
21

22
int32_t tEncodeSStreamObj(SEncoder *pEncoder, const SStreamObj *pObj) {
791,406✔
23
  TAOS_CHECK_RETURN(tStartEncode(pEncoder));
791,406✔
24

25
  TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, pObj->name));
1,582,812✔
26
  TAOS_CHECK_RETURN(tSerializeSCMCreateStreamReqImpl(pEncoder, pObj->pCreate));
791,406✔
27

28
  TAOS_CHECK_RETURN(tEncodeI32(pEncoder, pObj->mainSnodeId));
1,582,812✔
29
  TAOS_CHECK_RETURN(tEncodeI8(pEncoder, pObj->userStopped));
1,582,812✔
30
  TAOS_CHECK_RETURN(tEncodeI64(pEncoder, pObj->createTime));
1,582,812✔
31
  TAOS_CHECK_RETURN(tEncodeI64(pEncoder, pObj->updateTime));
1,582,812✔
32

33
  tEndEncode(pEncoder);
791,406✔
34
  return pEncoder->pos;
791,406✔
35
}
36

37
int32_t tDecodeSStreamObj(SDecoder *pDecoder, SStreamObj *pObj, int32_t sver) {
215,729✔
38
  int32_t code = 0;
215,729✔
39
  int32_t lino = 0;
215,729✔
40
  TAOS_CHECK_RETURN(tStartDecode(pDecoder));
215,729✔
41

42
  TAOS_CHECK_RETURN(tDecodeCStrTo(pDecoder, pObj->name));
215,729✔
43
  pObj->pCreate = taosMemoryCalloc(1, sizeof(*pObj->pCreate));
215,729✔
44
  if (NULL == pObj) {
215,729✔
UNCOV
45
    TAOS_CHECK_EXIT(terrno);
×
46
  }
47
  
48
  if (MND_STREAM_VER_NUMBER == sver) {
215,729✔
49
    TAOS_CHECK_RETURN(tDeserializeSCMCreateStreamReqImpl(pDecoder, pObj->pCreate));
215,729✔
50
  } else {
NEW
51
    TAOS_CHECK_RETURN(
×
52
      tDeserializeSCMCreateStreamReqImplOld(pDecoder, pObj->pCreate, 21));
53
  }
54

55
  TAOS_CHECK_RETURN(tDecodeI32(pDecoder, &pObj->mainSnodeId));
431,458✔
56
  TAOS_CHECK_RETURN(tDecodeI8(pDecoder, &pObj->userStopped));
431,458✔
57
  TAOS_CHECK_RETURN(tDecodeI64(pDecoder, &pObj->createTime));
431,458✔
58
  TAOS_CHECK_RETURN(tDecodeI64(pDecoder, &pObj->updateTime));
431,458✔
59

60
_exit:
215,729✔
61

62
  tEndDecode(pDecoder);
215,729✔
63
  tDecoderClear(pDecoder);  
215,729✔
64
  
65
  TAOS_RETURN(code);
215,729✔
66
}
67

68
void tFreeStreamObj(SStreamObj *pStream) {
433,360✔
69
  tFreeSCMCreateStreamReq(pStream->pCreate);
433,360✔
70
  taosMemoryFreeClear(pStream->pCreate);
433,360✔
71
}
433,360✔
72

73
void freeSMqConsumerEp(void* data) {
158,347✔
74
  if (data == NULL) return;
158,347✔
75
  SMqConsumerEp *pConsumerEp = (SMqConsumerEp *)data;
158,347✔
76
  taosArrayDestroy(pConsumerEp->vgs);
158,347✔
77
  pConsumerEp->vgs = NULL;
158,347✔
78
  taosArrayDestroy(pConsumerEp->offsetRows);
158,347✔
79
  pConsumerEp->offsetRows = NULL;
158,347✔
80
}
81

82
int32_t tEncodeSMqVgEp(void **buf, const SMqVgEp *pVgEp) {
928,700✔
83
  int32_t tlen = 0;
928,700✔
84
  tlen += taosEncodeFixedI32(buf, pVgEp->vgId);
928,700✔
85
  tlen += taosEncodeSEpSet(buf, &pVgEp->epSet);
928,700✔
86
  return tlen;
928,700✔
87
}
88

89
void *tDecodeSMqVgEp(const void *buf, SMqVgEp *pVgEp, int8_t sver) {
425,543✔
90
  buf = taosDecodeFixedI32(buf, &pVgEp->vgId);
425,543✔
91
  if (sver == 1) {
425,543✔
UNCOV
92
    uint64_t size = 0;
×
UNCOV
93
    buf = taosDecodeVariantU64(buf, &size);
×
UNCOV
94
    buf = POINTER_SHIFT(buf, size);
×
95
  }
96
  buf = taosDecodeSEpSet(buf, &pVgEp->epSet);
425,543✔
97
  return (void *)buf;
425,543✔
98
}
99

100
static void *topicNameDup(void *p) { return taosStrdup((char *)p); }
51,201✔
101

102
int32_t tNewSMqConsumerObj(int64_t consumerId, char *cgroup, int8_t updateType, char *topic, SCMSubscribeReq *subscribe,
222,669✔
103
                           SMqConsumerObj **ppConsumer) {
104
  int32_t         code = 0;
222,669✔
105
  SMqConsumerObj *pConsumer = taosMemoryCalloc(1, sizeof(SMqConsumerObj));
222,669✔
106
  if (pConsumer == NULL) {
222,669✔
UNCOV
107
    code = terrno;
×
UNCOV
108
    goto END;
×
109
  }
110

111
  pConsumer->consumerId = consumerId;
222,669✔
112
  (void)memcpy(pConsumer->cgroup, cgroup, TSDB_CGROUP_LEN);
222,669✔
113

114
  pConsumer->epoch = 0;
222,669✔
115
  pConsumer->status = MQ_CONSUMER_STATUS_REBALANCE;
222,669✔
116
  pConsumer->hbStatus = 0;
222,669✔
117
  pConsumer->pollStatus = 0;
222,669✔
118

119
  taosInitRWLatch(&pConsumer->lock);
222,669✔
120
  pConsumer->createTime = taosGetTimestampMs();
222,669✔
121
  pConsumer->updateType = updateType;
222,669✔
122

123
  if (updateType == CONSUMER_ADD_REB) {
222,669✔
124
    pConsumer->rebNewTopics = taosArrayInit(0, sizeof(void *));
51,540✔
125
    if (pConsumer->rebNewTopics == NULL) {
51,540✔
UNCOV
126
      code = terrno;
×
UNCOV
127
      goto END;
×
128
    }
129

130
    char *topicTmp = taosStrdup(topic);
51,540✔
131
    if (taosArrayPush(pConsumer->rebNewTopics, &topicTmp) == NULL) {
103,080✔
132
      code = terrno;
×
133
      goto END;
×
134
    }
135
  } else if (updateType == CONSUMER_REMOVE_REB) {
171,129✔
136
    pConsumer->rebRemovedTopics = taosArrayInit(0, sizeof(void *));
40,176✔
137
    if (pConsumer->rebRemovedTopics == NULL) {
40,176✔
138
      code = terrno;
×
139
      goto END;
×
140
    }
141
    char *topicTmp = taosStrdup(topic);
40,176✔
142
    if (taosArrayPush(pConsumer->rebRemovedTopics, &topicTmp) == NULL) {
80,352✔
UNCOV
143
      code = terrno;
×
144
      goto END;
×
145
    }
146
  } else if (updateType == CONSUMER_INSERT_SUB) {
130,953✔
147
    tstrncpy(pConsumer->clientId, subscribe->clientId, tListLen(pConsumer->clientId));
50,682✔
148
    pConsumer->withTbName = subscribe->withTbName;
50,682✔
149
    pConsumer->autoCommit = subscribe->autoCommit;
50,682✔
150
    pConsumer->autoCommitInterval = subscribe->autoCommitInterval;
50,682✔
151
    pConsumer->resetOffsetCfg = subscribe->resetOffsetCfg;
50,682✔
152
    pConsumer->maxPollIntervalMs = subscribe->maxPollIntervalMs;
50,682✔
153
    pConsumer->sessionTimeoutMs = subscribe->sessionTimeoutMs;
50,682✔
154
    tstrncpy(pConsumer->user, subscribe->user, TSDB_USER_LEN);
50,682✔
155
    tstrncpy(pConsumer->fqdn, subscribe->fqdn, TSDB_FQDN_LEN);
50,682✔
156

157
    pConsumer->rebNewTopics = taosArrayDup(subscribe->topicNames, topicNameDup);
50,682✔
158
    if (pConsumer->rebNewTopics == NULL) {
50,682✔
UNCOV
159
      code = terrno;
×
UNCOV
160
      goto END;
×
161
    }
162
    pConsumer->assignedTopics = subscribe->topicNames;
50,682✔
163
    subscribe->topicNames = NULL;
50,682✔
164
  } else if (updateType == CONSUMER_UPDATE_SUB) {
80,271✔
165
    pConsumer->assignedTopics = subscribe->topicNames;
39,245✔
166
    subscribe->topicNames = NULL;
39,245✔
167
  }
168

169
  *ppConsumer = pConsumer;
222,669✔
170
  return 0;
222,669✔
171

UNCOV
172
END:
×
UNCOV
173
  tDeleteSMqConsumerObj(pConsumer);
×
UNCOV
174
  return code;
×
175
}
176

177
void tClearSMqConsumerObj(SMqConsumerObj *pConsumer) {
776,965✔
178
  if (pConsumer == NULL) return;
776,965✔
179
  taosArrayDestroyP(pConsumer->currentTopics, NULL);
445,764✔
180
  taosArrayDestroyP(pConsumer->rebNewTopics, NULL);
445,764✔
181
  taosArrayDestroyP(pConsumer->rebRemovedTopics, NULL);
445,764✔
182
  taosArrayDestroyP(pConsumer->assignedTopics, NULL);
445,764✔
183
}
184

185
void tDeleteSMqConsumerObj(SMqConsumerObj *pConsumer) {
553,870✔
186
  tClearSMqConsumerObj(pConsumer);
553,870✔
187
  taosMemoryFree(pConsumer);
553,870✔
188
}
553,870✔
189

190
int32_t tEncodeSMqConsumerObj(void **buf, const SMqConsumerObj *pConsumer) {
514,830✔
191
  int32_t tlen = 0;
514,830✔
192
  int32_t sz;
193
  tlen += taosEncodeFixedI64(buf, pConsumer->consumerId);
514,830✔
194
  tlen += taosEncodeString(buf, pConsumer->clientId);
514,830✔
195
  tlen += taosEncodeString(buf, pConsumer->cgroup);
514,830✔
196
  tlen += taosEncodeFixedI8(buf, pConsumer->updateType);
514,830✔
197
  tlen += taosEncodeFixedI32(buf, pConsumer->epoch);
514,830✔
198
  tlen += taosEncodeFixedI32(buf, pConsumer->status);
514,830✔
199

200
  tlen += taosEncodeFixedI32(buf, pConsumer->pid);
514,830✔
201
  tlen += taosEncodeSEpSet(buf, &pConsumer->ep);
514,830✔
202
  tlen += taosEncodeFixedI64(buf, pConsumer->createTime);
514,830✔
203
  tlen += taosEncodeFixedI64(buf, pConsumer->subscribeTime);
514,830✔
204
  tlen += taosEncodeFixedI64(buf, pConsumer->rebalanceTime);
514,830✔
205

206
  // current topics
207
  if (pConsumer->currentTopics) {
514,830✔
208
    sz = taosArrayGetSize(pConsumer->currentTopics);
70,990✔
209
    tlen += taosEncodeFixedI32(buf, sz);
70,990✔
210
    for (int32_t i = 0; i < sz; i++) {
112,388✔
211
      char *topic = taosArrayGetP(pConsumer->currentTopics, i);
41,398✔
212
      tlen += taosEncodeString(buf, topic);
41,398✔
213
    }
214
  } else {
215
    tlen += taosEncodeFixedI32(buf, 0);
443,840✔
216
  }
217

218
  // reb new topics
219
  if (pConsumer->rebNewTopics) {
514,830✔
220
    sz = taosArrayGetSize(pConsumer->rebNewTopics);
352,426✔
221
    tlen += taosEncodeFixedI32(buf, sz);
352,426✔
222
    for (int32_t i = 0; i < sz; i++) {
580,024✔
223
      char *topic = taosArrayGetP(pConsumer->rebNewTopics, i);
227,598✔
224
      tlen += taosEncodeString(buf, topic);
227,598✔
225
    }
226
  } else {
227
    tlen += taosEncodeFixedI32(buf, 0);
162,404✔
228
  }
229

230
  // reb removed topics
231
  if (pConsumer->rebRemovedTopics) {
514,830✔
232
    sz = taosArrayGetSize(pConsumer->rebRemovedTopics);
228,334✔
233
    tlen += taosEncodeFixedI32(buf, sz);
228,334✔
234
    for (int32_t i = 0; i < sz; i++) {
386,096✔
235
      char *topic = taosArrayGetP(pConsumer->rebRemovedTopics, i);
157,762✔
236
      tlen += taosEncodeString(buf, topic);
157,762✔
237
    }
238
  } else {
239
    tlen += taosEncodeFixedI32(buf, 0);
286,496✔
240
  }
241

242
  // lost topics
243
  if (pConsumer->assignedTopics) {
514,830✔
244
    sz = taosArrayGetSize(pConsumer->assignedTopics);
249,346✔
245
    tlen += taosEncodeFixedI32(buf, sz);
249,346✔
246
    for (int32_t i = 0; i < sz; i++) {
415,204✔
247
      char *topic = taosArrayGetP(pConsumer->assignedTopics, i);
165,858✔
248
      tlen += taosEncodeString(buf, topic);
165,858✔
249
    }
250
  } else {
251
    tlen += taosEncodeFixedI32(buf, 0);
265,484✔
252
  }
253

254
  tlen += taosEncodeFixedI8(buf, pConsumer->withTbName);
514,830✔
255
  tlen += taosEncodeFixedI8(buf, pConsumer->autoCommit);
514,830✔
256
  tlen += taosEncodeFixedI32(buf, pConsumer->autoCommitInterval);
514,830✔
257
  tlen += taosEncodeFixedI32(buf, pConsumer->resetOffsetCfg);
514,830✔
258
  tlen += taosEncodeFixedI32(buf, pConsumer->maxPollIntervalMs);
514,830✔
259
  tlen += taosEncodeFixedI32(buf, pConsumer->sessionTimeoutMs);
514,830✔
260
  tlen += taosEncodeString(buf, pConsumer->user);
514,830✔
261
  tlen += taosEncodeString(buf, pConsumer->fqdn);
514,830✔
262
  return tlen;
514,830✔
263
}
264

265
void *tDecodeSMqConsumerObj(const void *buf, SMqConsumerObj *pConsumer, int8_t sver) {
223,095✔
266
  int32_t sz;
220,393✔
267
  buf = taosDecodeFixedI64(buf, &pConsumer->consumerId);
223,095✔
268
  buf = taosDecodeStringTo(buf, pConsumer->clientId);
223,095✔
269
  buf = taosDecodeStringTo(buf, pConsumer->cgroup);
223,095✔
270
  buf = taosDecodeFixedI8(buf, &pConsumer->updateType);
223,095✔
271
  buf = taosDecodeFixedI32(buf, &pConsumer->epoch);
223,095✔
272
  buf = taosDecodeFixedI32(buf, &pConsumer->status);
223,095✔
273

274
  buf = taosDecodeFixedI32(buf, &pConsumer->pid);
223,095✔
275
  buf = taosDecodeSEpSet(buf, &pConsumer->ep);
223,095✔
276
  buf = taosDecodeFixedI64(buf, &pConsumer->createTime);
223,095✔
277
  buf = taosDecodeFixedI64(buf, &pConsumer->subscribeTime);
223,095✔
278
  buf = taosDecodeFixedI64(buf, &pConsumer->rebalanceTime);
446,190✔
279

280
  // current topics
281
  buf = taosDecodeFixedI32(buf, &sz);
223,095✔
282
  pConsumer->currentTopics = taosArrayInit(sz, sizeof(void *));
223,095✔
283
  if (pConsumer->currentTopics == NULL) {
223,095✔
UNCOV
284
    return NULL;
×
285
  }
286
  for (int32_t i = 0; i < sz; i++) {
223,773✔
287
    char *topic;
678✔
288
    buf = taosDecodeString(buf, &topic);
678✔
289
    if (taosArrayPush(pConsumer->currentTopics, &topic) == NULL) {
1,356✔
290
      return NULL;
×
291
    }
292
  }
293

294
  // reb new topics
295
  buf = taosDecodeFixedI32(buf, &sz);
223,095✔
296
  pConsumer->rebNewTopics = taosArrayInit(sz, sizeof(void *));
223,095✔
297
  for (int32_t i = 0; i < sz; i++) {
326,421✔
298
    char *topic;
102,168✔
299
    buf = taosDecodeString(buf, &topic);
103,326✔
300
    if (taosArrayPush(pConsumer->rebNewTopics, &topic) == NULL) {
206,652✔
UNCOV
301
      return NULL;
×
302
    }
303
  }
304

305
  // reb removed topics
306
  buf = taosDecodeFixedI32(buf, &sz);
223,095✔
307
  pConsumer->rebRemovedTopics = taosArrayInit(sz, sizeof(void *));
223,095✔
308
  for (int32_t i = 0; i < sz; i++) {
302,115✔
309
    char *topic;
77,862✔
310
    buf = taosDecodeString(buf, &topic);
79,020✔
311
    if (taosArrayPush(pConsumer->rebRemovedTopics, &topic) == NULL) {
158,040✔
UNCOV
312
      return NULL;
×
313
    }
314
  }
315

316
  // reb removed topics
317
  buf = taosDecodeFixedI32(buf, &sz);
223,095✔
318
  pConsumer->assignedTopics = taosArrayInit(sz, sizeof(void *));
223,095✔
319
  for (int32_t i = 0; i < sz; i++) {
275,412✔
320
    char *topic;
51,738✔
321
    buf = taosDecodeString(buf, &topic);
52,317✔
322
    if (taosArrayPush(pConsumer->assignedTopics, &topic) == NULL) {
104,634✔
UNCOV
323
      return NULL;
×
324
    }
325
  }
326

327
  if (sver > 1) {
223,095✔
328
    buf = taosDecodeFixedI8(buf, &pConsumer->withTbName);
223,095✔
329
    buf = taosDecodeFixedI8(buf, &pConsumer->autoCommit);
223,095✔
330
    buf = taosDecodeFixedI32(buf, &pConsumer->autoCommitInterval);
223,095✔
331
    buf = taosDecodeFixedI32(buf, &pConsumer->resetOffsetCfg);
446,190✔
332
  }
333
  if (sver > 2) {
223,095✔
334
    buf = taosDecodeFixedI32(buf, &pConsumer->maxPollIntervalMs);
223,095✔
335
    buf = taosDecodeFixedI32(buf, &pConsumer->sessionTimeoutMs);
223,095✔
336
    buf = taosDecodeStringTo(buf, pConsumer->user);
223,095✔
337
    buf = taosDecodeStringTo(buf, pConsumer->fqdn);
446,190✔
338
  } else {
UNCOV
339
    pConsumer->maxPollIntervalMs = DEFAULT_MAX_POLL_INTERVAL;
×
UNCOV
340
    pConsumer->sessionTimeoutMs = DEFAULT_SESSION_TIMEOUT;
×
341
  }
342

343
  return (void *)buf;
223,095✔
344
}
345

346
int32_t tEncodeOffRows(void **buf, SArray *offsetRows) {
429,142✔
347
  int32_t tlen = 0;
429,142✔
348
  int32_t szVgs = taosArrayGetSize(offsetRows);
429,142✔
349
  tlen += taosEncodeFixedI32(buf, szVgs);
429,142✔
350
  for (int32_t j = 0; j < szVgs; ++j) {
1,101,670✔
351
    OffsetRows *offRows = taosArrayGet(offsetRows, j);
672,528✔
352
    tlen += taosEncodeFixedI32(buf, offRows->vgId);
672,528✔
353
    tlen += taosEncodeFixedI64(buf, offRows->rows);
672,528✔
354
    tlen += taosEncodeFixedI8(buf, offRows->offset.type);
672,528✔
355
    if (offRows->offset.type == TMQ_OFFSET__SNAPSHOT_DATA || offRows->offset.type == TMQ_OFFSET__SNAPSHOT_META) {
672,528✔
356
      tlen += taosEncodeFixedI64(buf, offRows->offset.uid);
22,424✔
357
      tlen += taosEncodeFixedI64(buf, offRows->offset.ts);
44,848✔
358
    } else if (offRows->offset.type == TMQ_OFFSET__LOG) {
650,104✔
359
      tlen += taosEncodeFixedI64(buf, offRows->offset.version);
1,154,536✔
360
    } else {
361
      // do nothing
362
    }
363
    tlen += taosEncodeFixedI64(buf, offRows->ever);
1,345,056✔
364
  }
365

366
  return tlen;
429,142✔
367
}
368

369
int32_t tEncodeSMqConsumerEp(void **buf, const SMqConsumerEp *pConsumerEp) {
155,724✔
370
  int32_t tlen = 0;
155,724✔
371
  tlen += taosEncodeFixedI64(buf, pConsumerEp->consumerId);
155,724✔
372
  int32_t sz = taosArrayGetSize(pConsumerEp->vgs);
155,724✔
373
  tlen += taosEncodeFixedI32(buf, sz);
155,724✔
374
  for (int32_t i = 0; i < sz; i++) {
565,808✔
375
    void* data = taosArrayGet(pConsumerEp->vgs, i);
410,084✔
376
    tlen += tEncodeSMqVgEp(buf, data);
410,084✔
377
  }
378

379
  return tlen + tEncodeOffRows(buf, pConsumerEp->offsetRows);
155,724✔
380
}
381

382
void *tDecodeOffRows(const void *buf, SArray **offsetRows, int8_t sver) {
168,280✔
383
  int32_t szVgs = 0;
168,280✔
384
  buf = taosDecodeFixedI32(buf, &szVgs);
168,280✔
385
  if (szVgs > 0) {
168,280✔
386
    *offsetRows = taosArrayInit(szVgs, sizeof(OffsetRows));
71,478✔
387
    if (NULL == *offsetRows) return NULL;
71,478✔
388
    for (int32_t j = 0; j < szVgs; ++j) {
376,773✔
389
      OffsetRows *offRows = taosArrayReserve(*offsetRows, 1);
305,295✔
390
      buf = taosDecodeFixedI32(buf, &offRows->vgId);
305,295✔
391
      buf = taosDecodeFixedI64(buf, &offRows->rows);
305,295✔
392
      buf = taosDecodeFixedI8(buf, &offRows->offset.type);
305,295✔
393
      if (offRows->offset.type == TMQ_OFFSET__SNAPSHOT_DATA || offRows->offset.type == TMQ_OFFSET__SNAPSHOT_META) {
305,295✔
394
        buf = taosDecodeFixedI64(buf, &offRows->offset.uid);
10,216✔
395
        buf = taosDecodeFixedI64(buf, &offRows->offset.ts);
20,432✔
396
      } else if (offRows->offset.type == TMQ_OFFSET__LOG) {
295,079✔
397
        buf = taosDecodeFixedI64(buf, &offRows->offset.version);
524,726✔
398
      } else {
399
        // do nothing
400
      }
401
      if (sver > 2) {
305,295✔
402
        buf = taosDecodeFixedI64(buf, &offRows->ever);
610,590✔
403
      }
404
    }
405
  }
406
  return (void *)buf;
168,280✔
407
}
408

409
void *tDecodeSMqConsumerEp(const void *buf, SMqConsumerEp *pConsumerEp, int8_t sver) {
57,964✔
410
  buf = taosDecodeFixedI64(buf, &pConsumerEp->consumerId);
57,964✔
411
  int32_t sz = 0;
57,964✔
412
  buf = taosDecodeFixedI32(buf, &sz);
57,964✔
413
  pConsumerEp->vgs = taosArrayInit(sz, sizeof(SMqVgEp));
57,964✔
414
  if (pConsumerEp->vgs == NULL) {
57,964✔
UNCOV
415
    return NULL;
×
416
  }
417
  for (int32_t i = 0; i < sz; i++) {
242,927✔
418
    SMqVgEp* vgEp = taosArrayReserve(pConsumerEp->vgs, 1);
184,963✔
419
    if (vgEp != NULL)
184,963✔
420
      buf = tDecodeSMqVgEp(buf, vgEp, sver);
184,963✔
421
  }
422
  if (sver > 1) {
57,964✔
423
    buf = tDecodeOffRows(buf, &pConsumerEp->offsetRows, sver);
57,964✔
424
  }
425

426
  return (void *)buf;
57,964✔
427
}
428

429
int32_t tNewSubscribeObj(const char *key, SMqSubscribeObj **ppSub) {
37,183✔
430
  int32_t          code = 0;
37,183✔
431
  SMqSubscribeObj *pSubObj = taosMemoryCalloc(1, sizeof(SMqSubscribeObj));
37,183✔
432
  MND_TMQ_NULL_CHECK(pSubObj);
37,183✔
433
  *ppSub = pSubObj;
37,183✔
434
  
435
  (void)memcpy(pSubObj->key, key, TSDB_SUBSCRIBE_KEY_LEN);
37,183✔
436
  taosInitRWLatch(&pSubObj->lock);
37,183✔
437
  pSubObj->vgNum = 0;
37,183✔
438
  pSubObj->consumerHash = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_ENTRY_LOCK);
37,183✔
439
  MND_TMQ_NULL_CHECK(pSubObj->consumerHash);
37,183✔
440
  taosHashSetFreeFp(pSubObj->consumerHash, freeSMqConsumerEp);
37,183✔
441

442
  pSubObj->unassignedVgs = taosArrayInit(0, sizeof(SMqVgEp));
37,183✔
443
  MND_TMQ_NULL_CHECK(pSubObj->unassignedVgs);
37,183✔
444

445
END:
37,183✔
446
  return code;
37,183✔
447
}
448

449
int32_t tCloneSubscribeObj(const SMqSubscribeObj *pSub, SMqSubscribeObj **ppSub) {
55,348✔
450
  int32_t          code = 0;
55,348✔
451
  SMqSubscribeObj *pSubNew = taosMemoryMalloc(sizeof(SMqSubscribeObj));
55,348✔
452
  if (pSubNew == NULL) {
55,348✔
UNCOV
453
    code = terrno;
×
UNCOV
454
    goto END;
×
455
  }
456
  *ppSub = pSubNew;
55,348✔
457

458
  (void)memcpy(pSubNew->key, pSub->key, TSDB_SUBSCRIBE_KEY_LEN);
55,348✔
459
  taosInitRWLatch(&pSubNew->lock);
55,348✔
460

461
  pSubNew->dbUid = pSub->dbUid;
55,348✔
462
  pSubNew->stbUid = pSub->stbUid;
55,348✔
463
  pSubNew->subType = pSub->subType;
55,348✔
464
  pSubNew->withMeta = pSub->withMeta;
55,348✔
465

466
  pSubNew->vgNum = pSub->vgNum;
55,348✔
467
  pSubNew->consumerHash = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_ENTRY_LOCK);
55,348✔
468
  if (pSubNew->consumerHash == NULL) {
55,348✔
UNCOV
469
    code = terrno;
×
UNCOV
470
    goto END;
×
471
  }
472
  taosHashSetFreeFp(pSubNew->consumerHash, freeSMqConsumerEp);
55,348✔
473

474
  void          *pIter = NULL;
55,348✔
475
  SMqConsumerEp *pConsumerEp = NULL;
55,348✔
476
  while (1) {
48,843✔
477
    pIter = taosHashIterate(pSub->consumerHash, pIter);
104,191✔
478
    if (pIter == NULL) break;
104,191✔
479
    pConsumerEp = (SMqConsumerEp *)pIter;
48,843✔
480
    SMqConsumerEp newEp = {
49,422✔
481
        .consumerId = pConsumerEp->consumerId,
48,843✔
482
        .vgs = taosArrayDup(pConsumerEp->vgs, NULL),
48,843✔
483
    };
484
    if ((code = taosHashPut(pSubNew->consumerHash, &newEp.consumerId, sizeof(int64_t), &newEp,
48,843✔
485
                            sizeof(SMqConsumerEp))) != 0)
UNCOV
486
      goto END;
×
487
  }
488
  pSubNew->unassignedVgs = taosArrayDup(pSub->unassignedVgs, NULL);
55,348✔
489
  if (pSubNew->unassignedVgs == NULL) {
55,348✔
UNCOV
490
    code = terrno;
×
UNCOV
491
    goto END;
×
492
  }
493
  pSubNew->offsetRows = taosArrayDup(pSub->offsetRows, NULL);
55,348✔
494
  if (pSub->offsetRows != NULL && pSubNew->offsetRows == NULL) {
55,348✔
UNCOV
495
    code = terrno;
×
496
    goto END;
×
497
  }
498
  (void)memcpy(pSubNew->dbName, pSub->dbName, TSDB_DB_FNAME_LEN);
55,348✔
499
  pSubNew->qmsg = taosStrdup(pSub->qmsg);
55,348✔
500
  if (pSubNew->qmsg == NULL) {
55,348✔
501
    code = terrno;
×
502
    goto END;
×
503
  }
504

505
END:
55,348✔
506
  return code;
55,348✔
507
}
508

509
void tDeleteSubscribeObj(SMqSubscribeObj *pSub) {
202,847✔
510
  if (pSub == NULL) return;
202,847✔
511
  taosHashCleanup(pSub->consumerHash);
202,847✔
512
  pSub->consumerHash = NULL;
202,847✔
513
  taosArrayDestroy(pSub->unassignedVgs);
202,847✔
514
  pSub->unassignedVgs = NULL;
202,847✔
515
  taosMemoryFreeClear(pSub->qmsg);
202,847✔
516
  taosArrayDestroy(pSub->offsetRows);
202,847✔
517
  pSub->offsetRows = NULL;
202,847✔
518
}
519

520
int32_t tEncodeSubscribeObj(void **buf, const SMqSubscribeObj *pSub) {
273,418✔
521
  int32_t tlen = 0;
273,418✔
522
  tlen += taosEncodeString(buf, pSub->key);
273,418✔
523
  tlen += taosEncodeFixedI64(buf, pSub->dbUid);
273,418✔
524
  tlen += taosEncodeFixedI32(buf, pSub->vgNum);
273,418✔
525
  tlen += taosEncodeFixedI8(buf, pSub->subType);
273,418✔
526
  tlen += taosEncodeFixedI8(buf, pSub->withMeta);
273,418✔
527
  tlen += taosEncodeFixedI64(buf, pSub->stbUid);
273,418✔
528

529
  void   *pIter = NULL;
273,418✔
530
  int32_t sz = taosHashGetSize(pSub->consumerHash);
273,418✔
531
  tlen += taosEncodeFixedI32(buf, sz);
273,418✔
532

533
  int32_t cnt = 0;
273,418✔
534
  while (1) {
155,724✔
535
    pIter = taosHashIterate(pSub->consumerHash, pIter);
429,142✔
536
    if (pIter == NULL) break;
429,142✔
537
    SMqConsumerEp *pConsumerEp = (SMqConsumerEp *)pIter;
155,724✔
538
    tlen += tEncodeSMqConsumerEp(buf, pConsumerEp);
155,724✔
539
    cnt++;
155,724✔
540
  }
541
  if (cnt != sz) return -1;
273,418✔
542
  int32_t len = taosArrayGetSize(pSub->unassignedVgs);
273,418✔
543
  tlen += taosEncodeFixedI32(buf, len);
273,418✔
544
  for (int32_t i = 0; i < len; i++) {
792,034✔
545
    void* data = taosArrayGet(pSub->unassignedVgs, i);
518,616✔
546
    tlen += tEncodeSMqVgEp(buf, data);
518,616✔
547
  }
548
  tlen += taosEncodeString(buf, pSub->dbName);
273,418✔
549

550
  tlen += tEncodeOffRows(buf, pSub->offsetRows);
273,418✔
551
  tlen += taosEncodeString(buf, pSub->qmsg);
273,418✔
552
  return tlen;
273,418✔
553
}
554

555
void *tDecodeSubscribeObj(const void *buf, SMqSubscribeObj *pSub, int8_t sver) {
110,316✔
556
  //
557
  buf = taosDecodeStringTo(buf, pSub->key);
110,316✔
558
  buf = taosDecodeFixedI64(buf, &pSub->dbUid);
110,316✔
559
  buf = taosDecodeFixedI32(buf, &pSub->vgNum);
110,316✔
560
  buf = taosDecodeFixedI8(buf, &pSub->subType);
110,316✔
561
  buf = taosDecodeFixedI8(buf, &pSub->withMeta);
110,316✔
562
  buf = taosDecodeFixedI64(buf, &pSub->stbUid);
111,474✔
563

564
  int32_t sz;
109,158✔
565
  buf = taosDecodeFixedI32(buf, &sz);
110,316✔
566

567
  pSub->consumerHash = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, HASH_NO_LOCK);
110,316✔
568
  if (pSub->consumerHash == NULL) {
110,316✔
UNCOV
569
    return NULL;
×
570
  }
571
  taosHashSetFreeFp(pSub->consumerHash, freeSMqConsumerEp);
110,316✔
572

573
  for (int32_t i = 0; i < sz; i++) {
168,280✔
574
    SMqConsumerEp consumerEp = {0};
57,964✔
575
    buf = tDecodeSMqConsumerEp(buf, &consumerEp, sver);
57,964✔
576
    if (taosHashPut(pSub->consumerHash, &consumerEp.consumerId, sizeof(int64_t), &consumerEp, sizeof(SMqConsumerEp)) !=
57,964✔
577
        0)
UNCOV
578
      return NULL;
×
579
  }
580

581
  int32_t len = 0;
110,316✔
582
  buf = taosDecodeFixedI32(buf, &len);
110,316✔
583
  pSub->unassignedVgs = taosArrayInit(len, sizeof(SMqVgEp));
110,316✔
584
  if (pSub->unassignedVgs == NULL) {
110,316✔
UNCOV
585
    return NULL;
×
586
  }
587
  for (int32_t i = 0; i < len; i++) {
350,896✔
588
    SMqVgEp* vgEp = taosArrayReserve(pSub->unassignedVgs, 1);
240,580✔
589
    if (vgEp != NULL)
240,580✔
590
      buf = tDecodeSMqVgEp(buf, vgEp, sver);
240,580✔
591
  }
592

593
  buf = taosDecodeStringTo(buf, pSub->dbName);
110,316✔
594

595
  if (sver > 1) {
110,316✔
596
    buf = tDecodeOffRows(buf, &pSub->offsetRows, sver);
110,316✔
597
    buf = taosDecodeString(buf, &pSub->qmsg);
220,632✔
598
  } else {
UNCOV
599
    pSub->qmsg = taosStrdup("");
×
600
  }
601
  return (void *)buf;
110,316✔
602
}
603

604
int32_t mndInitConfigObj(SConfigItem *pItem, SConfigObj *pObj) {
33,289,724✔
605
  tstrncpy(pObj->name, pItem->name, CFG_NAME_MAX_LEN);
33,289,724✔
606
  pObj->dtype = pItem->dtype;
33,289,724✔
607
  switch (pItem->dtype) {
33,289,724✔
UNCOV
608
    case CFG_DTYPE_NONE:
×
UNCOV
609
      break;
×
610
    case CFG_DTYPE_BOOL:
6,595,134✔
611
      pObj->bval = pItem->bval;
6,595,134✔
612
      break;
6,595,134✔
613
    case CFG_DTYPE_INT32:
18,215,132✔
614
      pObj->i32 = pItem->i32;
18,215,132✔
615
      break;
18,215,132✔
616
    case CFG_DTYPE_INT64:
1,884,324✔
617
      pObj->i64 = pItem->i64;
1,884,324✔
618
      break;
1,884,324✔
619
    case CFG_DTYPE_FLOAT:
628,108✔
620
    case CFG_DTYPE_DOUBLE:
621
      pObj->fval = pItem->fval;
628,108✔
622
      break;
628,108✔
623
    case CFG_DTYPE_STRING:
5,967,026✔
624
    case CFG_DTYPE_DIR:
625
    case CFG_DTYPE_LOCALE:
626
    case CFG_DTYPE_CHARSET:
627
    case CFG_DTYPE_TIMEZONE:
628
      pObj->str = taosStrdup(pItem->str);
5,967,026✔
629
      if (pObj->str == NULL) {
5,967,026✔
UNCOV
630
        taosMemoryFree(pObj);
×
UNCOV
631
        return TSDB_CODE_OUT_OF_MEMORY;
×
632
      }
633
      break;
5,967,026✔
634
  }
635
  return TSDB_CODE_SUCCESS;
33,289,724✔
636
}
637

638
int32_t mndUpdateObj(SConfigObj *pObjNew, const char *name, char *value) {
18,153✔
639
  int32_t code = 0;
18,153✔
640
  switch (pObjNew->dtype) {
18,153✔
641
    case CFG_DTYPE_BOOL: {
3,080✔
642
      bool tmp = false;
3,080✔
643
      if (strcasecmp(value, "true") == 0) {
3,080✔
UNCOV
644
        tmp = true;
×
645
      }
646
      if (taosStr2Int32(value, NULL, 10) > 0) {
3,080✔
647
        tmp = true;
1,063✔
648
      }
649
      pObjNew->bval = tmp;
3,080✔
650
      break;
3,080✔
651
    }
652
    case CFG_DTYPE_INT32: {
13,715✔
653
      int32_t ival;
13,715✔
654
      TAOS_CHECK_RETURN(taosStrHumanToInt32(value, &ival));
13,715✔
655
      pObjNew->i32 = ival;
13,715✔
656
      break;
13,715✔
657
    }
658
    case CFG_DTYPE_INT64: {
1,083✔
659
      int64_t ival;
1,083✔
660
      TAOS_CHECK_RETURN(taosStrHumanToInt64(value, &ival));
1,083✔
661
      pObjNew->i64 = ival;
1,083✔
662
      break;
1,083✔
663
    }
UNCOV
664
    case CFG_DTYPE_FLOAT:
×
665
    case CFG_DTYPE_DOUBLE: {
UNCOV
666
      float dval = 0;
×
UNCOV
667
      TAOS_CHECK_RETURN(parseCfgReal(value, &dval));
×
UNCOV
668
      pObjNew->fval = dval;
×
UNCOV
669
      break;
×
670
    }
671
    case CFG_DTYPE_DIR:
275✔
672
    case CFG_DTYPE_TIMEZONE:
673
    case CFG_DTYPE_CHARSET:
674
    case CFG_DTYPE_LOCALE:
675
    case CFG_DTYPE_STRING: {
676
      pObjNew->str = taosStrdup(value);
275✔
677
      if (pObjNew->str == NULL) {
275✔
UNCOV
678
        code = terrno;
×
UNCOV
679
        return code;
×
680
      }
681
      break;
275✔
682
    }
UNCOV
683
    case CFG_DTYPE_NONE:
×
684
      break;
×
685
    default:
×
UNCOV
686
      code = TSDB_CODE_INVALID_CFG;
×
UNCOV
687
      break;
×
688
  }
689
  return code;
18,153✔
690
}
691

692
SConfigObj mndInitConfigVersion() {
314,054✔
693
  SConfigObj obj;
312,615✔
694
  memset(&obj, 0, sizeof(SConfigObj));
314,054✔
695

696
  tstrncpy(obj.name, "tsmmConfigVersion", CFG_NAME_MAX_LEN);
314,054✔
697
  obj.dtype = CFG_DTYPE_INT32;
314,054✔
698
  obj.i32 = 0;
314,054✔
699
  return obj;
314,054✔
700
}
701

702
int32_t tEncodeSConfigObj(SEncoder *pEncoder, const SConfigObj *pObj) {
256,740,978✔
703
  TAOS_CHECK_RETURN(tStartEncode(pEncoder));
256,740,978✔
704
  TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, pObj->name));
513,481,956✔
705

706
  TAOS_CHECK_RETURN(tEncodeI32(pEncoder, pObj->dtype));
513,481,956✔
707
  switch (pObj->dtype) {
256,740,978✔
708
    case CFG_DTYPE_BOOL:
50,373,194✔
709
      TAOS_CHECK_RETURN(tEncodeI8(pEncoder, pObj->bval));
100,746,388✔
710
      break;
50,373,194✔
711
    case CFG_DTYPE_INT32:
141,614,192✔
712
      TAOS_CHECK_RETURN(tEncodeI32(pEncoder, pObj->i32));
283,228,384✔
713
      break;
141,614,192✔
714
    case CFG_DTYPE_INT64:
14,392,812✔
715
      TAOS_CHECK_RETURN(tEncodeI64(pEncoder, pObj->i64));
28,785,624✔
716
      break;
14,392,812✔
717
    case CFG_DTYPE_FLOAT:
4,796,160✔
718
    case CFG_DTYPE_DOUBLE:
719
      TAOS_CHECK_RETURN(tEncodeFloat(pEncoder, pObj->fval));
9,592,320✔
720
      break;
4,796,160✔
721
    case CFG_DTYPE_STRING:
45,564,620✔
722
    case CFG_DTYPE_DIR:
723
    case CFG_DTYPE_LOCALE:
724
    case CFG_DTYPE_CHARSET:
725
    case CFG_DTYPE_TIMEZONE:
726
      if (pObj->str != NULL) {
45,564,620✔
727
        TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, pObj->str));
91,129,240✔
728
      } else {
UNCOV
729
        TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, ""));
×
730
      }
731
      break;
45,564,620✔
UNCOV
732
    default:
×
UNCOV
733
      break;
×
734
  }
735
  tEndEncode(pEncoder);
256,740,978✔
736
  return pEncoder->pos;
256,740,978✔
737
}
738

739
int32_t tDecodeSConfigObj(SDecoder *pDecoder, SConfigObj *pObj) {
51,946,915✔
740
  TAOS_CHECK_RETURN(tStartDecode(pDecoder));
51,946,915✔
741
  TAOS_CHECK_RETURN(tDecodeCStrTo(pDecoder, pObj->name));
51,946,915✔
742
  TAOS_CHECK_RETURN(tDecodeI32(pDecoder, (int32_t *)&pObj->dtype));
103,893,830✔
743
  switch (pObj->dtype) {
51,946,915✔
UNCOV
744
    case CFG_DTYPE_NONE:
×
UNCOV
745
      break;
×
746
    case CFG_DTYPE_BOOL:
10,178,594✔
747
      TAOS_CHECK_RETURN(tDecodeBool(pDecoder, &pObj->bval));
10,178,594✔
748
      break;
10,178,594✔
749
    case CFG_DTYPE_INT32:
28,691,592✔
750
      TAOS_CHECK_RETURN(tDecodeI32(pDecoder, &pObj->i32));
57,383,184✔
751
      break;
28,691,592✔
752
    case CFG_DTYPE_INT64:
2,909,796✔
753
      TAOS_CHECK_RETURN(tDecodeI64(pDecoder, &pObj->i64));
5,819,592✔
754
      break;
2,909,796✔
755
    case CFG_DTYPE_FLOAT:
969,940✔
756
    case CFG_DTYPE_DOUBLE:
757
      TAOS_CHECK_RETURN(tDecodeFloat(pDecoder, &pObj->fval));
1,939,880✔
758
      break;
969,940✔
759
    case CFG_DTYPE_STRING:
9,196,993✔
760
    case CFG_DTYPE_DIR:
761
    case CFG_DTYPE_LOCALE:
762
    case CFG_DTYPE_CHARSET:
763
    case CFG_DTYPE_TIMEZONE:
764
      TAOS_CHECK_RETURN(tDecodeCStrAlloc(pDecoder, &pObj->str));
18,393,986✔
765
      break;
9,196,993✔
766
  }
767
  tEndDecode(pDecoder);
51,946,915✔
768
  TAOS_RETURN(TSDB_CODE_SUCCESS);
51,946,915✔
769
}
770

771
void tFreeSConfigObj(SConfigObj *obj) {
85,530,182✔
772
  if (obj == NULL) {
85,530,182✔
UNCOV
773
    return;
×
774
  }
775
  if (obj->dtype == CFG_DTYPE_STRING || obj->dtype == CFG_DTYPE_DIR || obj->dtype == CFG_DTYPE_LOCALE ||
85,530,182✔
776
      obj->dtype == CFG_DTYPE_CHARSET || obj->dtype == CFG_DTYPE_TIMEZONE) {
71,971,299✔
777
    taosMemoryFree(obj->str);
15,154,205✔
778
  }
779
}
780

781
// SMqSubActionLogEntry *tCloneSMqSubActionLogEntry(SMqSubActionLogEntry *pEntry) {
782
//   SMqSubActionLogEntry *pEntryNew = taosMemoryMalloc(sizeof(SMqSubActionLogEntry));
783
//   if (pEntryNew == NULL) return NULL;
784
//   pEntryNew->epoch = pEntry->epoch;
785
//   pEntryNew->consumers = taosArrayDup(pEntry->consumers, (__array_item_dup_fn_t)tCloneSMqConsumerEp);
786
//   return pEntryNew;
787
// }
788
//
789
// void tDeleteSMqSubActionLogEntry(SMqSubActionLogEntry *pEntry) {
790
//   taosArrayDestroyEx(pEntry->consumers, (FDelete)tDeleteSMqConsumerEp);
791
// }
792

793
// int32_t tEncodeSMqSubActionLogEntry(void **buf, const SMqSubActionLogEntry *pEntry) {
794
//   int32_t tlen = 0;
795
//   tlen += taosEncodeFixedI32(buf, pEntry->epoch);
796
//   tlen += taosEncodeArray(buf, pEntry->consumers, (FEncode)tEncodeSMqSubActionLogEntry);
797
//   return tlen;
798
// }
799
//
800
// void *tDecodeSMqSubActionLogEntry(const void *buf, SMqSubActionLogEntry *pEntry) {
801
//   buf = taosDecodeFixedI32(buf, &pEntry->epoch);
802
//   buf = taosDecodeArray(buf, &pEntry->consumers, (FDecode)tDecodeSMqSubActionLogEntry, sizeof(SMqSubActionLogEntry));
803
//   return (void *)buf;
804
// }
805

806
// SMqSubActionLogObj *tCloneSMqSubActionLogObj(SMqSubActionLogObj *pLog) {
807
//   SMqSubActionLogObj *pLogNew = taosMemoryMalloc(sizeof(SMqSubActionLogObj));
808
//   if (pLogNew == NULL) return pLogNew;
809
//   memcpy(pLogNew->key, pLog->key, TSDB_SUBSCRIBE_KEY_LEN);
810
//   pLogNew->logs = taosArrayDup(pLog->logs, (__array_item_dup_fn_t)tCloneSMqConsumerEp);
811
//   return pLogNew;
812
// }
813
//
814
// void tDeleteSMqSubActionLogObj(SMqSubActionLogObj *pLog) {
815
//   taosArrayDestroyEx(pLog->logs, (FDelete)tDeleteSMqConsumerEp);
816
// }
817

818
// int32_t tEncodeSMqSubActionLogObj(void **buf, const SMqSubActionLogObj *pLog) {
819
//   int32_t tlen = 0;
820
//   tlen += taosEncodeString(buf, pLog->key);
821
//   tlen += taosEncodeArray(buf, pLog->logs, (FEncode)tEncodeSMqSubActionLogEntry);
822
//   return tlen;
823
// }
824
//
825
// void *tDecodeSMqSubActionLogObj(const void *buf, SMqSubActionLogObj *pLog) {
826
//   buf = taosDecodeStringTo(buf, pLog->key);
827
//   buf = taosDecodeArray(buf, &pLog->logs, (FDecode)tDecodeSMqSubActionLogEntry, sizeof(SMqSubActionLogEntry));
828
//   return (void *)buf;
829
// }
830
//
831
// int32_t tEncodeSMqOffsetObj(void **buf, const SMqOffsetObj *pOffset) {
832
//   int32_t tlen = 0;
833
//   tlen += taosEncodeString(buf, pOffset->key);
834
//   tlen += taosEncodeFixedI64(buf, pOffset->offset);
835
//   return tlen;
836
// }
837
//
838
// void *tDecodeSMqOffsetObj(void *buf, SMqOffsetObj *pOffset) {
839
//   buf = taosDecodeStringTo(buf, pOffset->key);
840
//   buf = taosDecodeFixedI64(buf, &pOffset->offset);
841
//   return buf;
842
// }
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc