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

taosdata / TDengine / #4868

26 Nov 2025 05:46AM UTC coverage: 64.629% (+0.2%) from 64.473%
#4868

push

travis-ci

guanshengliang
Merge branch '3.0' into cover/3.0

770 of 945 new or added lines in 33 files covered. (81.48%)

3010 existing lines in 120 files now uncovered.

158425 of 245129 relevant lines covered (64.63%)

113048242.66 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) {
787,498✔
23
  TAOS_CHECK_RETURN(tStartEncode(pEncoder));
787,498✔
24

25
  TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, pObj->name));
1,574,996✔
26
  TAOS_CHECK_RETURN(tSerializeSCMCreateStreamReqImpl(pEncoder, pObj->pCreate));
787,498✔
27

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

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

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

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

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

60
_exit:
215,369✔
61

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

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

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

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

89
void *tDecodeSMqVgEp(const void *buf, SMqVgEp *pVgEp, int8_t sver) {
400,072✔
90
  buf = taosDecodeFixedI32(buf, &pVgEp->vgId);
400,072✔
91
  if (sver == 1) {
400,072✔
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);
400,072✔
97
  return (void *)buf;
400,072✔
98
}
99

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

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

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

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

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

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

130
    char *topicTmp = taosStrdup(topic);
49,397✔
131
    if (taosArrayPush(pConsumer->rebNewTopics, &topicTmp) == NULL) {
98,794✔
132
      code = terrno;
×
133
      goto END;
×
134
    }
135
  } else if (updateType == CONSUMER_REMOVE_REB) {
162,541✔
136
    pConsumer->rebRemovedTopics = taosArrayInit(0, sizeof(void *));
38,040✔
137
    if (pConsumer->rebRemovedTopics == NULL) {
38,040✔
138
      code = terrno;
×
139
      goto END;
×
140
    }
141
    char *topicTmp = taosStrdup(topic);
38,040✔
142
    if (taosArrayPush(pConsumer->rebRemovedTopics, &topicTmp) == NULL) {
76,080✔
UNCOV
143
      code = terrno;
×
144
      goto END;
×
145
    }
146
  } else if (updateType == CONSUMER_INSERT_SUB) {
124,501✔
147
    tstrncpy(pConsumer->clientId, subscribe->clientId, tListLen(pConsumer->clientId));
48,575✔
148
    pConsumer->withTbName = subscribe->withTbName;
48,575✔
149
    pConsumer->autoCommit = subscribe->autoCommit;
48,575✔
150
    pConsumer->autoCommitInterval = subscribe->autoCommitInterval;
48,575✔
151
    pConsumer->resetOffsetCfg = subscribe->resetOffsetCfg;
48,575✔
152
    pConsumer->maxPollIntervalMs = subscribe->maxPollIntervalMs;
48,575✔
153
    pConsumer->sessionTimeoutMs = subscribe->sessionTimeoutMs;
48,575✔
154
    tstrncpy(pConsumer->user, subscribe->user, TSDB_USER_LEN);
48,575✔
155
    tstrncpy(pConsumer->fqdn, subscribe->fqdn, TSDB_FQDN_LEN);
48,575✔
156

157
    pConsumer->rebNewTopics = taosArrayDup(subscribe->topicNames, topicNameDup);
48,575✔
158
    if (pConsumer->rebNewTopics == NULL) {
48,575✔
UNCOV
159
      code = terrno;
×
UNCOV
160
      goto END;
×
161
    }
162
    pConsumer->assignedTopics = subscribe->topicNames;
48,575✔
163
    subscribe->topicNames = NULL;
48,575✔
164
  } else if (updateType == CONSUMER_UPDATE_SUB) {
75,926✔
165
    pConsumer->assignedTopics = subscribe->topicNames;
36,727✔
166
    subscribe->topicNames = NULL;
36,727✔
167
  }
168

169
  *ppConsumer = pConsumer;
211,938✔
170
  return 0;
211,938✔
171

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

177
void tClearSMqConsumerObj(SMqConsumerObj *pConsumer) {
740,240✔
178
  if (pConsumer == NULL) return;
740,240✔
179
  taosArrayDestroyP(pConsumer->currentTopics, NULL);
424,505✔
180
  taosArrayDestroyP(pConsumer->rebNewTopics, NULL);
424,505✔
181
  taosArrayDestroyP(pConsumer->rebRemovedTopics, NULL);
424,505✔
182
  taosArrayDestroyP(pConsumer->assignedTopics, NULL);
424,505✔
183
}
184

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

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

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

206
  // current topics
