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

taosdata / TDengine / #3844

10 Apr 2025 08:48AM UTC coverage: 43.852% (-19.2%) from 63.077%
#3844

push

travis-ci

web-flow
fix: the REPLICA parameter supports plural forms when used to create and alter a database (#30732)

104394 of 310659 branches covered (33.6%)

Branch coverage included in aggregate %.

167442 of 309240 relevant lines covered (54.15%)

3866624.94 hits per line

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

54.77
/source/dnode/vnode/src/vnd/vnodeSync.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

16
#define _DEFAULT_SOURCE
17
#include "sync.h"
18
#include "tq.h"
19
#include "tqCommon.h"
20
#include "tsdb.h"
21
#include "vnd.h"
22

23
#define BATCH_ENABLE 0
24

25
static inline bool vnodeIsMsgWeak(tmsg_t type) { return false; }
3,262✔
26

27
static inline void vnodeWaitBlockMsg(SVnode *pVnode, const SRpcMsg *pMsg) {
4✔
28
  vGTrace(&pMsg->info.traceId, "vgId:%d, msg:%p, wait block, type:%s sec:%d seq:%" PRId64, pVnode->config.vgId, pMsg,
4!
29
          TMSG_INFO(pMsg->msgType), pVnode->blockSec, pVnode->blockSeq);
30
  if (tsem_wait(&pVnode->syncSem) != 0) {
4!
31
    vError("vgId:%d, failed to wait sem", pVnode->config.vgId);
×
32
  }
33
}
4✔
34

35
static inline void vnodePostBlockMsg(SVnode *pVnode, const SRpcMsg *pMsg) {
108✔
36
  if (vnodeIsMsgBlock(pMsg->msgType)) {
108✔
37
    (void)taosThreadMutexLock(&pVnode->lock);
8✔
38
    if (pVnode->blocked) {
8✔
39
      vGTrace(&pMsg->info.traceId, "vgId:%d, msg:%p, post block, type:%s sec:%d seq:%" PRId64, pVnode->config.vgId, pMsg,
4!
40
              TMSG_INFO(pMsg->msgType), pVnode->blockSec, pVnode->blockSeq);
41
      pVnode->blocked = false;
4✔
42
      pVnode->blockSec = 0;
4✔
43
      pVnode->blockSeq = 0;
4✔
44
      if (tsem_post(&pVnode->syncSem) != 0) {
4!
45
        vError("vgId:%d, failed to post sem", pVnode->config.vgId);
×
46
      }
47
    }
48
    (void)taosThreadMutexUnlock(&pVnode->lock);
8✔
49
  }
50
}
108✔
51

52
void vnodeRedirectRpcMsg(SVnode *pVnode, SRpcMsg *pMsg, int32_t code) {
298✔
53
  SEpSet newEpSet = {0};
298✔
54
  syncGetRetryEpSet(pVnode->sync, &newEpSet);
298✔
55

56
  vGTrace(&pMsg->info.traceId, "vgId:%d, msg:%p, is redirect since not leader, numOfEps:%d inUse:%d",
298!
57
          pVnode->config.vgId, pMsg, newEpSet.numOfEps, newEpSet.inUse);
58
  for (int32_t i = 0; i < newEpSet.numOfEps; ++i) {
894✔
59
    vGTrace(&pMsg->info.traceId, "vgId:%d, msg:%p, redirect:%d ep:%s:%u", pVnode->config.vgId, pMsg, i,
596!
60
            newEpSet.eps[i].fqdn, newEpSet.eps[i].port);
61
  }
62
  pMsg->info.hasEpSet = 1;
298✔
63

64
  if (code == 0) code = TSDB_CODE_SYN_NOT_LEADER;
298!
65

66
  SRpcMsg rsp = {.code = code, .info = pMsg->info, .msgType = pMsg->msgType + 1};
298✔
67
  int32_t contLen = tSerializeSEpSet(NULL, 0, &newEpSet);
298✔
68

69
  rsp.pCont = rpcMallocCont(contLen);
298✔
70
  if (rsp.pCont == NULL) {
298!
71
    pMsg->code = TSDB_CODE_OUT_OF_MEMORY;
×
72
  } else {
73
    if (tSerializeSEpSet(rsp.pCont, contLen, &newEpSet) < 0) {
298!
74
      vError("vgId:%d, failed to serialize ep set", pVnode->config.vgId);
×
75
    }
76
    rsp.contLen = contLen;
298✔
77
  }
78

79
  tmsgSendRsp(&rsp);
298✔
80
}
298✔
81

82
static void inline vnodeHandleWriteMsg(SVnode *pVnode, SRpcMsg *pMsg) {
2,914✔
83
  SRpcMsg rsp = {.code = pMsg->code, .info = pMsg->info};
2,914✔
84
  if (vnodeProcessWriteMsg(pVnode, pMsg, pMsg->info.conn.applyIndex, &rsp) < 0) {
2,914!
85
    rsp.code = terrno;
×
86
    vGError(&pMsg->info.traceId, "vgId:%d, msg:%p, failed to apply right now since %s", pVnode->config.vgId, pMsg,
×
87
            terrstr());
88
  }
89
  if (rsp.info.handle != NULL) {
2,914✔
90
    tmsgSendRsp(&rsp);
2,636✔
91
  } else {
92
    if (rsp.pCont) {
278✔
93
      rpcFreeCont(rsp.pCont);
250✔
94
    }
95
  }
96
}
2,914✔
97

98
static void vnodeHandleProposeError(SVnode *pVnode, SRpcMsg *pMsg, int32_t code) {
360✔
99
  if (code == TSDB_CODE_SYN_NOT_LEADER || code == TSDB_CODE_SYN_RESTORING) {
360!
100
    vnodeRedirectRpcMsg(pVnode, pMsg, code);
298✔
101
  } else if (code == TSDB_CODE_MSG_PREPROCESSED) {
62!
102
    SRpcMsg rsp = {.code = TSDB_CODE_SUCCESS, .info = pMsg->info};
62✔
103
    if (rsp.info.handle != NULL) {
62!
104
      tmsgSendRsp(&rsp);
62✔
105
    }
106
  } else {
107
    vGError(&pMsg->info.traceId, "vgId:%d, msg:%p, failed to propose since %s, code:0x%x", pVnode->config.vgId, pMsg,
×
108
            tstrerror(code), code);
109
    SRpcMsg rsp = {.code = code, .info = pMsg->info};
×
110
    if (rsp.info.handle != NULL) {
×
111
      tmsgSendRsp(&rsp);
×
112
    }
113
  }
114
}
360✔
115

116
static int32_t inline vnodeProposeMsg(SVnode *pVnode, SRpcMsg *pMsg, bool isWeak) {
2,918✔
117
  int64_t seq = 0;
2,918✔
118

119
  (void)taosThreadMutexLock(&pVnode->lock);
2,918✔
120
  int32_t code = syncPropose(pVnode->sync, pMsg, isWeak, &seq);
2,918✔
121
  bool    wait = (code == 0 && vnodeIsMsgBlock(pMsg->msgType));
2,918!
122
  if (wait) {
2,918✔
123
    if (pVnode->blocked) {
4!
124
      (void)taosThreadMutexUnlock(&pVnode->lock);
×
125
      return TSDB_CODE_INTERNAL_ERROR;
×
126
    }
127
    pVnode->blocked = true;
4✔
128
    pVnode->blockSec = taosGetTimestampSec();
4✔
129
    pVnode->blockSeq = seq;
4✔
130
  }
131
  (void)taosThreadMutexUnlock(&pVnode->lock);
2,918✔
132

133
  if (code > 0) {
2,918✔
134
    vnodeHandleWriteMsg(pVnode, pMsg);
2,914✔
135
  } else if (code < 0) {
4!
136
    if (terrno != 0) code = terrno;
×
137
    vnodeHandleProposeError(pVnode, pMsg, code);
×
138
  }
139

140
  if (wait) vnodeWaitBlockMsg(pVnode, pMsg);
2,918✔
141
  return code;
2,918✔
142
}
143

144
void vnodeProposeCommitOnNeed(SVnode *pVnode, bool atExit) {
3,026✔
145
  if (!vnodeShouldCommit(pVnode, atExit)) {
3,026✔
146
    return;
2,976✔
147
  }
148

149
  int32_t   contLen = sizeof(SMsgHead);
52✔
150
  SMsgHead *pHead = rpcMallocCont(contLen);
52✔
151
  pHead->contLen = contLen;
52✔
152
  pHead->vgId = pVnode->config.vgId;
52✔
153

154
  SRpcMsg rpcMsg = {0};
52✔
155
  rpcMsg.msgType = TDMT_VND_COMMIT;
52✔
156
  rpcMsg.contLen = contLen;
52✔
157
  rpcMsg.pCont = pHead;
52✔
158
  rpcMsg.info.noResp = 1;
52✔
159

160
  vInfo("vgId:%d, propose vnode commit", pVnode->config.vgId);
52✔
161
  bool isWeak = false;
52✔
162

163
  if (!atExit) {
52✔
164
    if (vnodeProposeMsg(pVnode, &rpcMsg, isWeak) < 0) {
16!
165
      vTrace("vgId:%d, failed to propose vnode commit since %s", pVnode->config.vgId, terrstr());
×
166
    }
167
    rpcFreeCont(rpcMsg.pCont);
16✔
168
    rpcMsg.pCont = NULL;
16✔
169
  } else {
170
    int32_t code = 0;
36✔
171
    if ((code = tmsgPutToQueue(&pVnode->msgCb, WRITE_QUEUE, &rpcMsg)) < 0) {
36✔
172
      vError("vgId:%d, failed to put vnode commit to write_queue since %s", pVnode->config.vgId, tstrerror(code));
32!
173
    }
174
  }
175
}
176

177
#if BATCH_ENABLE
178

179
static void inline vnodeProposeBatchMsg(SVnode *pVnode, SRpcMsg **pMsgArr, bool *pIsWeakArr, int32_t *arrSize) {
180
  if (*arrSize <= 0) return;
181
  SRpcMsg *pLastMsg = pMsgArr[*arrSize - 1];
182

183
  (void)taosThreadMutexLock(&pVnode->lock);
184
  int32_t code = syncProposeBatch(pVnode->sync, pMsgArr, pIsWeakArr, *arrSize);
185
  bool    wait = (code == 0 && vnodeIsBlockMsg(pLastMsg->msgType));
186
  if (wait) {
187
    pVnode->blocked = true;
188
  }
189
  (void)taosThreadMutexUnlock(&pVnode->lock);
190

191
  if (code > 0) {
192
    for (int32_t i = 0; i < *arrSize; ++i) {
193
      vnodeHandleWriteMsg(pVnode, pMsgArr[i]);
194
    }
195
  } else if (code < 0) {
196
    if (terrno != 0) code = terrno;
197
    for (int32_t i = 0; i < *arrSize; ++i) {
198
      vnodeHandleProposeError(pVnode, pMsgArr[i], code);
199
    }
200
  }
201

202
  if (wait) vnodeWaitBlockMsg(pVnode, pLastMsg);
203
  pLastMsg = NULL;
204

205
  for (int32_t i = 0; i < *arrSize; ++i) {
206
    SRpcMsg        *pMsg = pMsgArr[i];
207
    vGTrace(&pMsg->info.traceId, "vgId:%d, msg:%p, is freed, code:0x%x", pVnode->config.vgId, pMsg, code);
208
    rpcFreeCont(pMsg->pCont);
209
    taosFreeQitem(pMsg);
210
  }
211

212
  *arrSize = 0;
213
}
214

215
void vnodeProposeWriteMsg(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) {
216
  SVnode   *pVnode = pInfo->ahandle;
217
  int32_t   vgId = pVnode->config.vgId;
218
  int32_t   code = 0;
219
  SRpcMsg  *pMsg = NULL;
220
  int32_t   arrayPos = 0;
221
  SRpcMsg **pMsgArr = taosMemoryCalloc(numOfMsgs, sizeof(SRpcMsg *));
222
  bool     *pIsWeakArr = taosMemoryCalloc(numOfMsgs, sizeof(bool));
223
  vTrace("vgId:%d, get %d msgs from vnode-write queue", vgId, numOfMsgs);
224

225
  for (int32_t msg = 0; msg < numOfMsgs; msg++) {
226
    if (taosGetQitem(qall, (void **)&pMsg) == 0) continue;
227
    bool isWeak = vnodeIsMsgWeak(pMsg->msgType);
228
    bool isBlock = vnodeIsMsgBlock(pMsg->msgType);
229

230
    vGDebug(&pMsg->info.traceId, "vgId:%d, msg:%p, get from vnode-write queue, weak:%d block:%d msg:%d:%d pos:%d, handle:%p", vgId, pMsg,
231
            isWeak, isBlock, msg, numOfMsgs, arrayPos, pMsg->info.handle);
232

233
    if (!pVnode->restored) {
234
      vGWarn(&pMsg->info.traceId, "vgId:%d, msg:%p, failed to process since restore not finished, type:%s", vgId, pMsg,
235
             TMSG_INFO(pMsg->msgType));
236
      terrno = TSDB_CODE_SYN_RESTORING;
237
      vnodeHandleProposeError(pVnode, pMsg, TSDB_CODE_SYN_RESTORING);
238
      rpcFreeCont(pMsg->pCont);
239
      taosFreeQitem(pMsg);
240
      continue;
241
    }
242

243
    if (pMsgArr == NULL || pIsWeakArr == NULL) {
244
      vGError(&pMsg->info.traceId, "vgId:%d, msg:%p, failed to process since out of memory, type:%s", vgId, pMsg, TMSG_INFO(pMsg->msgType));
245
      terrno = TSDB_CODE_OUT_OF_MEMORY;
246
      vnodeHandleProposeError(pVnode, pMsg, terrno);
247
      rpcFreeCont(pMsg->pCont);
248
      taosFreeQitem(pMsg);
249
      continue;
250
    }
251

252
    bool atExit = false;
253
    vnodeProposeCommitOnNeed(pVnode, atExit);
254

255
    code = vnodePreProcessWriteMsg(pVnode, pMsg);
256
    if (code != 0) {
257
      vGError(&pMsg->info.traceId, "vgId:%d, msg:%p, failed to pre-process since %s", vgId, pMsg, terrstr());
258
      rpcFreeCont(pMsg->pCont);
259
      taosFreeQitem(pMsg);
260
      continue;
261
    }
262

263
    if (isBlock) {
264
      vnodeProposeBatchMsg(pVnode, pMsgArr, pIsWeakArr, &arrayPos);
265
    }
266

267
    pMsgArr[arrayPos] = pMsg;
268
    pIsWeakArr[arrayPos] = isWeak;
269
    arrayPos++;
270

271
    if (isBlock || msg == numOfMsgs - 1) {
272
      vnodeProposeBatchMsg(pVnode, pMsgArr, pIsWeakArr, &arrayPos);
273
    }
274
  }
275

276
  taosMemoryFree(pMsgArr);
277
  taosMemoryFree(pIsWeakArr);
278
}
279

280
#else
281

282
void vnodeProposeWriteMsg(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) {
2,834✔
283
  SVnode  *pVnode = pInfo->ahandle;
2,834✔
284
  int32_t  vgId = pVnode->config.vgId;
2,834✔
285
  int32_t  code = 0;
2,834✔
286
  SRpcMsg *pMsg = NULL;
2,834✔
287
  vTrace("vgId:%d, get %d msgs from vnode-write queue", vgId, numOfMsgs);
2,834!
288

289
  for (int32_t msg = 0; msg < numOfMsgs; msg++) {
6,094✔
290
    if (taosGetQitem(qall, (void **)&pMsg) == 0) continue;
3,260!
291
    bool isWeak = vnodeIsMsgWeak(pMsg->msgType);
3,260✔
292

293
    vGDebug(&pMsg->info.traceId, "vgId:%d, msg:%p, get from vnode-write queue, weak:%d block:%d msg:%d:%d, handle:%p",
3,262!
294
            vgId, pMsg, isWeak, vnodeIsMsgBlock(pMsg->msgType), msg, numOfMsgs, pMsg->info.handle);
295

296
    if (!pVnode->restored) {
3,262✔
297
      vGWarn(&pMsg->info.traceId, "vgId:%d, msg:%p, failed to process since restore not finished, type:%s", vgId, pMsg,
298!
298
             TMSG_INFO(pMsg->msgType));
299
      vnodeHandleProposeError(pVnode, pMsg, TSDB_CODE_SYN_RESTORING);
298✔
300
      rpcFreeCont(pMsg->pCont);
298✔
301
      taosFreeQitem(pMsg);
298✔
302
      continue;
298✔
303
    }
304

305
    bool atExit = false;
2,964✔
306
    vnodeProposeCommitOnNeed(pVnode, atExit);
2,964✔
307

308
    code = vnodePreProcessWriteMsg(pVnode, pMsg);
2,964✔
309
    if (code != 0) {
2,962✔
310
      if (code != TSDB_CODE_MSG_PREPROCESSED) {
62!
311
        vGError(&pMsg->info.traceId, "vgId:%d, msg:%p, failed to pre-process since %s", vgId, pMsg, tstrerror(code));
×
312
      }
313
      vnodeHandleProposeError(pVnode, pMsg, code);
62✔
314
      rpcFreeCont(pMsg->pCont);
62✔
315
      taosFreeQitem(pMsg);
62✔
316
      continue;
62✔
317
    }
318

319
    code = vnodeProposeMsg(pVnode, pMsg, isWeak);
2,900✔
320

321
    vGTrace(&pMsg->info.traceId, "vgId:%d, msg:%p, is freed, code:0x%x", vgId, pMsg, code);
2,902!
322
    rpcFreeCont(pMsg->pCont);
2,902✔
323
    taosFreeQitem(pMsg);
2,902✔
324
  }
325
}
2,834✔
326

327
#endif
328

329
void vnodeApplyWriteMsg(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) {
98✔
330
  SVnode  *pVnode = pInfo->ahandle;
98✔
331
  int32_t  vgId = pVnode->config.vgId;
98✔
332
  int32_t  code = 0;
98✔
333
  SRpcMsg *pMsg = NULL;
98✔
334

335
  for (int32_t i = 0; i < numOfMsgs; ++i) {
206✔
336
    if (taosGetQitem(qall, (void **)&pMsg) == 0) continue;
108!
337

338
    if (vnodeIsMsgBlock(pMsg->msgType)) {
108✔
339
      vGDebug(&pMsg->info.traceId, "vgId:%d, msg:%p, get from vnode-apply queue, type:%s handle:%p index:%" PRId64
8!
340
              ", blocking msg obtained sec:%d seq:%" PRId64,
341
              vgId, pMsg, TMSG_INFO(pMsg->msgType), pMsg->info.handle, pMsg->info.conn.applyIndex, pVnode->blockSec,
342
              pVnode->blockSeq);
343
    } else {
344
      vGDebug(&pMsg->info.traceId, "vgId:%d, msg:%p, get from vnode-apply queue, type:%s handle:%p index:%" PRId64, vgId, pMsg,
100!
345
              TMSG_INFO(pMsg->msgType), pMsg->info.handle, pMsg->info.conn.applyIndex);
346
    }
347

348
    SRpcMsg rsp = {.code = pMsg->code, .info = pMsg->info};
108✔
349
    if (rsp.code == 0) {
108!
350
      if (vnodeProcessWriteMsg(pVnode, pMsg, pMsg->info.conn.applyIndex, &rsp) < 0) {
108!
351
        rsp.code = terrno;
×
352
        vGError(&pMsg->info.traceId, "vgId:%d, msg:%p, failed to apply since %s, index:%" PRId64, vgId, pMsg, terrstr(),
×
353
                pMsg->info.conn.applyIndex);
354
      }
355
    }
356

357
    vnodePostBlockMsg(pVnode, pMsg);
108✔
358
    if (rsp.info.handle != NULL) {
108✔
359
      tmsgSendRsp(&rsp);
4✔
360
    } else {
361
      if (rsp.pCont) {
104!
362
        rpcFreeCont(rsp.pCont);
×
363
      }
364
    }
365

366
    vGTrace(&pMsg->info.traceId, "vgId:%d, msg:%p, is freed, code:0x%x index:%" PRId64, vgId, pMsg, rsp.code,
108!
367
            pMsg->info.conn.applyIndex);
368
    rpcFreeCont(pMsg->pCont);
108✔
369
    taosFreeQitem(pMsg);
108✔
370
  }
371
}
98✔
372

373
int32_t vnodeProcessSyncMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) {
4,698✔
374
  vGDebug(&pMsg->info.traceId, "vgId:%d, msg:%p, get from vnode-sync queue, type:%s", pVnode->config.vgId, pMsg, TMSG_INFO(pMsg->msgType));
4,698!
375

376
  int32_t code = syncProcessMsg(pVnode->sync, pMsg);
4,698✔
377
  if (code != 0) {
4,698!
378
    vGError(&pMsg->info.traceId, "vgId:%d, msg:%p, failed to process since %s, type:%s", pVnode->config.vgId, pMsg, tstrerror(code),
×
379
            TMSG_INFO(pMsg->msgType));
380
  }
381

382
  return code;
4,698✔
383
}
384

