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

taosdata / TDengine / #4271

10 Jun 2025 09:45AM UTC coverage: 62.985% (+0.002%) from 62.983%
#4271

push

travis-ci

web-flow
Merge pull request #31337 from taosdata/newtest_3.0

fix TD-35057 and TD-35346

158179 of 319671 branches covered (49.48%)

Branch coverage included in aggregate %.

243860 of 318637 relevant lines covered (76.53%)

18624660.26 hits per line

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

64.39
/source/libs/sync/src/syncUtil.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 "syncUtil.h"
18
#include "syncIndexMgr.h"
19
#include "syncMessage.h"
20
#include "syncPipeline.h"
21
#include "syncRaftCfg.h"
22
#include "syncRaftStore.h"
23
#include "syncSnapshot.h"
24
#include "tglobal.h"
25
#include "ttime.h"
26

27
#define FQDNRETRYTIMES 100
28

29
static void syncCfg2SimpleStr(const SSyncCfg* pCfg, char* buf, int32_t bufLen) {
205,180✔
30
  int32_t len = tsnprintf(buf, bufLen, "{num:%d, as:%d, [", pCfg->replicaNum, pCfg->myIndex);
205,180✔
31
  for (int32_t i = 0; i < pCfg->replicaNum; ++i) {
530,484✔
32
    len += tsnprintf(buf + len, bufLen - len, "%s:%d", pCfg->nodeInfo[i].nodeFqdn, pCfg->nodeInfo[i].nodePort);
325,306✔
33
    if (i < pCfg->replicaNum - 1) {
325,316✔
34
      len += tsnprintf(buf + len, bufLen - len, "%s", ", ");
120,141✔
35
    }
36
  }
37
  len += tsnprintf(buf + len, bufLen - len, "%s", "]}");
205,178✔
38
}
205,190✔
39

40
void syncUtilNodeInfo2EpSet(const SNodeInfo* pInfo, SEpSet* pEpSet) {
8,383✔
41
  pEpSet->inUse = 0;
8,383✔
42
  pEpSet->numOfEps = 1;
8,383✔
43
  pEpSet->eps[0].port = pInfo->nodePort;
8,383✔
44
  tstrncpy(pEpSet->eps[0].fqdn, pInfo->nodeFqdn, TSDB_FQDN_LEN);
8,383✔
45
}
8,383✔
46

47
bool syncUtilNodeInfo2RaftId(const SNodeInfo* pInfo, SyncGroupId vgId, SRaftId* raftId) {
26,544✔
48
  SIpAddr addr = {0};
26,544✔
49
  sDebug("vgId:%d, resolve sync addr from fqdn, ep:%s:%u", vgId, pInfo->nodeFqdn, pInfo->nodePort);
26,544✔
50

51
  int32_t code = 0;
26,551✔
52
  for (int32_t i = 0; i < FQDNRETRYTIMES; i++) {
26,551✔
53
    code = taosGetIpFromFqdn(tsEnableIpv6, pInfo->nodeFqdn, &addr);
26,550✔
54
    if (code) {
26,550!
55
      sError("vgId:%d, failed to resolve sync addr, dnode:%d fqdn:%s, retry", vgId, pInfo->nodeId, pInfo->nodeFqdn);
×
56
      taosSsleep(1);
×
57
    } else {
58
      break;
26,550✔
59
    }
60
  }
61

62
  if (code != 0) {
26,551!
63
    sError("vgId:%d, failed to resolve sync addr, dnode:%d fqdn:%s", vgId, pInfo->nodeId, pInfo->nodeFqdn);
×
64
    terrno = TSDB_CODE_TSC_INVALID_FQDN;
×
65
    return false;
×
66
  }
67

68
  raftId->addr = SYNC_ADDR(pInfo);
26,551✔
69
  raftId->vgId = vgId;
26,551✔
70

71
  sInfo("vgId:%d, sync addr:0x%" PRIx64 " is resolved, ep:%s:%u ip:%s dnode:%d cluster:%" PRId64, vgId, raftId->addr,
26,551✔
72
        pInfo->nodeFqdn, pInfo->nodePort, IP_ADDR_STR(&addr), pInfo->nodeId, pInfo->clusterId);
73
  return true;
26,551✔
74
}
75

76
bool syncUtilSameId(const SRaftId* pId1, const SRaftId* pId2) {
50,928,293✔
77
  if (pId1->addr == pId2->addr && pId1->vgId == pId2->vgId) {
50,928,293!
78
    return true;
31,944,805✔
79
  }
80

81
  if ((CID(pId1) == 0 || CID(pId2) == 0) && (DID(pId1) == DID(pId2)) && pId1->vgId == pId2->vgId) {
18,983,488!
82
    return true;
212✔
83
  }
84

85
  return false;
18,983,276✔
86
}
87

88
bool syncUtilEmptyId(const SRaftId* pId) { return (pId->addr == 0 && pId->vgId == 0); }
3,994!
89

90
static inline int32_t syncUtilRand(int32_t max) { return taosRand() % max; }
612,166✔
91

92
int32_t syncUtilElectRandomMS(int32_t min, int32_t max) {
612,165✔
93
  int32_t rdm = min + syncUtilRand(max - min);
612,165✔
94

95
  // sDebug("random min:%d, max:%d, rdm:%d", min, max, rdm);
96
  return rdm;
612,167✔
97
}
98

99
int32_t syncUtilQuorum(int32_t replicaNum) { return replicaNum / 2 + 1; }
17,309✔
100

101
void syncUtilMsgHtoN(void* msg) {
5,849,076✔
102
  SMsgHead* pHead = msg;
5,849,076✔
103
  pHead->contLen = htonl(pHead->contLen);
5,849,076✔
104
  pHead->vgId = htonl(pHead->vgId);
5,849,076✔
105
}
5,849,076✔
106

107
void syncUtilGenerateArbToken(int32_t nodeId, int32_t groupId, char* buf) {
16,982✔
108
  (void)memset(buf, 0, TSDB_ARB_TOKEN_SIZE);
16,982✔
109
  int32_t randVal = taosSafeRand() % 1000;
16,982✔
110
  int64_t currentMs = taosGetTimestampMs();
16,982✔
111
  (void)snprintf(buf, TSDB_ARB_TOKEN_SIZE, "d%d#g%d#%" PRId64 "#%d", nodeId, groupId, currentMs, randVal);
16,982✔
112
}
16,982✔
113