207
  if (pConsumer->currentTopics) {
495,280✔
208
    sz = taosArrayGetSize(pConsumer->currentTopics);
72,254✔
209
    tlen += taosEncodeFixedI32(buf, sz);
72,254✔
210
    for (int32_t i = 0; i < sz; i++) {
114,452✔
211
      char *topic = taosArrayGetP(pConsumer->currentTopics, i);
42,198✔
212
      tlen += taosEncodeString(buf, topic);
42,198✔
213
    }
214
  } else {
215
    tlen += taosEncodeFixedI32(buf, 0);
423,026✔
216
  }
217

218
  // reb new topics
219
  if (pConsumer->rebNewTopics) {
495,280✔
220
    sz = taosArrayGetSize(pConsumer->rebNewTopics);
340,802✔
221
    tlen += taosEncodeFixedI32(buf, sz);
340,802✔
222
    for (int32_t i = 0; i < sz; i++) {
560,472✔
223
      char *topic = taosArrayGetP(pConsumer->rebNewTopics, i);
219,670✔
224
      tlen += taosEncodeString(buf, topic);
219,670✔
225
    }
226
  } else {
227
    tlen += taosEncodeFixedI32(buf, 0);
154,478✔
228
  }
229

230
  // reb removed topics
231
  if (pConsumer->rebRemovedTopics) {
495,280✔
232
    sz = taosArrayGetSize(pConsumer->rebRemovedTopics);
220,938✔
233
    tlen += taosEncodeFixedI32(buf, sz);
220,938✔
234
    for (int32_t i = 0; i < sz; i++) {
370,138✔
235
      char *topic = taosArrayGetP(pConsumer->rebRemovedTopics, i);
149,200✔
236
      tlen += taosEncodeString(buf, topic);
149,200✔
237
    }
238
  } else {
239
    tlen += taosEncodeFixedI32(buf, 0);
274,342✔
240
  }
241

242
  // lost topics
243
  if (pConsumer->assignedTopics) {
495,280✔
244
    sz = taosArrayGetSize(pConsumer->assignedTopics);
242,008✔
245
    tlen += taosEncodeFixedI32(buf, sz);
242,008✔
246
    for (int32_t i = 0; i < sz; i++) {
405,026✔
247
      char *topic = taosArrayGetP(pConsumer->assignedTopics, i);
163,018✔
248
      tlen += taosEncodeString(buf, topic);
163,018✔
249
    }
250
  } else {
251
    tlen += taosEncodeFixedI32(buf, 0);
253,272✔
252
  }
253

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

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

274
  buf = taosDecodeFixedI32(buf, &pConsumer->pid);
212,567✔
275
  buf = taosDecodeSEpSet(buf, &pConsumer->ep);
212,567✔
276
  buf = taosDecodeFixedI64(buf, &pConsumer->createTime);
212,567✔
277
  buf = taosDecodeFixedI64(buf, &pConsumer->subscribeTime);
212,567✔
278
  buf = taosDecodeFixedI64(buf, &pConsumer->rebalanceTime);
425,134✔
279

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

294
  // reb new topics
295
  buf = taosDecodeFixedI32(buf, &sz);
212,567✔
296
  pConsumer->rebNewTopics = taosArrayInit(sz, sizeof(void *));
212,567✔
297
  for (int32_t i = 0; i < sz; i++) {
311,605✔
298
    char *topic;
97,868✔
299
    buf = taosDecodeString(buf, &topic);
99,038✔
300
    if (taosArrayPush(pConsumer->rebNewTopics, &topic) == NULL) {
198,076✔
UNCOV
301
      return NULL;
×
302
    }
303
  }
304

305
  // reb removed topics
306
  buf = taosDecodeFixedI32(buf, &sz);
212,567✔
307
  pConsumer->rebRemovedTopics = taosArrayInit(sz, sizeof(void *));
212,567✔
308
  for (int32_t i = 0; i < sz; i++) {
287,307✔
309
    char *topic;
73,570✔
310
    buf = taosDecodeString(buf, &topic);
74,740✔
311
    if (taosArrayPush(pConsumer->rebRemovedTopics, &topic) == NULL) {
149,480✔
UNCOV
312
      return NULL;
×
313
    }
314
  }
315

316
  // reb removed topics
317
  buf = taosDecodeFixedI32(buf, &sz);
212,567✔
318
  pConsumer->assignedTopics = taosArrayInit(sz, sizeof(void *));
212,567✔
319
  for (int32_t i = 0; i < sz; i++) {
262,739✔
320
    char *topic;
49,587✔
321
    buf = taosDecodeString(buf, &topic);
50,172✔
322
    if (taosArrayPush(pConsumer->assignedTopics, &topic) == NULL) {
100,344✔
UNCOV
323
      return NULL;
×
324
    }
325
  }