385
static int32_t vnodeSyncEqCtrlMsg(const SMsgCb *msgcb, SRpcMsg *pMsg) {
×
386
  if (pMsg == NULL || pMsg->pCont == NULL) {
×
387
    return TSDB_CODE_INVALID_PARA;
×
388
  }
389

390
  if (msgcb == NULL || msgcb->putToQueueFp == NULL) {
×
391
    rpcFreeCont(pMsg->pCont);
×
392
    pMsg->pCont = NULL;
×
393
    return TSDB_CODE_INVALID_PARA;
×
394
  }
395

396
  int32_t code = tmsgPutToQueue(msgcb, SYNC_RD_QUEUE, pMsg);
×
397
  if (code != 0) {
×
398
    rpcFreeCont(pMsg->pCont);
×
399
    pMsg->pCont = NULL;
×
400
  }
401
  return code;
×
402
}
403

404
static int32_t vnodeSyncEqMsg(const SMsgCb *msgcb, SRpcMsg *pMsg) {
174✔
405
  if (pMsg == NULL || pMsg->pCont == NULL) {
174!
406
    return TSDB_CODE_INVALID_PARA;
×
407
  }
408

409
  if (msgcb == NULL || msgcb->putToQueueFp == NULL) {
174!
410
    rpcFreeCont(pMsg->pCont);
×
411
    pMsg->pCont = NULL;
×
412
    return TSDB_CODE_INVALID_PARA;
×
413
  }
414

415
  int32_t code = tmsgPutToQueue(msgcb, SYNC_QUEUE, pMsg);
174✔
416
  if (code != 0) {
174✔
417
    rpcFreeCont(pMsg->pCont);
4✔
418
    pMsg->pCont = NULL;
4✔
419
  }
420
  return code;
174✔
421
}
422