114
static void syncPrintTime(bool formatTime, int32_t* len, int64_t tsMs, int32_t i, char* buf, int32_t bufLen) {
583,123✔
115
  if (formatTime) {
583,123!
116
    char pBuf[TD_TIME_STR_LEN] = {0};
583,124✔
117
    if (tsMs > 0) {
583,124✔
118
      if (formatTimestampLocal(pBuf, tsMs, TSDB_TIME_PRECISION_MILLI) == NULL) {
404,909!
119
        pBuf[0] = '\0';
×
120
      }
121
    }
122
    (*len) += tsnprintf(buf + (*len), bufLen - (*len), "%d:%s", i, pBuf);
583,124✔
123
  } else {
124
    (*len) += tsnprintf(buf + (*len), bufLen - (*len), "%d:%" PRId64, i, tsMs);
×
125
  }
126
}
583,133✔
127

128
// for leader
129
static void syncHearbeatReplyTime2Str(SSyncNode* pSyncNode, char* buf, int32_t bufLen, bool formatTime) {
117,881✔
130
  int32_t len = 0;
117,881✔
131
  len += tsnprintf(buf + len, bufLen - len, "%s", "{");
117,881✔
132
  for (int32_t i = 0; i < pSyncNode->replicaNum; ++i) {
312,266✔
133
    int64_t tsMs = syncIndexMgrGetRecvTime(pSyncNode->pMatchIndex, &(pSyncNode->replicasId[i]));
194,383✔
134
    syncPrintTime(formatTime, &len, tsMs, i, buf, bufLen);
194,384✔
135
    if (i < pSyncNode->replicaNum - 1) {
194,372✔
136
      len += tsnprintf(buf + len, bufLen - len, "%s", ",");
76,499✔
137
    }
138
  }
139
  len += tsnprintf(buf + len, bufLen - len, "%s", "}");
117,883✔
140
}
117,889✔
141

142
static void syncSentHearbeatTime2Str(SSyncNode* pSyncNode, char* buf, int32_t bufLen, bool formatTime) {
117,889✔
143
  int32_t len = 0;
117,889✔
144
  len += tsnprintf(buf + len, bufLen - len, "%s", "{");
117,889✔
145
  for (int32_t i = 0; i < pSyncNode->replicaNum; ++i) {
312,279✔
146
    int64_t tsMs = syncIndexMgrGetSentTime(pSyncNode->pMatchIndex, &(pSyncNode->replicasId[i]));
194,392✔
147
    syncPrintTime(formatTime, &len, tsMs, i, buf, bufLen);
194,392✔
148
    if (i < pSyncNode->replicaNum - 1) {
194,388✔
149
      len += tsnprintf(buf + len, bufLen - len, "%s", ",");
76,503✔
150
    }
151
  }
152
  len += tsnprintf(buf + len, bufLen - len, "%s", "}");
117,887✔
153
}
117,888✔
154

155
// for follower
156
static void syncHearbeatTime2Str(SSyncNode* pSyncNode, char* buf, int32_t bufLen, bool formatTime) {
117,864✔
157
  int32_t len = 0;
117,864✔
158
  len += tsnprintf(buf + len, bufLen - len, "%s", "{");
117,864✔
159
  for (int32_t i = 0; i < pSyncNode->replicaNum; ++i) {
312,278✔
160
    int64_t tsMs = syncIndexMgrGetRecvTime(pSyncNode->pNextIndex, &(pSyncNode->replicasId[i]));
194,370✔
161
    syncPrintTime(formatTime, &len, tsMs, i, buf, bufLen);
194,392✔
162
    if (i < pSyncNode->replicaNum - 1) {
194,392✔
163
      len += tsnprintf(buf + len, bufLen - len, "%s", ",");
76,502✔
164
    }
165
  }
166
  len += tsnprintf(buf + len, bufLen - len, "%s", "}");
117,908✔
167
}
117,891✔
168

169
static void syncLogBufferStates2Str(SSyncNode* pSyncNode, char* buf, int32_t bufLen) {
117,884✔
170
  SSyncLogBuffer* pBuf = pSyncNode->pLogBuf;
117,884✔
171
  if (pBuf == NULL) {
117,884!
172
    return;
×
173
  }
174
  int32_t len = 0;
117,884✔
175
  len += tsnprintf(buf + len, bufLen - len, "[%" PRId64 " %" PRId64 " %" PRId64 ", %" PRId64 ")", pBuf->startIndex,
117,884✔
176
                   pBuf->commitIndex, pBuf->matchIndex, pBuf->endIndex);
177
}
178

179
static void syncLogReplStates2Str(SSyncNode* pSyncNode, char* buf, int32_t bufLen) {
117,886✔
180
  int32_t len = 0;
117,886✔
181
  len += tsnprintf(buf + len, bufLen - len, "%s", "{");
117,886✔
182
  for (int32_t i = 0; i < pSyncNode->replicaNum; i++) {
312,281✔
183
    SSyncLogReplMgr* pMgr = pSyncNode->logReplMgrs[i];
194,391✔
184
    if (pMgr == NULL) break;
194,391!
185
    len += tsnprintf(buf + len, bufLen - len, "%d:%d [%" PRId64 ", %" PRId64 ", %" PRId64 "] ", i, pMgr->restored,
194,391✔
186
                     pMgr->startIndex, pMgr->matchIndex, pMgr->endIndex);
187
    len += tsnprintf(buf + len, bufLen - len, "%" PRId64, pMgr->sendCount);
194,391✔
188
    if (i + 1 < pSyncNode->replicaNum) {
194,391✔
189
      len += tsnprintf(buf + len, bufLen - len, "%s", ", ");
76,502✔
190
    }
191
  }
192
  len += tsnprintf(buf + len, bufLen - len, "%s", "}");
117,890✔
193
}
117,891✔
194

195
static void syncPeerState2Str(SSyncNode* pSyncNode, char* buf, int32_t bufLen) {
87,298✔
196
  int32_t len = 0;
87,298✔
197
  len += tsnprintf(buf + len, bufLen - len, "%s", "{");
87,298✔
198
  for (int32_t i = 0; i < pSyncNode->replicaNum; ++i) {
218,074✔
199
    SPeerState* pState = syncNodeGetPeerState(pSyncNode, &(pSyncNode->replicasId[i]));
130,781✔
200
    if (pState == NULL) break;
130,770!
201
    len += tsnprintf(buf + len, bufLen - len, "%d:%" PRId64 " %" PRId64 "%s", i, pState->lastSendIndex,
130,770✔
202
                     pState->lastSendTime, (i < pSyncNode->replicaNum - 1) ? ", " : "");
130,770✔
203
  }
204
  len += tsnprintf(buf + len, bufLen - len, "%s", "}");
87,293✔
205
}
87,295✔
206

