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

taosdata / TDengine / #4864

26 Nov 2025 05:46AM UTC coverage: 64.548% (+0.009%) from 64.539%
#4864

push

travis-ci

guanshengliang
Merge branch '3.0' into cover/3.0

769 of 945 new or added lines in 33 files covered. (81.38%)

3006 existing lines in 116 files now uncovered.

158227 of 245129 relevant lines covered (64.55%)

111826500.07 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) {
803,000✔
23
  TAOS_CHECK_RETURN(tStartEncode(pEncoder));
803,000✔
24

25
  TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, pObj->name));
1,606,000✔
26
  TAOS_CHECK_RETURN(tSerializeSCMCreateStreamReqImpl(pEncoder, pObj->pCreate));
803,000✔
27

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

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

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

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

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

60
_exit:
219,821✔
61

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

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

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

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

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

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

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

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

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

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

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

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

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

169
  *ppConsumer = pConsumer;
224,672✔
170
  return 0;
224,672✔
171

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

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

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

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

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

206
  // current topics
207
  if (pConsumer->currentTopics) {
524,728✔
208
    sz = taosArrayGetSize(pConsumer->currentTopics);
76,636✔
209
    tlen += taosEncodeFixedI32(buf, sz);
76,636✔
210
    for (int32_t i = 0; i < sz; i++) {
120,668✔
211
      char *topic = taosArrayGetP(pConsumer->currentTopics, i);
44,032✔
212
      tlen += taosEncodeString(buf, topic);
44,032✔
213
    }
214
  } else {
215
    tlen += taosEncodeFixedI32(buf, 0);
448,092✔
216
  }
217

218
  // reb new topics
219
  if (pConsumer->rebNewTopics) {
524,728✔
220
    sz = taosArrayGetSize(pConsumer->rebNewTopics);
361,504✔
221
    tlen += taosEncodeFixedI32(buf, sz);
361,504✔
222
    for (int32_t i = 0; i < sz; i++) {
594,914✔
223
      char *topic = taosArrayGetP(pConsumer->rebNewTopics, i);
233,410✔
224
      tlen += taosEncodeString(buf, topic);
233,410✔
225
    }
226
  } else {
227
    tlen += taosEncodeFixedI32(buf, 0);
163,224✔
228
  }
229

230
  // reb removed topics
231
  if (pConsumer->rebRemovedTopics) {
524,728✔
232
    sz = taosArrayGetSize(pConsumer->rebRemovedTopics);
234,604✔
233
    tlen += taosEncodeFixedI32(buf, sz);
234,604✔
234
    for (int32_t i = 0; i < sz; i++) {
392,936✔
235
      char *topic = taosArrayGetP(pConsumer->rebRemovedTopics, i);
158,332✔
236
      tlen += taosEncodeString(buf, topic);
158,332✔
237
    }
238
  } else {
239
    tlen += taosEncodeFixedI32(buf, 0);
290,124✔
240
  }
241

242
  // lost topics
243
  if (pConsumer->assignedTopics) {
524,728✔
244
    sz = taosArrayGetSize(pConsumer->assignedTopics);
256,664✔
245
    tlen += taosEncodeFixedI32(buf, sz);
256,664✔
246
    for (int32_t i = 0; i < sz; i++) {
429,218✔
247
      char *topic = taosArrayGetP(pConsumer->assignedTopics, i);
172,554✔
248
      tlen += taosEncodeString(buf, topic);
172,554✔
249
    }
250
  } else {
251
    tlen += taosEncodeFixedI32(buf, 0);
268,064✔
252
  }
253

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

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

274
  buf = taosDecodeFixedI32(buf, &pConsumer->pid);
225,511✔
275
  buf = taosDecodeSEpSet(buf, &pConsumer->ep);
225,511✔
276
  buf = taosDecodeFixedI64(buf, &pConsumer->createTime);
225,511✔
277
  buf = taosDecodeFixedI64(buf, &pConsumer->subscribeTime);
225,511✔
278
  buf = taosDecodeFixedI64(buf, &pConsumer->rebalanceTime);
451,022✔
279

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