423
static int32_t vnodeSyncSendMsg(const SEpSet *pEpSet, SRpcMsg *pMsg) {
4,536✔
424
  int32_t code = tmsgSendSyncReq(pEpSet, pMsg);
4,536✔
425
  if (code != 0) {
4,536!
426
    rpcFreeCont(pMsg->pCont);
×
427
    pMsg->pCont = NULL;
×
428
  }
429
  return code;
4,536✔
430
}
431

432
static int32_t vnodeSyncGetSnapshotInfo(const SSyncFSM *pFsm, SSnapshot *pSnapshot) {
1,716✔
433
  return vnodeGetSnapshot(pFsm->data, pSnapshot);
1,716✔
434
}
435

436
static int32_t vnodeSyncApplyMsg(const SSyncFSM *pFsm, SRpcMsg *pMsg, const SFsmCbMeta *pMeta) {
108✔
437
  SVnode *pVnode = pFsm->data;
108✔
438
  pMsg->info.conn.applyIndex = pMeta->index;
108✔
439
  pMsg->info.conn.applyTerm = pMeta->term;
108✔
440

441
  vGDebug(&pMsg->info.traceId,
108!
442
          "vgId:%d, index:%" PRId64 ", execute commit cb, fsm:%p, term:%" PRIu64 ", msg-index:%" PRId64
443
          ", weak:%d, code:%d, state:%d %s, type:%s code:0x%x",
444
          pVnode->config.vgId, pMeta->index, pFsm, pMeta->term, pMsg->info.conn.applyIndex, pMeta->isWeak, pMeta->code,
445
          pMeta->state, syncStr(pMeta->state), TMSG_INFO(pMsg->msgType), pMsg->code);
446

447
  int32_t code = tmsgPutToQueue(&pVnode->msgCb, APPLY_QUEUE, pMsg);
108✔
448
  if (code < 0) vError("vgId:%d, failed to put into apply_queue since %s", pVnode->config.vgId, tstrerror(code));
108!
449
  return code;
108✔
450
}
451