207
void syncPrintNodeLog(const char* flags, ELogLevel level, int32_t dflag, bool formatTime, SSyncNode* pNode,
113,136✔
208
                      const char* format, ...) {
209
  if (pNode == NULL || pNode->pLogStore == NULL) return;
113,136!
210
  int64_t currentTerm = raftStoreGetTerm(pNode);
113,138✔
211

212
  // save error code, otherwise it will be overwritten
213
  int32_t errCode = terrno;
113,136✔
214

215
  SSnapshot snapshot = {.data = NULL, .lastApplyIndex = -1, .lastApplyTerm = 0};
113,134✔
216
  if (pNode->pFsm != NULL && pNode->pFsm->FpGetSnapshotInfo != NULL) {
113,134!
217
    (void)pNode->pFsm->FpGetSnapshotInfo(pNode->pFsm, &snapshot);  // vnodeSyncGetSnapshotInfo
113,138✔
218
  }
219

220
  SyncIndex logLastIndex = SYNC_INDEX_INVALID;
113,133✔
221
  SyncIndex logBeginIndex = SYNC_INDEX_INVALID;
113,133✔
222
  if (pNode->pLogStore != NULL) {
113,133!
223
    logLastIndex = pNode->pLogStore->syncLogLastIndex(pNode->pLogStore);
113,137✔
224
    logBeginIndex = pNode->pLogStore->syncLogBeginIndex(pNode->pLogStore);
113,135✔
225
  }
226

227
  int32_t cacheHit = pNode->pLogStore->cacheHit;
113,130✔
228
  int32_t cacheMiss = pNode->pLogStore->cacheMiss;
113,130✔
229

230
  char cfgStr[1024] = "";
113,130✔
231
  syncCfg2SimpleStr(&pNode->raftCfg.cfg, cfgStr, sizeof(cfgStr));
113,130✔
232

233
  char replMgrStatesStr[1024] = "";
113,138✔
234
  syncLogReplStates2Str(pNode, replMgrStatesStr, sizeof(replMgrStatesStr));
113,138✔
235

236
  char bufferStatesStr[256] = "";
113,137✔
237
  syncLogBufferStates2Str(pNode, bufferStatesStr, sizeof(bufferStatesStr));
113,137✔
238

239
  char hbrTimeStr[256] = "";
113,133✔
240
  syncHearbeatReplyTime2Str(pNode, hbrTimeStr, sizeof(hbrTimeStr), formatTime);
113,133✔
241

242
  char hbTimeStr[256] = "";
113,131✔
243
  syncHearbeatTime2Str(pNode, hbTimeStr, sizeof(hbTimeStr), formatTime);
113,131✔
244

245
  char sentHbTimeStr[512] = "";
113,137✔
246
  syncSentHearbeatTime2Str(pNode, sentHbTimeStr, sizeof(sentHbTimeStr), formatTime);
113,137✔
247

248
  char    eventLog[512];  // {0};
249
  va_list argpointer;
250
  va_start(argpointer, format);
113,134✔
251
  int32_t writeLen = vsnprintf(eventLog, sizeof(eventLog), format, argpointer);
113,134✔
252
  va_end(argpointer);
113,134✔
253

254
  int32_t aqItems = 0;
113,134✔
255
  if (pNode != NULL && pNode->pFsm != NULL && pNode->pFsm->FpApplyQueueItems != NULL) {
113,134!
256
    aqItems = pNode->pFsm->FpApplyQueueItems(pNode->pFsm);  // vnodeApplyQueueItems
113,134✔
257
  }
258

259
  // restore error code
260
  terrno = errCode;
113,135✔
261
  SyncIndex appliedIndex = pNode->pFsm->FpAppliedIndexCb(pNode->pFsm);  // vnodeSyncAppliedIndex
113,136✔
262

263
  if (pNode != NULL) {
113,130!
264
    taosPrintLog(
113,121✔
265
        flags, level, dflag,
266
        "vgId:%d, %s, sync:%s, term:%" PRIu64 ", commit-index:%" PRId64 ", assigned-index:%" PRId64
267
        ", applied-index:%" PRId64 ", first-ver:%" PRId64 ", last-ver:%" PRId64 ", min:%" PRId64 ", snap:%" PRId64
268
        ", snap-term:%" PRIu64
269
        ", elect-times:%d, as-leader-times:%d, as-assigned-leader-times:%d, cfg-ch-times:%d, hb-slow:%d, hbr-slow:%d, "
270
        "aq-items:%d, snaping:%" PRId64 ", replicas:%d, last-cfg:%" PRId64
271
        ", chging:%d, restore:%d, quorum:%d, elect-lc-timer:%" PRId64 ", hb:%" PRId64
272
        ", buffer:%s, repl-mgrs:%s, members:%s, send hb:%s, recv hb:%s, recv hb-reply:%s, arb-token:%s, "
273
        "msg[sent:%" PRId64 ", recv:%" PRId64 ", slow-recv:%" PRId64 "]",
274
        pNode->vgId, eventLog, syncStr(pNode->state), currentTerm, pNode->commitIndex, pNode->assignedCommitIndex,
275
        appliedIndex, logBeginIndex, logLastIndex, pNode->minMatchIndex, snapshot.lastApplyIndex,
276
        snapshot.lastApplyTerm, pNode->electNum, pNode->becomeLeaderNum, pNode->becomeAssignedLeaderNum,
277
        pNode->configChangeNum, pNode->hbSlowNum, pNode->hbrSlowNum, aqItems, pNode->snapshottingIndex,
278
        pNode->replicaNum, pNode->raftCfg.lastConfigIndex, pNode->changing, pNode->restoreFinish,
113,120✔
279
        syncNodeDynamicQuorum(pNode), pNode->electTimerLogicClock, pNode->heartbeatTimerLogicClockUser, bufferStatesStr,
280
        replMgrStatesStr, cfgStr, sentHbTimeStr, hbTimeStr, hbrTimeStr, pNode->arbToken, pNode->sendCount,
113,131✔
281
        pNode->recvCount, pNode->slowCount);
282
  }
283
}
284