294
  // reb new topics
295
  buf = taosDecodeFixedI32(buf, &sz);
225,511✔
296
  pConsumer->rebNewTopics = taosArrayInit(sz, sizeof(void *));
225,511✔
297
  for (int32_t i = 0; i < sz; i++) {
330,687✔
298
    char *topic;
103,976✔
299
    buf = taosDecodeString(buf, &topic);
105,176✔
300
    if (taosArrayPush(pConsumer->rebNewTopics, &topic) == NULL) {
210,352✔
UNCOV
301
      return NULL;
×
302
    }
303
  }
304

305
  // reb removed topics
306
  buf = taosDecodeFixedI32(buf, &sz);
225,511✔
307
  pConsumer->rebRemovedTopics = taosArrayInit(sz, sizeof(void *));
225,511✔
308
  for (int32_t i = 0; i < sz; i++) {
304,853✔
309
    char *topic;
78,142✔
310
    buf = taosDecodeString(buf, &topic);
79,342✔
311
    if (taosArrayPush(pConsumer->rebRemovedTopics, &topic) == NULL) {
158,684✔
UNCOV
312
      return NULL;
×
313
    }
314
  }
315

316
  // reb removed topics
317
  buf = taosDecodeFixedI32(buf, &sz);
225,511✔
318
  pConsumer->assignedTopics = taosArrayInit(sz, sizeof(void *));
225,511✔
319
  for (int32_t i = 0; i < sz; i++) {
278,901✔
320
    char *topic;
52,790✔
321
    buf = taosDecodeString(buf, &topic);
53,390✔
322
    if (taosArrayPush(pConsumer->assignedTopics, &topic) == NULL) {
106,780✔
UNCOV
323
      return NULL;
×
324
    }
325
  }
326

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

343
  return (void *)buf;
225,511✔
344
}
345

346
int32_t tEncodeOffRows(void **buf, SArray *offsetRows) {
443,740✔
347
  int32_t tlen = 0;
443,740✔
348
  int32_t szVgs = taosArrayGetSize(offsetRows);
443,740✔
349
  tlen += taosEncodeFixedI32(buf, szVgs);
443,740✔
350
  for (int32_t j = 0; j < szVgs; ++j) {
1,094,496✔
351
    OffsetRows *offRows = taosArrayGet(offsetRows, j);
650,756✔
352
    tlen += taosEncodeFixedI32(buf, offRows->vgId);
650,756✔
353
    tlen += taosEncodeFixedI64(buf, offRows->rows);
650,756✔
354
    tlen += taosEncodeFixedI8(buf, offRows->offset.type);
650,756✔
355
    if (offRows->offset.type == TMQ_OFFSET__SNAPSHOT_DATA || offRows->offset.type == TMQ_OFFSET__SNAPSHOT_META) {
650,756✔
356
      tlen += taosEncodeFixedI64(buf, offRows->offset.uid);
21,388✔
357
      tlen += taosEncodeFixedI64(buf, offRows->offset.ts);
42,776✔
358
    } else if (offRows->offset.type == TMQ_OFFSET__LOG) {
629,368✔
359
      tlen += taosEncodeFixedI64(buf, offRows->offset.version);
1,111,296✔
360
    } else {
361
      // do nothing
362
    }
363
    tlen += taosEncodeFixedI64(buf, offRows->ever);
1,301,512✔
364
  }
365

366
  return tlen;
443,740✔
367
}
368