452
static int32_t vnodeSyncCommitMsg(const SSyncFSM *pFsm, SRpcMsg *pMsg, SFsmCbMeta *pMeta) {
108✔
453
  if (pMsg->code == 0) {
108!
454
    return vnodeSyncApplyMsg(pFsm, pMsg, pMeta);
108✔
455
  }
456

457
  SVnode *pVnode = pFsm->data;
×
458
  vnodePostBlockMsg(pVnode, pMsg);
×
459

460
  SRpcMsg rsp = {
×
461
      .code = pMsg->code,
×
462
      .info = pMsg->info,
463
  };
464

465
  if (rsp.info.handle != NULL) {
×
466
    tmsgSendRsp(&rsp);
×
467
  }
468

469
  vGTrace(&pMsg->info.traceId, "vgId:%d, msg:%p, is freed, code:0x%x index:%" PRId64, TD_VID(pVnode), pMsg, rsp.code,
×
470
          pMeta->index);
471
  rpcFreeCont(pMsg->pCont);
×
472
  pMsg->pCont = NULL;
×
473
  return 0;
×
474
}
475

476
static int32_t vnodeSyncPreCommitMsg(const SSyncFSM *pFsm, SRpcMsg *pMsg, SFsmCbMeta *pMeta) {
×
477
  if (pMeta->isWeak == 1) {
×
478
    return vnodeSyncApplyMsg(pFsm, pMsg, pMeta);
×
479
  }
480
  return 0;
×
481
}
482