285
void syncPrintHbLog(const char* flags, ELogLevel level, int32_t dflag, bool formatTime, SSyncNode* pNode,
4,754✔
286
                    const char* format, ...) {
287
  if (pNode == NULL || pNode->pLogStore == NULL) return;
4,754!
288
  int64_t currentTerm = raftStoreTryGetTerm(pNode);
4,754✔
289

290
  // save error code, otherwise it will be overwritten
291
  int32_t errCode = terrno;
4,754✔
292

293
  int32_t cacheHit = pNode->pLogStore->cacheHit;
4,754✔
294
  int32_t cacheMiss = pNode->pLogStore->cacheMiss;
4,754✔
295

296
  char cfgStr[1024] = "";
4,754✔
297
  syncCfg2SimpleStr(&pNode->raftCfg.cfg, cfgStr, sizeof(cfgStr));
4,754✔
298

299
  char replMgrStatesStr[1024] = "";
4,754✔
300
  syncLogReplStates2Str(pNode, replMgrStatesStr, sizeof(replMgrStatesStr));
4,754✔
301

302
  char bufferStatesStr[256] = "";
4,754✔
303
  syncLogBufferStates2Str(pNode, bufferStatesStr, sizeof(bufferStatesStr));
4,754✔
304

305
  char hbrTimeStr[256] = "";
4,754✔
306
  syncHearbeatReplyTime2Str(pNode, hbrTimeStr, sizeof(hbrTimeStr), formatTime);
4,754✔
307

308
  char hbTimeStr[256] = "";
4,754✔
309
  syncHearbeatTime2Str(pNode, hbTimeStr, sizeof(hbTimeStr), formatTime);
4,754✔
310

311
  char sentHbTimeStr[512] = "";
4,754✔
312
  syncSentHearbeatTime2Str(pNode, sentHbTimeStr, sizeof(sentHbTimeStr), formatTime);
4,754✔
313

314
  char    eventLog[512];  // {0};
315
  va_list argpointer;
316
  va_start(argpointer, format);
4,754✔
317
  int32_t writeLen = vsnprintf(eventLog, sizeof(eventLog), format, argpointer);
4,754✔
318
  va_end(argpointer);
4,754✔
319

320
  terrno = errCode;
4,754✔
321

322
  if (pNode != NULL) {
4,754!
323
    taosPrintLog(
4,754✔
324
        flags, level, dflag,
325
        "vgId:%d, %s, sync:%s, term:%" PRIu64 ", commit-index:%" PRId64 ", assigned-index:%" PRId64 ", min:%" PRId64
326
        ", elect-times:%d, as-leader-times:%d, as-assigned-leader-times:%d, cfg-ch-times:%d, hb-slow:%d, hbr-slow:%d, "
327
        ", snaping:%" PRId64 ", replicas:%d, last-cfg:%" PRId64
328
        ", chging:%d, restore:%d, quorum:%d, elect-lc-timer:%" PRId64 ", hb:%" PRId64
329
        ", buffer:%s, repl-mgrs:%s, members:%s, send hb:%s, recv hb:%s, recv hb-reply:%s, arb-token:%s, "
330
        "msg[sent:%" PRId64 ", recv:%" PRId64 ", slow-recv:%" PRId64 "]",
331
        pNode->vgId, eventLog, syncStr(pNode->state), currentTerm, pNode->commitIndex, pNode->assignedCommitIndex,
332
        pNode->minMatchIndex, pNode->electNum, pNode->becomeLeaderNum, pNode->becomeAssignedLeaderNum,
333
        pNode->configChangeNum, pNode->hbSlowNum, pNode->hbrSlowNum, pNode->snapshottingIndex, pNode->replicaNum,
334
        pNode->raftCfg.lastConfigIndex, pNode->changing, pNode->restoreFinish, syncNodeDynamicQuorum(pNode),
4,754✔
335
        pNode->electTimerLogicClock, pNode->heartbeatTimerLogicClockUser, bufferStatesStr, replMgrStatesStr, cfgStr,
336
        sentHbTimeStr, hbTimeStr, hbrTimeStr, pNode->arbToken, pNode->sendCount, pNode->recvCount, pNode->slowCount);
4,754✔
337
  }
338
}
339

340
void syncPrintSnapshotSenderLog(const char* flags, ELogLevel level, int32_t dflag, SSyncSnapshotSender* pSender,
81,487✔
341
                                const char* format, ...) {
342
  SSyncNode* pNode = pSender->pSyncNode;
81,487✔
343
  if (pNode == NULL || pNode->pLogStore == NULL) return;
81,487!
344

345
  SSnapshot snapshot = {.data = NULL, .lastApplyIndex = -1, .lastApplyTerm = 0};
81,488✔
346
  if (pNode->pFsm != NULL && pNode->pFsm->FpGetSnapshotInfo != NULL) {
81,488!
347
    (void)pNode->pFsm->FpGetSnapshotInfo(pNode->pFsm, &snapshot);
81,486✔
348
  }
349

350
  SyncIndex logLastIndex = SYNC_INDEX_INVALID;
81,507✔
351
  SyncIndex logBeginIndex = SYNC_INDEX_INVALID;
81,507✔
352
  if (pNode->pLogStore != NULL) {
81,507✔
353
    logLastIndex = pNode->pLogStore->syncLogLastIndex(pNode->pLogStore);
81,504✔
354
    logBeginIndex = pNode->pLogStore->syncLogBeginIndex(pNode->pLogStore);
81,505✔
355
  }
356

357
  char cfgStr[1024] = "";
81,507✔
358
  syncCfg2SimpleStr(&pNode->raftCfg.cfg, cfgStr, sizeof(cfgStr));
81,507✔
359

360
  char peerStr[1024] = "";
81,509✔
361
  syncPeerState2Str(pNode, peerStr, sizeof(peerStr));
81,509✔
362

363
  char    eventLog[512];  // {0};
364
  va_list argpointer;
365
  va_start(argpointer, format);
81,505✔
366
  int32_t writeLen = vsnprintf(eventLog, sizeof(eventLog), format, argpointer);
81,505✔
367
  va_end(argpointer);
81,505✔
368

369
  taosPrintLog(flags, level, dflag,
81,509✔
370
               "vgId:%d, %s, sync:%s, snap-sender:%p signature:(%" PRId64 ", %" PRId64 "), {start:%" PRId64
371
               " end:%" PRId64 " last-index:%" PRId64 " last-term:%" PRId64 " last-cfg:%" PRId64
372
               ", seq:%d, ack:%d, "
373
               " buf:[%" PRId64 " %" PRId64 ", %" PRId64
374
               "], finish:%d, as:%d, to-dnode:%d}"
375
               ", term:%" PRIu64 ", commit-index:%" PRId64 ", firstver:%" PRId64 ", lastver:%" PRId64
376
               ", min-match:%" PRId64 ", snap:{last-index:%" PRId64 ", term:%" PRIu64
377
               "}, standby:%d, batch-sz:%d, replicas:%d, last-cfg:%" PRId64
378
               ", chging:%d, restore:%d, quorum:%d, peer:%s, cfg:%s",
379
               pNode->vgId, eventLog, syncStr(pNode->state), pSender, pSender->term, pSender->startTime,
380
               pSender->snapshotParam.start, pSender->snapshotParam.end, pSender->snapshot.lastApplyIndex,
381
               pSender->snapshot.lastApplyTerm, pSender->snapshot.lastConfigIndex, pSender->seq, pSender->ack,
382
               pSender->pSndBuf->start, pSender->pSndBuf->cursor, pSender->pSndBuf->end, pSender->finish,
81,509✔
383
               pSender->replicaIndex, DID(&pNode->replicasId[pSender->replicaIndex]), raftStoreGetTerm(pNode),
81,509✔
384
               pNode->commitIndex, logBeginIndex, logLastIndex, pNode->minMatchIndex, snapshot.lastApplyIndex,
385
               snapshot.lastApplyTerm, pNode->raftCfg.isStandBy, pNode->raftCfg.batchSize, pNode->replicaNum,
81,505✔
386
               pNode->raftCfg.lastConfigIndex, pNode->changing, pNode->restoreFinish, pNode->quorum, peerStr, cfgStr);
81,505✔
387
}
388

