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

taosdata / TDengine / #3819

01 Apr 2025 09:27AM UTC coverage: 34.076% (+0.01%) from 34.065%
#3819

push

travis-ci

happyguoxy
test:alter gcda dir

148544 of 599532 branches covered (24.78%)

Branch coverage included in aggregate %.

222541 of 489451 relevant lines covered (45.47%)

763329.1 hits per line

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

57.36
/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; }
69,798✔
26

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

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

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

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

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

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

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

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

82
static void inline vnodeHandleWriteMsg(SVnode *pVnode, SRpcMsg *pMsg) {
36,695✔
83
  SRpcMsg rsp = {.code = pMsg->code, .info = pMsg->info};
36,695✔
84
  if (vnodeProcessWriteMsg(pVnode, pMsg, pMsg->info.conn.applyIndex, &rsp) < 0) {
36,695!
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) {
36,697✔
90
    tmsgSendRsp(&rsp);
36,428✔
91
  } else {
92
    if (rsp.pCont) {
269✔
93
      rpcFreeCont(rsp.pCont);
155✔
94
    }
95
  }
96
}
36,695✔
97

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

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

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

132
  if (code > 0) {
68,518✔
133
    vnodeHandleWriteMsg(pVnode, pMsg);
36,697✔
134
  } else if (code < 0) {
31,821✔
135
    if (terrno != 0) code = terrno;
14!
136
    vnodeHandleProposeError(pVnode, pMsg, code);
14✔
137
  }
138

139
  if (wait) vnodeWaitBlockMsg(pVnode, pMsg);
68,515✔
140
  return code;
68,515✔
141
}
142

143
void vnodeProposeCommitOnNeed(SVnode *pVnode, bool atExit) {
69,254✔
144
  if (!vnodeShouldCommit(pVnode, atExit)) {
69,254✔
145
    return;
69,082✔
146
  }
147

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

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

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

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

176
#if BATCH_ENABLE
177

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

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

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

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

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

211
  *arrSize = 0;
212
}
213

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

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

229
    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,
230
            isWeak, isBlock, msg, numOfMsgs, arrayPos, pMsg->info.handle);
231

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

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

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

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

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

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

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

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

279
#else
280

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

288
  for (int32_t msg = 0; msg < numOfMsgs; msg++) {
138,667✔
289
    if (taosGetQitem(qall, (void **)&pMsg) == 0) continue;
69,799!
290
    bool isWeak = vnodeIsMsgWeak(pMsg->msgType);
69,797✔
291

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

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

304
    bool atExit = false;
69,027✔
305
    vnodeProposeCommitOnNeed(pVnode, atExit);
69,027✔
306

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

318
    code = vnodeProposeMsg(pVnode, pMsg, isWeak);
68,511✔
319

320
    vGTrace(&pMsg->info.traceId, "vgId:%d, msg:%p, is freed, code:0x%x", vgId, pMsg, code);
68,510!
321
    rpcFreeCont(pMsg->pCont);
68,510✔
322
    taosFreeQitem(pMsg);
68,515✔
323
  }
324
}
68,868✔
325

326
#endif
327

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

334
  for (int32_t i = 0; i < numOfMsgs; ++i) {
193,776✔
335
    if (taosGetQitem(qall, (void **)&pMsg) == 0) continue;
98,176!
336

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

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

356
    vnodePostBlockMsg(pVnode, pMsg);
98,166✔
357
    if (rsp.info.handle != NULL) {
98,165✔
358
      tmsgSendRsp(&rsp);
31,803✔
359
    } else {
360
      if (rsp.pCont) {
66,362✔
361
        rpcFreeCont(rsp.pCont);
64,272✔
362
      }
363
    }
364

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

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

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

381
  return code;
171,660✔
382
}
383

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

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

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

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

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

414
  int32_t code = tmsgPutToQueue(msgcb, SYNC_QUEUE, pMsg);
37,200✔
415
  if (code != 0) {
37,199✔
416
    rpcFreeCont(pMsg->pCont);
32✔
417
    pMsg->pCont = NULL;
33✔
418
  }
419
  return code;
37,200✔
420
}
421

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

524
  return vnodeSnapWriterOpen(pVnode, (SSnapshotParam *)pParam, (SVSnapWriter **)ppWriter);
×
525
}
526

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

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

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

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

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

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

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

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

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

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

610
  streamMetaWUnLock(pMeta);
63✔
611
#endif
612
}
613

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

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

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

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

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

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

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

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

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

684
static int32_t vnodeApplyQueueItems(const SSyncFSM *pFsm) {
1,228✔
685
  SVnode *pVnode = pFsm->data;
1,228✔
686

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

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

725
  return pFsm;
277✔
726
}
727

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

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

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

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

761
  return 0;
277✔
762
}
763

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

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

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

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

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

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

831
bool vnodeIsRoleLeader(SVnode *pVnode) {
1,106✔
832
  SSyncState state = syncGetState(pVnode->sync);
1,106✔
833
  return state.state == TAOS_SYNC_STATE_LEADER;
1,106✔
834
}
835

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

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

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

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

857
  return true;
279✔
858
}
859

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

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

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

877
  if (tsdbSnapGetFsState(pVnode) != TSDB_FS_STATE_NORMAL) {
7,606!
878
    pSnap->state = SYNC_FSM_STATE_INCOMPLETE;
×
879
  }
880

881
  if (pSnap->type == TDMT_SYNC_PREP_SNAPSHOT || pSnap->type == TDMT_SYNC_PREP_SNAPSHOT_REPLY) {
7,605!
882
    code = tsdbSnapPrepDescription(pVnode, pSnap);
×
883
  }
884
  return code;
7,605✔
885
}
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