483
static SyncIndex vnodeSyncAppliedIndex(const SSyncFSM *pFSM) {
3,248✔
484
  SVnode *pVnode = pFSM->data;
3,248✔
485
  return atomic_load_64(&pVnode->state.applied);
3,248✔
486
}
487

488
static void vnodeSyncRollBackMsg(const SSyncFSM *pFsm, SRpcMsg *pMsg, SFsmCbMeta *pMeta) {
×
489
  SVnode *pVnode = pFsm->data;
×
490
  vGDebug(&pMsg->info.traceId,
×
491
          "vgId:%d, rollback-cb is excuted, fsm:%p, index:%" PRId64 ", weak:%d, code:%d, state:%d %s, type:%s",
492
          pVnode->config.vgId, pFsm, pMeta->index, pMeta->isWeak, pMeta->code, pMeta->state, syncStr(pMeta->state),
493
          TMSG_INFO(pMsg->msgType));
494
}
×
495

496
static int32_t vnodeSnapshotStartRead(const SSyncFSM *pFsm, void *pParam, void **ppReader) {
4✔
497
  SVnode *pVnode = pFsm->data;
4✔
498
  return vnodeSnapReaderOpen(pVnode, (SSnapshotParam *)pParam, (SVSnapReader **)ppReader);
4✔
499
}
500

501
static void vnodeSnapshotStopRead(const SSyncFSM *pFsm, void *pReader) {
4✔
502
  SVnode *pVnode = pFsm->data;
4✔
503
  vnodeSnapReaderClose(pReader);
4✔
504
}
4✔
505

506
static int32_t vnodeSnapshotDoRead(const SSyncFSM *pFsm, void *pReader, void **ppBuf, int32_t *len) {
2,192✔
507
  SVnode *pVnode = pFsm->data;
2,192✔
508
  return vnodeSnapRead(pReader, (uint8_t **)ppBuf, len);
2,192✔
509
}
510

511
static int32_t vnodeSnapshotStartWrite(const SSyncFSM *pFsm, void *pParam, void **ppWriter) {
4✔
512
  SVnode *pVnode = pFsm->data;
4✔
513

514
  do {
×
515
    int32_t itemSize = tmsgGetQueueSize(&pVnode->msgCb, pVnode->config.vgId, APPLY_QUEUE);
4✔
516
    if (itemSize == 0) {
4!
517
      vInfo("vgId:%d, start write vnode snapshot since apply queue is empty", pVnode->config.vgId);
4!
518
      break;
4✔
519
    } else {
520
      vInfo("vgId:%d, write vnode snapshot later since %d items in apply queue", pVnode->config.vgId, itemSize);
×
521
      taosMsleep(10);
×
522
    }
523
  } while (true);
524

525
  return vnodeSnapWriterOpen(pVnode, (SSnapshotParam *)pParam, (SVSnapWriter **)ppWriter);
4✔
526
}
527

528
static int32_t vnodeSnapshotStopWrite(const SSyncFSM *pFsm, void *pWriter, bool isApply, SSnapshot *pSnapshot) {
4✔
529
  SVnode *pVnode = pFsm->data;
4✔
530
  vInfo("vgId:%d, stop write vnode snapshot, apply:%d, index:%" PRId64 " term:%" PRIu64 " config:%" PRId64,
4!
531
        pVnode->config.vgId, isApply, pSnapshot->lastApplyIndex, pSnapshot->lastApplyTerm, pSnapshot->lastConfigIndex);
532

533
  int32_t code = vnodeSnapWriterClose(pWriter, !isApply, pSnapshot);
4✔
534
  if (code != 0) {
4!
535
    vError("vgId:%d, failed to finish applying vnode snapshot since %s, code:0x%x", pVnode->config.vgId, terrstr(),
×
536
           code);
537
  }
538
  return code;
4✔
539
}
540

541
static int32_t vnodeSnapshotDoWrite(const SSyncFSM *pFsm, void *pWriter, void *pBuf, int32_t len) {
2,188✔
542
  SVnode *pVnode = pFsm->data;
2,188✔
543
  vDebug("vgId:%d, continue write vnode snapshot, blockLen:%d", pVnode->config.vgId, len);
2,188!
544
  int32_t code = vnodeSnapWrite(pWriter, pBuf, len);
2,188✔
545
  vDebug("vgId:%d, continue write vnode snapshot finished, blockLen:%d", pVnode->config.vgId, len);
2,188!
546
  return code;
2,188✔
547
}
548