389
void syncPrintSnapshotReceiverLog(const char* flags, ELogLevel level, int32_t dflag, SSyncSnapshotReceiver* pReceiver,
5,790✔
390
                                  const char* format, ...) {
391
  SSyncNode* pNode = pReceiver->pSyncNode;
5,790✔
392
  if (pNode == NULL || pNode->pLogStore == NULL) return;
5,790!
393

394
  SSnapshot snapshot = {.data = NULL, .lastApplyIndex = -1, .lastApplyTerm = 0};
5,790✔
395
  if (pNode->pFsm != NULL && pNode->pFsm->FpGetSnapshotInfo != NULL) {
5,790!
396
    (void)pNode->pFsm->FpGetSnapshotInfo(pNode->pFsm, &snapshot);
5,790✔
397
  }
398

399
  SyncIndex logLastIndex = SYNC_INDEX_INVALID;
5,790✔
400
  SyncIndex logBeginIndex = SYNC_INDEX_INVALID;
5,790✔
401
  if (pNode->pLogStore != NULL) {
5,790!
402
    logLastIndex = pNode->pLogStore->syncLogLastIndex(pNode->pLogStore);
5,790✔
403
    logBeginIndex = pNode->pLogStore->syncLogBeginIndex(pNode->pLogStore);
5,790✔
404
  }
405

406
  char cfgStr[1024] = "";
5,790✔
407
  syncCfg2SimpleStr(&pNode->raftCfg.cfg, cfgStr, sizeof(cfgStr));
5,790✔
408

409
  char peerStr[1024] = "";
5,790✔
410
  syncPeerState2Str(pNode, peerStr, sizeof(peerStr));
5,790✔
411

412
  char    eventLog[512];  // {0};
413
  va_list argpointer;
414
  va_start(argpointer, format);
5,790✔
415
  int32_t writeLen = vsnprintf(eventLog, sizeof(eventLog), format, argpointer);
5,790✔
416
  va_end(argpointer);
5,790✔
417

418
  taosPrintLog(
5,790✔
419
      flags, level, dflag,
420
      "vgId:%d, %s, sync:%s,"
421
      " snap-receiver:%p signature:(%" PRId64 ", %" PRId64 "), {start:%d ack:%d buf:[%" PRId64 " %" PRId64 ", %" PRId64
422
      ")"
423
      " from-dnode:%d, start:%" PRId64 " end:%" PRId64 " last-index:%" PRId64 " last-term:%" PRIu64 " last-cfg:%" PRId64
424
      "}"
425
      ", term:%" PRIu64 ", commit-index:%" PRId64 ", firstver:%" PRId64 ", lastver:%" PRId64 ", min-match:%" PRId64
426
      ", snap:{last-index:%" PRId64 ", last-term:%" PRIu64 "}, standby:%d, batch-sz:%d, replicas:%d, last-cfg:%" PRId64
427
      ", chging:%d, restore:%d, quorum:%d, peer:%s, cfg:%s",
428
      pNode->vgId, eventLog, syncStr(pNode->state), pReceiver, pReceiver->term, pReceiver->startTime, pReceiver->start,
5,790✔
429
      pReceiver->ack, pReceiver->pRcvBuf->start, pReceiver->pRcvBuf->cursor, pReceiver->pRcvBuf->end,
5,790✔
430
      DID(&pReceiver->fromId), pReceiver->snapshotParam.start, pReceiver->snapshotParam.end,
5,790✔
431
      pReceiver->snapshot.lastApplyIndex, pReceiver->snapshot.lastApplyTerm, pReceiver->snapshot.lastConfigIndex,
432
      raftStoreGetTerm(pNode), pNode->commitIndex, logBeginIndex, logLastIndex, pNode->minMatchIndex,
433
      snapshot.lastApplyIndex, snapshot.lastApplyTerm, pNode->raftCfg.isStandBy, pNode->raftCfg.batchSize,
5,790✔
434
      pNode->replicaNum, pNode->raftCfg.lastConfigIndex, pNode->changing, pNode->restoreFinish, pNode->quorum, peerStr,
5,790✔
435
      cfgStr);
436
}
437