326

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

343
  return (void *)buf;
212,567✔
344
}
345

346
int32_t tEncodeOffRows(void **buf, SArray *offsetRows) {
418,172✔
347
  int32_t tlen = 0;
418,172✔
348
  int32_t szVgs = taosArrayGetSize(offsetRows);
418,172✔
349
  tlen += taosEncodeFixedI32(buf, szVgs);
418,172✔
350
  for (int32_t j = 0; j < szVgs; ++j) {
1,038,402✔
351
    OffsetRows *offRows = taosArrayGet(offsetRows, j);
620,230✔
352
    tlen += taosEncodeFixedI32(buf, offRows->vgId);
620,230✔
353
    tlen += taosEncodeFixedI64(buf, offRows->rows);
620,230✔
354
    tlen += taosEncodeFixedI8(buf, offRows->offset.type);
620,230✔
355
    if (offRows->offset.type == TMQ_OFFSET__SNAPSHOT_DATA || offRows->offset.type == TMQ_OFFSET__SNAPSHOT_META) {
620,230✔
356
      tlen += taosEncodeFixedI64(buf, offRows->offset.uid);
21,558✔
357
      tlen += taosEncodeFixedI64(buf, offRows->offset.ts);
43,116✔
358
    } else if (offRows->offset.type == TMQ_OFFSET__LOG) {
598,672✔
359
      tlen += taosEncodeFixedI64(buf, offRows->offset.version);
1,069,028✔
360
    } else {
361
      // do nothing
362
    }
363
    tlen += taosEncodeFixedI64(buf, offRows->ever);
1,240,460✔
364
  }
365

366
  return tlen;
418,172✔
367
}
368

369
int32_t tEncodeSMqConsumerEp(void **buf, const SMqConsumerEp *pConsumerEp) {
152,438✔
370
  int32_t tlen = 0;
152,438✔
371
  tlen += taosEncodeFixedI64(buf, pConsumerEp->consumerId);
152,438✔
372
  int32_t sz = taosArrayGetSize(pConsumerEp->vgs);
152,438✔
373
  tlen += taosEncodeFixedI32(buf, sz);
152,438✔
374
  for (int32_t i = 0; i < sz; i++) {
538,708✔
375
    void* data = taosArrayGet(pConsumerEp->vgs, i);
386,270✔
376
    tlen += tEncodeSMqVgEp(buf, data);
386,270✔
377
  }
378

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

382
void *tDecodeOffRows(const void *buf, SArray **offsetRows, int8_t sver) {
162,044✔
383
  int32_t szVgs = 0;
162,044✔
384
  buf = taosDecodeFixedI32(buf, &szVgs);
162,044✔
385
  if (szVgs > 0) {
162,044✔
386
    *offsetRows = taosArrayInit(szVgs, sizeof(OffsetRows));
67,292✔
387
    if (NULL == *offsetRows) return NULL;
67,292✔
388
    for (int32_t j = 0; j < szVgs; ++j) {
347,601✔
389
      OffsetRows *offRows = taosArrayReserve(*offsetRows, 1);
280,309✔
390
      buf = taosDecodeFixedI32(buf, &offRows->vgId);
280,309✔
391
      buf = taosDecodeFixedI64(buf, &offRows->rows);
280,309✔
392
      buf = taosDecodeFixedI8(buf, &offRows->offset.type);
280,309✔
393
      if (offRows->offset.type == TMQ_OFFSET__SNAPSHOT_DATA || offRows->offset.type == TMQ_OFFSET__SNAPSHOT_META) {
280,309✔
394
        buf = taosDecodeFixedI64(buf, &offRows->offset.uid);
9,779✔
395
        buf = taosDecodeFixedI64(buf, &offRows->offset.ts);
19,558✔
396
      } else if (offRows->offset.type == TMQ_OFFSET__LOG) {
270,530✔
397
        buf = taosDecodeFixedI64(buf, &offRows->offset.version);
484,134✔
398
      } else {
399
        // do nothing
400
      }
401
      if (sver > 2) {
280,309✔
402
        buf = taosDecodeFixedI64(buf, &offRows->ever);
560,618✔
403
      }
404
    }
405
  }
406
  return (void *)buf;
162,044✔
407
}
408

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

426
  return (void *)buf;
55,919✔
427
}
428

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

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

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

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

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

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

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

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

505
END:
50,929✔
506
  return code;
50,929✔
507
}
508

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

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

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