549
static void vnodeRestoreFinish(const SSyncFSM *pFsm, const SyncIndex commitIdx) {
68✔
550
  SVnode   *pVnode = pFsm->data;
68✔
551
  int32_t   vgId = pVnode->config.vgId;
68✔
552
  SyncIndex appliedIdx = -1;
68✔
553

554
  do {
555
    appliedIdx = vnodeSyncAppliedIndex(pFsm);
130✔
556
    if (appliedIdx > commitIdx) {
130!
557
      vError("vgId:%d, restore failed since applied-index:%" PRId64 " is larger than commit-index:%" PRId64, vgId,
×
558
             appliedIdx, commitIdx);
559
      break;
×
560
    }
561
    if (appliedIdx == commitIdx) {
130✔
562
      vInfo("vgId:%d, no items to be applied, restore finish", pVnode->config.vgId);
68✔
563
      break;
68✔
564
    } else {
565
      vInfo("vgId:%d, restore not finish since %" PRId64 " items to be applied. commit-index:%" PRId64
62✔
566
            ", applied-index:%" PRId64,
567
            vgId, commitIdx - appliedIdx, commitIdx, appliedIdx);
568
      taosMsleep(10);
62✔
569
    }
570
  } while (true);
571

572
  walApplyVer(pVnode->pWal, commitIdx);
68✔
573
  pVnode->restored = true;
68✔
574

575
#ifdef USE_STREAM
576
  SStreamMeta *pMeta = pVnode->pTq->pStreamMeta;
68✔
577
  streamMetaWLock(pMeta);
68✔
578

579
  if (pMeta->startInfo.tasksWillRestart) {
68✔
580
    vInfo("vgId:%d, sync restore finished, stream tasks will be launched by other thread", vgId);
4!
581
    streamMetaWUnLock(pMeta);
4✔
582
    return;
4✔
583
  }
584

585
  if (vnodeIsRoleLeader(pVnode)) {
64✔
586
    // start to restore all stream tasks
587
    if (tsDisableStream) {
60!
588
      vInfo("vgId:%d, sync restore finished, not launch stream tasks, since stream tasks are disabled", vgId);
×
589
    } else {
590
      vInfo("vgId:%d sync restore finished, start to launch stream task(s)", vgId);
60✔
591
      if (pMeta->startInfo.startAllTasks == 1) {
60!
592
        pMeta->startInfo.restartCount += 1;
×
593
        vDebug("vgId:%d in start tasks procedure, inc restartCounter by 1, remaining restart:%d", vgId,
×
594
               pMeta->startInfo.restartCount);
595
      } else {
596
        pMeta->startInfo.startAllTasks = 1;
60✔
597
        streamMetaWUnLock(pMeta);
60✔
598

599
        tqInfo("vgId:%d stream task already loaded, start them", vgId);
60!
600
        int32_t code = streamTaskSchedTask(&pVnode->msgCb, TD_VID(pVnode), 0, 0, STREAM_EXEC_T_START_ALL_TASKS, false);
60✔
601
        if (code != 0) {
60!
602
          tqError("vgId:%d failed to sched stream task, code:%s", vgId, tstrerror(code));
×
603
        }
604
        return;
60✔
605
      }
606
    }
607
  } else {
608
    vInfo("vgId:%d, sync restore finished, not launch stream tasks since not leader", vgId);
4!
609
  }
610

611
  streamMetaWUnLock(pMeta);
4✔
612
#endif
613
}
614

615
static void vnodeBecomeFollower(const SSyncFSM *pFsm) {
16✔
616
  SVnode *pVnode = pFsm->data;
16✔
617
  vInfo("vgId:%d, become follower", pVnode->config.vgId);
16!
618

619
  (void)taosThreadMutexLock(&pVnode->lock);
16✔
620
  if (pVnode->blocked) {
16!
621
    pVnode->blocked = false;
×
622
    vDebug("vgId:%d, become follower and post block", pVnode->config.vgId);
×
623
    if (tsem_post(&pVnode->syncSem) != 0) {
×
624
      vError("vgId:%d, failed to post sync semaphore", pVnode->config.vgId);
×
625
    }
626
  }
627
  (void)taosThreadMutexUnlock(&pVnode->lock);
16✔
628

629
#ifdef USE_TQ
630
  if (pVnode->pTq) {
16!
631
    tqUpdateNodeStage(pVnode->pTq, false);
16✔
632
    if (tqStopStreamAllTasksAsync(pVnode->pTq->pStreamMeta, &pVnode->msgCb) != 0) {
16!
633
      vError("vgId:%d, failed to stop stream tasks", pVnode->config.vgId);
×
634
    }
635
  }
636
#endif
637
}
16✔
638

639
static void vnodeBecomeLearner(const SSyncFSM *pFsm) {
4✔
640
  SVnode *pVnode = pFsm->data;
4✔
641
  vInfo("vgId:%d, become learner", pVnode->config.vgId);
4!
642

643
  (void)taosThreadMutexLock(&pVnode->lock);
4✔
644
  if (pVnode->blocked) {
4!
645
    pVnode->blocked = false;
×
646
    vDebug("vgId:%d, become learner and post block", pVnode->config.vgId);
×
647
    if (tsem_post(&pVnode->syncSem) != 0) {
×
648
      vError("vgId:%d, failed to post sync semaphore", pVnode->config.vgId);
×
649
    }
650
  }
651
  (void)taosThreadMutexUnlock(&pVnode->lock);
4✔
652
}
4✔
653

654
static void vnodeBecomeLeader(const SSyncFSM *pFsm) {
64✔
655
  SVnode *pVnode = pFsm->data;
64✔
656
  vDebug("vgId:%d, become leader", pVnode->config.vgId);
64!
657
#ifdef USE_TQ
658
  if (pVnode->pTq) {
64!
659
    tqUpdateNodeStage(pVnode->pTq, true);
64✔
660
  }
661
#endif
662
}
64✔
663

664
static void vnodeBecomeAssignedLeader(const SSyncFSM *pFsm) {
×
665
  SVnode *pVnode = pFsm->data;
×
666
  vDebug("vgId:%d, become assigned leader", pVnode->config.vgId);
×
667
#ifdef USE_TQ
668
  if (pVnode->pTq) {
×
669
    tqUpdateNodeStage(pVnode->pTq, true);
×
670
  }
671
#endif
672
}
×
673