438
void syncLogRecvTimer(SSyncNode* pSyncNode, const SyncTimeout* pMsg, const STraceId* trace) {
153,762✔
439
  if (!(sDebugFlag & DEBUG_TRACE)) return;
153,762✔
440

441
  int64_t tsNow = taosGetTimestampMs();
4,727✔
442
  int64_t timeDIff = tsNow - pMsg->timeStamp;
4,727✔
443
  sNTrace(pSyncNode,
4,727!
444
          "recv sync-timer {type:%s, lc:%" PRId64 ", ms:%d, ts:%" PRId64 ", elapsed:%" PRId64
445
          ", data:%p}, QID:0x%" PRIx64 ":0x%" PRIx64,
446
          syncTimerTypeStr(pMsg->timeoutType), pMsg->logicClock, pMsg->timerMS, pMsg->timeStamp, timeDIff, pMsg->data,
447
          trace ? trace->rootId : 0, trace ? trace->msgId : 0);
448
}
449

450
void syncLogRecvLocalCmd(SSyncNode* pSyncNode, const SyncLocalCmd* pMsg, const STraceId* trace) {
44,857✔
451
  sNTrace(pSyncNode,
44,857!
452
          "recv sync-local-cmd {cmd:%d-%s, sd-new-term:%" PRId64 ", fc-index:%" PRId64 "}, QID:0x%" PRIx64
453
          ":0x%" PRIx64,
454
          pMsg->cmd, syncLocalCmdGetStr(pMsg->cmd), pMsg->currentTerm, pMsg->commitIndex, trace ? trace->rootId : 0,
455
          trace ? trace->msgId : 0);
456
}
44,857✔
457

458
void syncLogSendAppendEntriesReply(SSyncNode* pSyncNode, const SyncAppendEntriesReply* pMsg, const char* s,
×
459
                                   const STraceId* trace) {
460
  sNTrace(pSyncNode,
×
461
          "send sync-append-entries-reply to dnode:%d, {term:%" PRId64 ", pterm:%" PRId64
462
          ", success:%d, lsend-index:%" PRId64 ", match:%" PRId64 "}, %s, QID:0x%" PRIx64 ":0x%" PRIx64,
463
          DID(&pMsg->destId), pMsg->term, pMsg->lastMatchTerm, pMsg->success, pMsg->lastSendIndex, pMsg->matchIndex, s,
464
          trace ? trace->rootId : 0, trace ? trace->msgId : 0);
465
}
×
466

467
void syncLogRecvAppendEntriesReply(SSyncNode* pSyncNode, const SyncAppendEntriesReply* pMsg, const char* s,
×
468
                                   const STraceId* trace) {
469
  sNTrace(pSyncNode,
×
470
          "recv sync-append-entries-reply from dnode:%d {term:%" PRId64 ", pterm:%" PRId64
471
          ", success:%d, lsend-index:%" PRId64 ", match:%" PRId64 "}, %s, QID:0x%" PRIx64 ":0x%" PRIx64,
472
          DID(&pMsg->srcId), pMsg->term, pMsg->lastMatchTerm, pMsg->success, pMsg->lastSendIndex, pMsg->matchIndex, s,
473
          trace ? trace->rootId : 0, trace ? trace->msgId : 0);
474
}
×
475

476
void syncLogSendHeartbeat(SSyncNode* pSyncNode, const SyncHeartbeat* pMsg, bool printX, int64_t timerElapsed,
51,728✔
477
                          int64_t execTime) {
478
  if (sDebugFlag & DEBUG_TRACE) {
51,728!
479
    char pBuf[TD_TIME_STR_LEN] = {0};
×
480
    if (pMsg->timeStamp > 0) {
×
481
      if (formatTimestampLocal(pBuf, pMsg->timeStamp, TSDB_TIME_PRECISION_MILLI) == NULL) {
×
482
        pBuf[0] = '\0';
×
483
      }
484
    }
485
    if (timerElapsed > SYNC_HEARTBEAT_SLOW_MS) {
×
486
      if (printX) {
×
487
        sHError(pSyncNode,
×
488
                "send sync-heartbeat to dnode:%d {term:%" PRId64 ", commit-index:%" PRId64 ", min-match:%" PRId64
489
                ", ts:%s}, x",
490
                DID(&pMsg->destId), pMsg->term, pMsg->commitIndex, pMsg->minMatchIndex, pBuf);
491
      } else {
492
        sHError(pSyncNode,
×
493
                "send sync-heartbeat to dnode:%d {term:%" PRId64 ", commit-index:%" PRId64 ", min-match:%" PRId64
494
                ", ts:%s}, slow timer-elapsed:%" PRId64 ", next-exec:%" PRId64,
495
                DID(&pMsg->destId), pMsg->term, pMsg->commitIndex, pMsg->minMatchIndex, pBuf, timerElapsed, execTime);
496
      }
497
    } else {
498
      if (printX) {
×
499
        sHTrace(pSyncNode,
×
500
                "send sync-heartbeat to dnode:%d {term:%" PRId64 ", commit-index:%" PRId64 ", min-match:%" PRId64
501
                ", ts:%s}, x",
502
                DID(&pMsg->destId), pMsg->term, pMsg->commitIndex, pMsg->minMatchIndex, pBuf);
503
      } else {
504
        sHTrace(pSyncNode,
×
505
                "send sync-heartbeat to dnode:%d {term:%" PRId64 ", commit-index:%" PRId64 ", min-match:%" PRId64
506
                ", ts:%s}, timer-elapsed:%" PRId64 ", next-exec:%" PRId64,
507
                DID(&pMsg->destId), pMsg->term, pMsg->commitIndex, pMsg->minMatchIndex, pBuf, timerElapsed, execTime);
508
      }
509
    }
510
  }
511
}
51,728✔
512