369
int32_t tEncodeSMqConsumerEp(void **buf, const SMqConsumerEp *pConsumerEp) {
161,332✔
370
  int32_t tlen = 0;
161,332✔
371
  tlen += taosEncodeFixedI64(buf, pConsumerEp->consumerId);
161,332✔
372
  int32_t sz = taosArrayGetSize(pConsumerEp->vgs);
161,332✔
373
  tlen += taosEncodeFixedI32(buf, sz);
161,332✔
374
  for (int32_t i = 0; i < sz; i++) {
569,342✔
375
    void* data = taosArrayGet(pConsumerEp->vgs, i);
408,010✔
376
    tlen += tEncodeSMqVgEp(buf, data);
408,010✔
377
  }
378

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

382
void *tDecodeOffRows(const void *buf, SArray **offsetRows, int8_t sver) {
173,279✔
383
  int32_t szVgs = 0;
173,279✔
384
  buf = taosDecodeFixedI32(buf, &szVgs);
173,279✔
385
  if (szVgs > 0) {
173,279✔
386
    *offsetRows = taosArrayInit(szVgs, sizeof(OffsetRows));
71,903✔
387
    if (NULL == *offsetRows) return NULL;
71,903✔
388
    for (int32_t j = 0; j < szVgs; ++j) {
366,731✔
389
      OffsetRows *offRows = taosArrayReserve(*offsetRows, 1);
294,828✔
390
      buf = taosDecodeFixedI32(buf, &offRows->vgId);
294,828✔
391
      buf = taosDecodeFixedI64(buf, &offRows->rows);
294,828✔
392
      buf = taosDecodeFixedI8(buf, &offRows->offset.type);
294,828✔
393
      if (offRows->offset.type == TMQ_OFFSET__SNAPSHOT_DATA || offRows->offset.type == TMQ_OFFSET__SNAPSHOT_META) {
294,828✔
394
        buf = taosDecodeFixedI64(buf, &offRows->offset.uid);
9,678✔
395
        buf = taosDecodeFixedI64(buf, &offRows->offset.ts);
19,356✔
396
      } else if (offRows->offset.type == TMQ_OFFSET__LOG) {
285,150✔
397
        buf = taosDecodeFixedI64(buf, &offRows->offset.version);
502,618✔
398
      } else {
399
        // do nothing
400
      }
401
      if (sver > 2) {
294,828✔
402
        buf = taosDecodeFixedI64(buf, &offRows->ever);
589,656✔
403
      }
404
    }
405
  }
406
  return (void *)buf;
173,279✔
407
}
408

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

426
  return (void *)buf;
59,620✔
427
}
428

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

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

445
END:
39,724✔
446
  return code;
39,724✔
447
}
448

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

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

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

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

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

505
END:
54,438✔
506
  return code;
54,438✔
507
}
508

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

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

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

533
  int32_t cnt = 0;
282,408✔
534
  while (1) {
161,332✔
535
    pIter = taosHashIterate(pSub->consumerHash, pIter);
443,740✔
536
    if (pIter == NULL) break;
443,740✔
537
    SMqConsumerEp *pConsumerEp = (SMqConsumerEp *)pIter;
161,332✔
538
    tlen += tEncodeSMqConsumerEp(buf, pConsumerEp);
161,332✔
539
    cnt++;
161,332✔
540
  }
541
  if (cnt != sz) return -1;
282,408✔
542
  int32_t len = taosArrayGetSize(pSub->unassignedVgs);
282,408✔
543
  tlen += taosEncodeFixedI32(buf, len);
282,408✔
544
  for (int32_t i = 0; i < len; i++) {
801,690✔
545
    void* data = taosArrayGet(pSub->unassignedVgs, i);
519,282✔
546
    tlen += tEncodeSMqVgEp(buf, data);
519,282✔
547
  }
548
  tlen += taosEncodeString(buf, pSub->dbName);
282,408✔
549

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

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

564
  int32_t sz;
112,459✔
565
  buf = taosDecodeFixedI32(buf, &sz);
113,659✔
566

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

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

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

593
  buf = taosDecodeStringTo(buf, pSub->dbName);
113,659✔
594

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

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

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

692
SConfigObj mndInitConfigVersion() {
319,709✔
693
  SConfigObj obj;
318,209✔
694
  memset(&obj, 0, sizeof(SConfigObj));
319,709✔
695

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

702
int32_t tEncodeSConfigObj(SEncoder *pEncoder, const SConfigObj *pObj) {
262,906,994✔
703
  TAOS_CHECK_RETURN(tStartEncode(pEncoder));
262,906,994✔
704
  TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, pObj->name));
525,813,988✔
705

706
  TAOS_CHECK_RETURN(tEncodeI32(pEncoder, pObj->dtype));