674
static bool vnodeApplyQueueEmpty(const SSyncFSM *pFsm) {
×
675
  SVnode *pVnode = pFsm->data;
×
676

677
  if (pVnode != NULL && pVnode->msgCb.qsizeFp != NULL) {
×
678
    int32_t itemSize = tmsgGetQueueSize(&pVnode->msgCb, pVnode->config.vgId, APPLY_QUEUE);
×
679
    return (itemSize == 0);
×
680
  } else {
681
    return true;
×
682
  }
683
}
684

685
static int32_t vnodeApplyQueueItems(const SSyncFSM *pFsm) {
136✔
686
  SVnode *pVnode = pFsm->data;
136✔
687

688
  if (pVnode != NULL && pVnode->msgCb.qsizeFp != NULL) {
136!
689
    int32_t itemSize = tmsgGetQueueSize(&pVnode->msgCb, pVnode->config.vgId, APPLY_QUEUE);
136✔
690
    return itemSize;
136✔
691
  } else {
692
    return TSDB_CODE_INVALID_PARA;
×
693
  }
694
}
695

696
static SSyncFSM *vnodeSyncMakeFsm(SVnode *pVnode) {
72✔
697
  SSyncFSM *pFsm = taosMemoryCalloc(1, sizeof(SSyncFSM));
72!
698
  if (pFsm == NULL) {
72!
699
    terrno = TSDB_CODE_OUT_OF_MEMORY;
×
700
    return NULL;
×
701
  }
702
  pFsm->data = pVnode;
72✔
703
  pFsm->FpCommitCb = vnodeSyncCommitMsg;
72✔
704
  pFsm->FpAppliedIndexCb = vnodeSyncAppliedIndex;
72✔
705
  pFsm->FpPreCommitCb = vnodeSyncPreCommitMsg;
72✔
706
  pFsm->FpRollBackCb = vnodeSyncRollBackMsg;
72✔
707
  pFsm->FpGetSnapshot = NULL;
72✔
708
  pFsm->FpGetSnapshotInfo = vnodeSyncGetSnapshotInfo;
72✔
709
  pFsm->FpRestoreFinishCb = vnodeRestoreFinish;
72✔
710
  pFsm->FpAfterRestoredCb = NULL;
72✔
711
  pFsm->FpLeaderTransferCb = NULL;
72✔
712
  pFsm->FpApplyQueueEmptyCb = vnodeApplyQueueEmpty;
72✔
713
  pFsm->FpApplyQueueItems = vnodeApplyQueueItems;
72✔
714
  pFsm->FpBecomeLeaderCb = vnodeBecomeLeader;
72✔
715
  pFsm->FpBecomeAssignedLeaderCb = vnodeBecomeAssignedLeader;
72✔
716
  pFsm->FpBecomeFollowerCb = vnodeBecomeFollower;
72✔
717
  pFsm->FpBecomeLearnerCb = vnodeBecomeLearner;
72✔
718
  pFsm->FpReConfigCb = NULL;
72✔
719
  pFsm->FpSnapshotStartRead = vnodeSnapshotStartRead;
72✔
720
  pFsm->FpSnapshotStopRead = vnodeSnapshotStopRead;
72✔
721
  pFsm->FpSnapshotDoRead = vnodeSnapshotDoRead;
72✔
722
  pFsm->FpSnapshotStartWrite = vnodeSnapshotStartWrite;
72✔
723
  pFsm->FpSnapshotStopWrite = vnodeSnapshotStopWrite;
72✔
724
  pFsm->FpSnapshotDoWrite = vnodeSnapshotDoWrite;
72✔
725

726
  return pFsm;
72✔
727
}
728

729
int32_t vnodeSyncOpen(SVnode *pVnode, char *path, int32_t vnodeVersion) {
72✔
730
  SSyncInfo syncInfo = {
72✔
731
      .snapshotStrategy = SYNC_STRATEGY_WAL_FIRST,
732
      .batchSize = 1,
733
      .vgId = pVnode->config.vgId,
72✔
734
      .syncCfg = pVnode->config.syncCfg,
735
      .pWal = pVnode->pWal,
72✔
736
      .msgcb = &pVnode->msgCb,
72✔
737
      .syncSendMSg = vnodeSyncSendMsg,
738
      .syncEqMsg = vnodeSyncEqMsg,
739
      .syncEqCtrlMsg = vnodeSyncEqCtrlMsg,
740
      .pingMs = 5000,
741
      .electMs = 4000,
742
      .heartbeatMs = 700,
743
  };
744

745
  snprintf(syncInfo.path, sizeof(syncInfo.path), "%s%ssync", path, TD_DIRSEP);
72✔
746
  syncInfo.pFsm = vnodeSyncMakeFsm(pVnode);
72✔
747

748
  SSyncCfg *pCfg = &syncInfo.syncCfg;
72✔
749
  vInfo("vgId:%d, start to open sync, replica:%d selfIndex:%d", pVnode->config.vgId, pCfg->replicaNum, pCfg->myIndex);
72✔
750
  for (int32_t i = 0; i < pCfg->totalReplicaNum; ++i) {
160✔
751
    SNodeInfo *pNode = &pCfg->nodeInfo[i];
88✔
752
    vInfo("vgId:%d, index:%d ep:%s:%u dnode:%d cluster:%" PRId64, pVnode->config.vgId, i, pNode->nodeFqdn,
88✔
753
          pNode->nodePort, pNode->nodeId, pNode->clusterId);
754
  }
755

756
  pVnode->sync = syncOpen(&syncInfo, vnodeVersion);
72✔
757
  if (pVnode->sync <= 0) {
72!
758
    vError("vgId:%d, failed to open sync since %s", pVnode->config.vgId, terrstr());
×
759
    return terrno;
×
760
  }
761

762
  return 0;
72✔
763
}
764

765
int32_t vnodeSyncStart(SVnode *pVnode) {
72✔
766
  vInfo("vgId:%d, start sync", pVnode->config.vgId);
72✔
767
  int32_t code = syncStart(pVnode->sync);
72✔
768
  if (code) {
72!
769
    vError("vgId:%d, failed to start sync subsystem since %s", pVnode->config.vgId, tstrerror(code));
×
770
    return code;
×
771
  }
772
  return 0;
72✔
773
}
774