513
void syncLogRecvHeartbeat(SSyncNode* pSyncNode, const SyncHeartbeat* pMsg, int64_t netElapsed, const STraceId* trace,
45,186✔
514
                          int64_t timeDiff) {
515
  if (timeDiff > SYNC_HEARTBEAT_SLOW_MS) {
45,186✔
516
    pSyncNode->hbSlowNum++;
2,191✔
517

518
    char pBuf[TD_TIME_STR_LEN] = {0};
2,191✔
519
    if (pMsg->timeStamp > 0) {
2,191!
520
      if (formatTimestampLocal(pBuf, pMsg->timeStamp, TSDB_TIME_PRECISION_MILLI) == NULL) {
2,191!
521
        pBuf[0] = '\0';
×
522
      }
523
    }
524

525
    sHWarn(pSyncNode,
2,191!
526
           "recv sync-heartbeat from dnode:%d slow(%d ms) {term:%" PRId64 ", commit-index:%" PRId64
527
           ", min-match:%" PRId64 ", ts:%s}, net elapsed:%" PRId64 "ms, timeDiff:%" PRId64 "ms, QID:0x%" PRIx64
528
           ":0x%" PRIx64,
529
           DID(&pMsg->srcId), SYNC_HEARTBEAT_SLOW_MS, pMsg->term, pMsg->commitIndex, pMsg->minMatchIndex, pBuf,
530
           netElapsed, timeDiff, trace ? trace->rootId : 0, trace ? trace->msgId : 0);
531
  } else {
532
    if (sDebugFlag & DEBUG_TRACE) {
42,995!
533
      char pBuf[TD_TIME_STR_LEN] = {0};
×
534
      if (pMsg->timeStamp > 0) {
×
535
        if (formatTimestampLocal(pBuf, pMsg->timeStamp, TSDB_TIME_PRECISION_MILLI) == NULL) {
×
536
          pBuf[0] = '\0';
×
537
        }
538
      }
539
      sHTrace(pSyncNode,
×
540
              "recv sync-heartbeat from dnode:%d {term:%" PRId64 ", commit-index:%" PRId64 ", min-match:%" PRId64
541
              ", ts:%s}, net elapsed:%" PRId64 "ms, timeDiff:%" PRId64 "ms, QID:0x%" PRIx64 ":0x%" PRIx64,
542
              DID(&pMsg->srcId), pMsg->term, pMsg->commitIndex, pMsg->minMatchIndex, pBuf, netElapsed, timeDiff,
543
              trace->rootId, trace->msgId);
544
    }
545
  }
546
}
45,186✔
547

548
void syncLogSendHeartbeatReply(SSyncNode* pSyncNode, const SyncHeartbeatReply* pMsg, const char* s,
×
549
                               const STraceId* trace) {
550
  sHTrace(pSyncNode,
×
551
          "send sync-heartbeat-reply from dnode:%d {term:%" PRId64 ", ts:%" PRId64 "}, %s, QID:0x%" PRIx64
552
          ":0x%" PRIx64,
553
          DID(&pMsg->destId), pMsg->term, pMsg->timeStamp, s, trace ? trace->rootId : 0, trace ? trace->msgId : 0);
554
}
×
555

556
void syncLogRecvHeartbeatReply(SSyncNode* pSyncNode, const SyncHeartbeatReply* pMsg, int64_t netElapse,
43,352✔
557
                               const STraceId* trace, int64_t timeDiff) {
558
  if (timeDiff > SYNC_HEARTBEAT_REPLY_SLOW_MS) {
43,352✔
559
    pSyncNode->hbrSlowNum++;
2,563✔
560

561
    char pBuf[TD_TIME_STR_LEN] = {0};
2,563✔
562
    if (pMsg->timeStamp > 0) {
2,563!
563
      if (formatTimestampLocal(pBuf, pMsg->timeStamp, TSDB_TIME_PRECISION_MILLI) == NULL) {
2,563!
564
        pBuf[0] = '\0';
×
565
      }
566
    }
567

568
    sHError(pSyncNode,
2,563!
569
            "recv sync-heartbeat-reply from dnode:%d slow(%d ms) {term:%" PRId64 ", ts:%s}, net elapsed:%" PRId64
570
            ", timeDiff:%" PRId64 " QID:0x%" PRIx64 ":0x%" PRIx64,
571
            DID(&pMsg->srcId), SYNC_HEARTBEAT_REPLY_SLOW_MS, pMsg->term, pBuf, netElapse, timeDiff, trace->rootId,
572
            trace->msgId);
573
  } else {
574
    if (sDebugFlag & DEBUG_TRACE) {
40,789!
575
      char pBuf[TD_TIME_STR_LEN] = {0};
×
576
      if (pMsg->timeStamp > 0) {
×
577
        if (formatTimestampLocal(pBuf, pMsg->timeStamp, TSDB_TIME_PRECISION_MILLI) == NULL) {
×
578
          pBuf[0] = '\0';
×
579
        }
580
      }
581
      sHTrace(pSyncNode,
×
582
              "recv sync-heartbeat-reply from dnode:%d {term:%" PRId64 ", ts:%" PRId64 "}, net elapsed:%" PRId64
583
              ", timeDiff:%" PRId64 " QID:0x%" PRIx64 ":0x%" PRIx64,
584
              DID(&pMsg->srcId), pMsg->term, pMsg->timeStamp, netElapse, timeDiff, trace ? trace->rootId : 0,
585
              trace ? trace->msgId : 0);
586
    }
587
  }
588
}
43,352✔
589

590
void syncLogSendSyncSnapshotSend(SSyncNode* pSyncNode, const SyncSnapshotSend* pMsg, const char* s,
×
591
                                 const STraceId* trace) {
592
  sNDebug(pSyncNode,
×
593
          "send sync-snapshot-send to dnode:%d, %s, seq:%d, term:%" PRId64 ", begin-index:%" PRId64
594
          ", last-index:%" PRId64 ", last-term:%" PRId64 ", start-time:%" PRId64 ", QID:0x%" PRIx64 ":0x%" PRIx64,
595
          DID(&pMsg->destId), s, pMsg->seq, pMsg->term, pMsg->beginIndex, pMsg->lastIndex, pMsg->lastTerm,
596
          pMsg->startTime, trace ? trace->rootId : 0, trace ? trace->msgId : 0);
597
}
×
598

599
void syncLogRecvSyncSnapshotSend(SSyncNode* pSyncNode, const SyncSnapshotSend* pMsg, const char* s,
×
600
                                 const STraceId* trace) {
601
  sNDebug(pSyncNode,
×
602
          "recv sync-snapshot-send from dnode:%d, %s, seq:%d, term:%" PRId64 ", begin-index:%" PRId64
603
          ", last-index:%" PRId64 ", last-term:%" PRId64 ", start-time:%" PRId64 ", data-len:%u, QID:0x%" PRIx64
604
          ":0x%" PRIx64,
605
          DID(&pMsg->srcId), s, pMsg->seq, pMsg->term, pMsg->beginIndex, pMsg->lastIndex, pMsg->lastTerm,
606
          pMsg->startTime, pMsg->dataLen, trace ? trace->rootId : 0, trace ? trace->msgId : 0);
607
}
×
608