525,813,988✔
707
  switch (pObj->dtype) {
262,906,994✔
708
    case CFG_DTYPE_BOOL:
51,582,794✔
709
      TAOS_CHECK_RETURN(tEncodeI8(pEncoder, pObj->bval));
103,165,588✔
710
      break;
51,582,794✔
711
    case CFG_DTYPE_INT32:
145,015,802✔
712
      TAOS_CHECK_RETURN(tEncodeI32(pEncoder, pObj->i32));
290,031,604✔
713
      break;
145,015,802✔
714
    case CFG_DTYPE_INT64:
14,738,432✔
715
      TAOS_CHECK_RETURN(tEncodeI64(pEncoder, pObj->i64));
29,476,864✔
716
      break;
14,738,432✔
717
    case CFG_DTYPE_FLOAT:
4,911,316✔
718
    case CFG_DTYPE_DOUBLE:
719
      TAOS_CHECK_RETURN(tEncodeFloat(pEncoder, pObj->fval));
9,822,632✔
720
      break;
4,911,316✔
721
    case CFG_DTYPE_STRING:
46,658,650✔
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) {
46,658,650✔
727
        TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, pObj->str));
93,317,300✔
728
      } else {
UNCOV
729
        TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, ""));
×
730
      }
731
      break;
46,658,650✔
UNCOV
732
    default:
×
UNCOV
733
      break;
×
734
  }
735
  tEndEncode(pEncoder);
262,906,994✔
736
  return pEncoder->pos;
262,906,994✔
737
}
738

739
int32_t tDecodeSConfigObj(SDecoder *pDecoder, SConfigObj *pObj) {
52,974,565✔
740
  TAOS_CHECK_RETURN(tStartDecode(pDecoder));
52,974,565✔
741
  TAOS_CHECK_RETURN(tDecodeCStrTo(pDecoder, pObj->name));
52,974,565✔
742
  TAOS_CHECK_RETURN(tDecodeI32(pDecoder, (int32_t *)&pObj->dtype));
105,949,130✔
743
  switch (pObj->dtype) {
52,974,565✔
UNCOV
744
    case CFG_DTYPE_NONE:
×
UNCOV
745
      break;
×
746
    case CFG_DTYPE_BOOL:
10,379,632✔
747
      TAOS_CHECK_RETURN(tDecodeBool(pDecoder, &pObj->bval));
10,379,632✔
748
      break;
10,379,632✔
749
    case CFG_DTYPE_INT32:
29,260,124✔
750
      TAOS_CHECK_RETURN(tDecodeI32(pDecoder, &pObj->i32));
58,520,248✔
751
      break;
29,260,124✔
752
    case CFG_DTYPE_INT64:
2,967,299✔
753
      TAOS_CHECK_RETURN(tDecodeI64(pDecoder, &pObj->i64));
5,934,598✔
754
      break;
2,967,299✔
755
    case CFG_DTYPE_FLOAT:
989,110✔
756
    case CFG_DTYPE_DOUBLE:
757
      TAOS_CHECK_RETURN(tDecodeFloat(pDecoder, &pObj->fval));
1,978,220✔
758
      break;
989,110✔
759
    case CFG_DTYPE_STRING:
9,378,400✔
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,756,800✔
765
      break;
9,378,400✔
766
  }
767
  tEndDecode(pDecoder);
52,974,565✔
768
  TAOS_RETURN(TSDB_CODE_SUCCESS);
52,974,565✔
769
}
770

771
void tFreeSConfigObj(SConfigObj *obj) {
87,162,067✔
772
  if (obj == NULL) {
87,162,067✔
UNCOV
773
    return;
×
774
  }
775
  if (obj->dtype == CFG_DTYPE_STRING || obj->dtype == CFG_DTYPE_DIR || obj->dtype == CFG_DTYPE_LOCALE ||
87,162,067✔
776
      obj->dtype == CFG_DTYPE_CHARSET || obj->dtype == CFG_DTYPE_TIMEZONE) {
73,345,074✔
777
    taosMemoryFree(obj->str);
15,442,689✔
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