533
  int32_t cnt = 0;
265,734✔
534
  while (1) {
152,438✔
535
    pIter = taosHashIterate(pSub->consumerHash, pIter);
418,172✔
536
    if (pIter == NULL) break;
418,172✔
537
    SMqConsumerEp *pConsumerEp = (SMqConsumerEp *)pIter;
152,438✔
538
    tlen += tEncodeSMqConsumerEp(buf, pConsumerEp);
152,438✔
539
    cnt++;
152,438✔
540
  }
541
  if (cnt != sz) return -1;
265,734✔
542
  int32_t len = taosArrayGetSize(pSub->unassignedVgs);
265,734✔
543
  tlen += taosEncodeFixedI32(buf, len);
265,734✔
544
  for (int32_t i = 0; i < len; i++) {
757,948✔
545
    void* data = taosArrayGet(pSub->unassignedVgs, i);
492,214✔
546
    tlen += tEncodeSMqVgEp(buf, data);
492,214✔
547
  }
548
  tlen += taosEncodeString(buf, pSub->dbName);
265,734✔
549

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

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

564
  int32_t sz;
104,955✔
565
  buf = taosDecodeFixedI32(buf, &sz);
106,125✔
566

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

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

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

593
  buf = taosDecodeStringTo(buf, pSub->dbName);
106,125✔
594

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

604
int32_t mndInitConfigObj(SConfigItem *pItem, SConfigObj *pObj) {
33,406,218✔
605
  tstrncpy(pObj->name, pItem->name, CFG_NAME_MAX_LEN);
33,406,218✔
606
  pObj->dtype = pItem->dtype;
33,406,218✔
607
  switch (pItem->dtype) {
33,406,218✔
UNCOV
608
    case CFG_DTYPE_NONE:
×
UNCOV
609
      break;
×
610
    case CFG_DTYPE_BOOL:
6,618,213✔
611
      pObj->bval = pItem->bval;
6,618,213✔
612
      break;
6,618,213✔
613
    case CFG_DTYPE_INT32:
18,278,874✔
614
      pObj->i32 = pItem->i32;
18,278,874✔
615
      break;
18,278,874✔
616
    case CFG_DTYPE_INT64:
1,890,918✔
617
      pObj->i64 = pItem->i64;
1,890,918✔
618
      break;
1,890,918✔
619
    case CFG_DTYPE_FLOAT:
630,306✔
620
    case CFG_DTYPE_DOUBLE:
621
      pObj->fval = pItem->fval;
630,306✔
622
      break;
630,306✔
623
    case CFG_DTYPE_STRING:
5,987,907✔
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,987,907✔
629
      if (pObj->str == NULL) {
5,987,907✔
UNCOV
630
        taosMemoryFree(pObj);
×
UNCOV
631
        return TSDB_CODE_OUT_OF_MEMORY;
×
632
      }
633
      break;
5,987,907✔
634
  }
635
  return TSDB_CODE_SUCCESS;
33,406,218✔
636
}
637