609
void syncLogSendSyncSnapshotRsp(SSyncNode* pSyncNode, const SyncSnapshotRsp* pMsg, const char* s,
72✔
610
                                const STraceId* trace) {
611
  sNDebug(pSyncNode,
72!
612
          "send sync-snapshot-rsp to dnode:%d, %s, acked:%d, term:%" PRId64 ", begin-index:%" PRId64
613
          ", last-index:%" PRId64 ", last-term:%" PRId64 ", start-time:%" PRId64 ", QID:0x%" PRIx64 ":0x%" PRIx64,
614
          DID(&pMsg->destId), s, pMsg->ack, pMsg->term, pMsg->snapBeginIndex, pMsg->lastIndex, pMsg->lastTerm,
615
          pMsg->startTime, trace ? trace->rootId : 0, trace ? trace->msgId : 0);
616
}
72✔
617

618
void syncLogRecvSyncSnapshotRsp(SSyncNode* pSyncNode, const SyncSnapshotRsp* pMsg, const char* s,
×
619
                                const STraceId* trace) {
620
  sNDebug(pSyncNode,
×
621
          "recv sync-snapshot-rsp from dnode:%d, %s, ack:%d, term:%" PRId64 ", begin-index:%" PRId64
622
          ", last-index:%" PRId64 ", last-term:%" PRId64 ", start-time:%" PRId64 ", QID:0x%" PRIx64 ":0x%" PRIx64,
623
          DID(&pMsg->srcId), s, pMsg->ack, pMsg->term, pMsg->snapBeginIndex, pMsg->lastIndex, pMsg->lastTerm,
624
          pMsg->startTime, trace ? trace->rootId : 0, trace ? trace->msgId : 0);
625
}
×
626

627
void syncLogRecvAppendEntries(SSyncNode* pSyncNode, const SyncAppendEntries* pMsg, const char* s,
4✔
628
                              const STraceId* trace) {
629
  sNTrace(pSyncNode,
4!
630
          "recv sync-append-entries from dnode:%d {term:%" PRId64 ", prev-log:{index:%" PRId64 ", term:%" PRId64
631
          "}, commit-index:%" PRId64 ", datalen:%d}, %s, QID:0x%" PRIx64 ":0x%" PRIx64,
632
          DID(&pMsg->srcId), pMsg->term, pMsg->prevLogIndex, pMsg->prevLogTerm, pMsg->commitIndex, pMsg->dataLen, s,
633
          trace ? trace->rootId : 0, trace ? trace->msgId : 0);
634
}
4✔
635

636
void syncLogSendAppendEntries(SSyncNode* pSyncNode, const SyncAppendEntries* pMsg, const char* s,
×
637
                              const STraceId* trace) {
638
  sNTrace(pSyncNode,
×
639
          "send sync-append-entries to dnode:%d, {term:%" PRId64 ", prev-log:{index:%" PRId64 ", term:%" PRId64
640
          "}, index:%" PRId64 ", commit-index:%" PRId64 ", datalen:%d}, %s, QID:0x%" PRIx64 ":0x%" PRIx64,
641
          DID(&pMsg->destId), pMsg->term, pMsg->prevLogIndex, pMsg->prevLogTerm, (pMsg->prevLogIndex + 1),
642
          pMsg->commitIndex, pMsg->dataLen, s, trace ? trace->rootId : 0, trace ? trace->msgId : 0);
643
}
×
644

645
void syncLogRecvRequestVote(SSyncNode* pSyncNode, const SyncRequestVote* pMsg, int32_t voteGranted, const char* errmsg,
5,170✔
646
                            const char* opt, const STraceId* trace) {
647
  char statusMsg[64];
648
  snprintf(statusMsg, sizeof(statusMsg), "granted:%d", voteGranted);
5,170✔
649
  sNInfo(pSyncNode,
5,170!
650
         "%s sync-request-vote from dnode:%d, {term:%" PRId64 ", last-index:%" PRId64 ", last-term:%" PRId64
651
         "}, %s, QID:0x%" PRIx64 ":0x%" PRIx64,
652
         opt, DID(&pMsg->srcId), pMsg->term, pMsg->lastLogIndex, pMsg->lastLogTerm,
653
         (voteGranted != -1) ? statusMsg : errmsg, trace ? trace->rootId : 0, trace ? trace->msgId : 0);
654
}
5,170✔
655

656
void syncLogSendRequestVote(SSyncNode* pNode, const SyncRequestVote* pMsg, const char* s, const STraceId* trace) {
×
657
  sNInfo(pNode,
×
658
         "send sync-request-vote to dnode:%d {term:%" PRId64 ", last-index:%" PRId64 ", last-term:%" PRId64
659
         "}, %s, QID:0x%" PRIx64 ":0x%" PRIx64,
660
         DID(&pMsg->destId), pMsg->term, pMsg->lastLogIndex, pMsg->lastLogTerm, s, trace ? trace->rootId : 0,
661
         trace ? trace->msgId : 0);
662
}
×
663

664
void syncLogRecvRequestVoteReply(SSyncNode* pSyncNode, const SyncRequestVoteReply* pMsg, const char* s,
2,330✔
665
                                 const STraceId* trace) {
666
  sNInfo(pSyncNode,
2,330!
667
         "recv sync-request-vote-reply from dnode:%d {term:%" PRId64 ", grant:%d}, %s, QID:0x%" PRIx64 ":0x%" PRIx64,
668
         DID(&pMsg->srcId), pMsg->term, pMsg->voteGranted, s, trace ? trace->rootId : 0, trace ? trace->msgId : 0);
669
}
2,330✔
670

671
void syncLogSendRequestVoteReply(SSyncNode* pSyncNode, const SyncRequestVoteReply* pMsg, const char* s,
2,584✔
672
                                 const STraceId* trace) {
673
  sNInfo(pSyncNode,
2,584!
674
         "send sync-request-vote-reply to dnode:%d {term:%" PRId64 ", grant:%d}, %s, QID:0x%" PRIx64 ":0x%" PRIx64,
675
         DID(&pMsg->destId), pMsg->term, pMsg->voteGranted, s, trace ? trace->rootId : 0, trace ? trace->msgId : 0);
676
}
2,584✔
677

678
int32_t syncSnapInfoDataRealloc(SSnapshot* pSnap, int32_t size) {
146✔
679
  void* data = taosMemoryRealloc(pSnap->data, size);
146!
680
  if (data == NULL) {
146!
681
    return terrno;
×
682
  }
683
  pSnap->data = data;
146✔
684
  return 0;
146✔
685
}
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