775
void vnodeSyncPreClose(SVnode *pVnode) {
72✔
776
  vInfo("vgId:%d, sync pre close", pVnode->config.vgId);
72✔
777
  int32_t code = syncLeaderTransfer(pVnode->sync);
72✔
778
  if (code) {
72✔
779
    vError("vgId:%d, failed to transfer leader since %s", pVnode->config.vgId, tstrerror(code));
4!
780
  }
781
  syncPreStop(pVnode->sync);
72✔
782

783
  (void)taosThreadMutexLock(&pVnode->lock);
72✔
784
  if (pVnode->blocked) {
72!
785
    vInfo("vgId:%d, post block after close sync", pVnode->config.vgId);
×
786
    pVnode->blocked = false;
×
787
    if (tsem_post(&pVnode->syncSem) != 0) {
×
788
      vError("vgId:%d, failed to post block", pVnode->config.vgId);
×
789
    }
790
  }
791
  (void)taosThreadMutexUnlock(&pVnode->lock);
72✔
792
}
72✔
793

794
void vnodeSyncPostClose(SVnode *pVnode) {
72✔
795
  vInfo("vgId:%d, sync post close", pVnode->config.vgId);
72✔
796
  syncPostStop(pVnode->sync);
72✔
797
}
72✔
798

799
void vnodeSyncClose(SVnode *pVnode) {
72✔
800
  vInfo("vgId:%d, close sync", pVnode->config.vgId);
72✔
801
  syncStop(pVnode->sync);
72✔
802
}
72✔
803

804
void vnodeSyncCheckTimeout(SVnode *pVnode) {
18✔
805
  vTrace("vgId:%d, check sync timeout msg", pVnode->config.vgId);
18!
806
  (void)taosThreadMutexLock(&pVnode->lock);
18✔
807
  if (pVnode->blocked) {
18!
808
    int32_t curSec = taosGetTimestampSec();
×
809
    int32_t delta = curSec - pVnode->blockSec;
×
810
    if (delta > VNODE_TIMEOUT_SEC) {
×
811
      vError("vgId:%d, failed to propose since timeout and post block, start:%d cur:%d delta:%d seq:%" PRId64,
×
812
             pVnode->config.vgId, pVnode->blockSec, curSec, delta, pVnode->blockSeq);
813
      if (syncSendTimeoutRsp(pVnode->sync, pVnode->blockSeq) != 0) {
×
814
#if 0
815
        SRpcMsg rpcMsg = {.code = TSDB_CODE_SYN_TIMEOUT, .info = pVnode->blockInfo};
816
        vError("send timeout response since its applyed, seq:%" PRId64 " handle:%p ahandle:%p", pVnode->blockSeq,
817
              rpcMsg.info.handle, rpcMsg.info.ahandle);
818
        rpcSendResponse(&rpcMsg);
819
#endif
820
      }
821
      pVnode->blocked = false;
×
822
      pVnode->blockSec = 0;
×
823
      pVnode->blockSeq = 0;
×
824
      if (tsem_post(&pVnode->syncSem) != 0) {
×
825
        vError("vgId:%d, failed to post block", pVnode->config.vgId);
×
826
      }
827
    }
828
  }
829
  (void)taosThreadMutexUnlock(&pVnode->lock);
18✔
830
}
18✔
831

832
bool vnodeIsRoleLeader(SVnode *pVnode) {
732✔
833
  SSyncState state = syncGetState(pVnode->sync);
732✔
834
  return state.state == TAOS_SYNC_STATE_LEADER;
734✔
835
}
836

837
bool vnodeIsLeader(SVnode *pVnode) {
106✔
838
  terrno = 0;
106✔
839
  SSyncState state = syncGetState(pVnode->sync);
106✔
840

841
  if (terrno != 0) {
106✔
842
    vInfo("vgId:%d, vnode is stopping", pVnode->config.vgId);
8!
843
    return false;
8✔
844
  }
845

846
  if (state.state != TAOS_SYNC_STATE_LEADER) {
98!
847
    terrno = TSDB_CODE_SYN_NOT_LEADER;
×
848
    vInfo("vgId:%d, vnode not leader, state:%s", pVnode->config.vgId, syncStr(state.state));
×
849
    return false;
×
850
  }
851

852
  if (!state.restored || !pVnode->restored) {
98!
853
    terrno = TSDB_CODE_SYN_RESTORING;
×
854
    vInfo("vgId:%d, vnode not restored:%d:%d", pVnode->config.vgId, state.restored, pVnode->restored);
×
855
    return false;
×
856
  }
857

858
  return true;
98✔
859
}
860

861
int64_t vnodeClusterId(SVnode *pVnode) {
×
862
  SSyncCfg *syncCfg = &pVnode->config.syncCfg;
×
863
  return syncCfg->nodeInfo[syncCfg->myIndex].clusterId;
×
864
}
865

866
int32_t vnodeNodeId(SVnode *pVnode) {
476✔
867
  SSyncCfg *syncCfg = &pVnode->config.syncCfg;
476✔
868
  return syncCfg->nodeInfo[syncCfg->myIndex].nodeId;
476✔
869
}
870

871
int32_t vnodeGetSnapshot(SVnode *pVnode, SSnapshot *pSnap) {
1,720✔
872
  int code = 0;
1,720✔
873
  pSnap->lastApplyIndex = pVnode->state.committed;
1,720✔
874
  pSnap->lastApplyTerm = pVnode->state.commitTerm;
1,720✔
875
  pSnap->lastConfigIndex = -1;
1,720✔
876
  pSnap->state = SYNC_FSM_STATE_COMPLETE;
1,720✔
877

878
  if (tsdbSnapGetFsState(pVnode) != TSDB_FS_STATE_NORMAL) {
1,720!
879
    pSnap->state = SYNC_FSM_STATE_INCOMPLETE;
×
880
  }
881

882
  if (pSnap->type == TDMT_SYNC_PREP_SNAPSHOT || pSnap->type == TDMT_SYNC_PREP_SNAPSHOT_REPLY) {
1,720✔
883
    code = tsdbSnapPrepDescription(pVnode, pSnap);
8✔
884
  }
885
  return code;
1,720✔
886
}
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