638
int32_t mndUpdateObj(SConfigObj *pObjNew, const char *name, char *value) {
18,059✔
639
  int32_t code = 0;
18,059✔
640
  switch (pObjNew->dtype) {
18,059✔
641
    case CFG_DTYPE_BOOL: {
3,066✔
642
      bool tmp = false;
3,066✔
643
      if (strcasecmp(value, "true") == 0) {
3,066✔
UNCOV
644
        tmp = true;
×
645
      }
646
      if (taosStr2Int32(value, NULL, 10) > 0) {
3,066✔
647
        tmp = true;
1,055✔
648
      }
649
      pObjNew->bval = tmp;
3,066✔
650
      break;
3,066✔
651
    }
652
    case CFG_DTYPE_INT32: {
13,639✔
653
      int32_t ival;
13,639✔
654
      TAOS_CHECK_RETURN(taosStrHumanToInt32(value, &ival));
13,639✔
655
      pObjNew->i32 = ival;
13,639✔
656
      break;
13,639✔
657
    }
658
    case CFG_DTYPE_INT64: {
1,081✔
659
      int64_t ival;
1,081✔
660
      TAOS_CHECK_RETURN(taosStrHumanToInt64(value, &ival));
1,081✔
661
      pObjNew->i64 = ival;
1,081✔
662
      break;
1,081✔
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:
273✔
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);
273✔
677
      if (pObjNew->str == NULL) {
273✔
UNCOV
678
        code = terrno;
×
UNCOV
679
        return code;
×
680
      }
681
      break;
273✔
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,059✔
690
}
691

692
SConfigObj mndInitConfigVersion() {
315,153✔
693
  SConfigObj obj;
313,715✔
694
  memset(&obj, 0, sizeof(SConfigObj));
315,153✔
695

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

702
int32_t tEncodeSConfigObj(SEncoder *pEncoder, const SConfigObj *pObj) {
257,322,950✔
703
  TAOS_CHECK_RETURN(tStartEncode(pEncoder));
257,322,950✔
704
  TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, pObj->name));
514,645,900✔
705

706
  TAOS_CHECK_RETURN(tEncodeI32(pEncoder, pObj->dtype));
514,645,900✔
707
  switch (pObj->dtype) {
257,322,950✔
708
    case CFG_DTYPE_BOOL:
50,487,506✔
709
      TAOS_CHECK_RETURN(tEncodeI8(pEncoder, pObj->bval));
100,975,012✔
710
      break;
50,487,506✔
711
    case CFG_DTYPE_INT32:
141,934,826✔
712
      TAOS_CHECK_RETURN(tEncodeI32(pEncoder, pObj->i32));
283,869,652✔
713
      break;
141,934,826✔
714
    case CFG_DTYPE_INT64:
14,425,480✔
715
      TAOS_CHECK_RETURN(tEncodeI64(pEncoder, pObj->i64));
28,850,960✔
716
      break;
14,425,480✔
717
    case CFG_DTYPE_FLOAT:
4,807,052✔
718
    case CFG_DTYPE_DOUBLE:
719
      TAOS_CHECK_RETURN(tEncodeFloat(pEncoder, pObj->fval));
9,614,104✔
720
      break;
4,807,052✔
721
    case CFG_DTYPE_STRING:
45,668,086✔
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,668,086✔
727
        TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, pObj->str));
91,336,172✔
728
      } else {
UNCOV
729
        TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, ""));
×
730
      }
731
      break;
45,668,086✔
UNCOV
732
    default:
×
UNCOV
733
      break;
×
734
  }
735
  tEndEncode(pEncoder);
257,322,950✔
736
  return pEncoder->pos;
257,322,950✔
737
}
738

739
int32_t tDecodeSConfigObj(SDecoder *pDecoder, SConfigObj *pObj) {
52,080,640✔
740
  TAOS_CHECK_RETURN(tStartDecode(pDecoder));
52,080,640✔
741
  TAOS_CHECK_RETURN(tDecodeCStrTo(pDecoder, pObj->name));
52,080,640✔
742
  TAOS_CHECK_RETURN(tDecodeI32(pDecoder, (int32_t *)&pObj->dtype));
104,161,280✔
743
  switch (pObj->dtype) {
52,080,640✔
UNCOV
744
    case CFG_DTYPE_NONE:
×
UNCOV
745
      break;
×
746
    case CFG_DTYPE_BOOL:
10,204,896✔
747
      TAOS_CHECK_RETURN(tDecodeBool(pDecoder, &pObj->bval));
10,204,896✔
748
      break;
10,204,896✔
749
    case CFG_DTYPE_INT32:
28,765,164✔
750
      TAOS_CHECK_RETURN(tDecodeI32(pDecoder, &pObj->i32));
57,530,328✔
751
      break;
28,765,164✔
752
    case CFG_DTYPE_INT64:
2,917,309✔
753
      TAOS_CHECK_RETURN(tDecodeI64(pDecoder, &pObj->i64));
5,834,618✔
754
      break;
2,917,309✔
755
    case CFG_DTYPE_FLOAT:
972,444✔
756
    case CFG_DTYPE_DOUBLE:
757
      TAOS_CHECK_RETURN(tDecodeFloat(pDecoder, &pObj->fval));
1,944,888✔
758
      break;
972,444✔
759
    case CFG_DTYPE_STRING:
9,220,827✔
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,441,654✔
765
      break;
9,220,827✔
766
  }
767
  tEndDecode(pDecoder);
52,080,640✔
768
  TAOS_RETURN(TSDB_CODE_SUCCESS);
52,080,640✔
769
}
770

771
void tFreeSConfigObj(SConfigObj *obj) {
85,781,740✔
772
  if (obj == NULL) {
85,781,740✔
UNCOV
773
    return;
×
774
  }
775
  if (obj->dtype == CFG_DTYPE_STRING || obj->dtype == CFG_DTYPE_DIR || obj->dtype == CFG_DTYPE_LOCALE ||
85,781,740✔
776
      obj->dtype == CFG_DTYPE_CHARSET || obj->dtype == CFG_DTYPE_TIMEZONE) {
72,182,780✔
777
    taosMemoryFree(obj->str);
15,198,994✔
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