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

taosdata / TDengine / #4192

30 May 2025 03:55AM UTC coverage: 63.023% (-0.2%) from 63.267%
#4192

push

travis-ci

web-flow
fix:defined col bind in interlace mode (#31246)

157832 of 318864 branches covered (49.5%)

Branch coverage included in aggregate %.

1 of 3 new or added lines in 1 file covered. (33.33%)

2934 existing lines in 172 files now uncovered.

243367 of 317732 relevant lines covered (76.6%)

17346426.62 hits per line

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

64.4
/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,554✔
30
  int32_t len = tsnprintf(buf, bufLen, "{num:%d, as:%d, [", pCfg->replicaNum, pCfg->myIndex);
205,554✔
31
  for (int32_t i = 0; i < pCfg->replicaNum; ++i) {
534,426✔
32
    len += tsnprintf(buf + len, bufLen - len, "%s:%d", pCfg->nodeInfo[i].nodeFqdn, pCfg->nodeInfo[i].nodePort);
328,862✔
33
    if (i < pCfg->replicaNum - 1) {
328,866✔
34
      len += tsnprintf(buf + len, bufLen - len, "%s", ", ");
123,307✔
35
    }
36
  }
37
  len += tsnprintf(buf + len, bufLen - len, "%s", "]}");
205,564✔
38
}
205,561✔
39

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

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

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

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

67
  char ipbuf[TD_IP_LEN] = {0};
26,517✔
68
  taosInetNtoa(ipbuf, ipv4);
26,517✔
69
  raftId->addr = SYNC_ADDR(pInfo);
26,517✔
70
  raftId->vgId = vgId;
26,517✔
71

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

77
bool syncUtilSameId(const SRaftId* pId1, const SRaftId* pId2) {
50,789,512✔
78
  if (pId1->addr == pId2->addr && pId1->vgId == pId2->vgId) {
50,789,512!
79
    return true;
31,820,589✔
80
  }
81

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

86
  return false;
18,968,711✔
87
}
88

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

91
static inline int32_t syncUtilRand(int32_t max) { return taosRand() % max; }
610,240✔
92

93
int32_t syncUtilElectRandomMS(int32_t min, int32_t max) {
610,240✔
94
  int32_t rdm = min + syncUtilRand(max - min);
610,240✔
95

96
  // sDebug("random min:%d, max:%d, rdm:%d", min, max, rdm);
97
  return rdm;
610,244✔
98
}
99

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

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

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

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

129
// for leader
130
static void syncHearbeatReplyTime2Str(SSyncNode* pSyncNode, char* buf, int32_t bufLen, bool formatTime) {
118,010✔
131
  int32_t len = 0;
118,010✔
132
  len += tsnprintf(buf + len, bufLen - len, "%s", "{");
118,010✔
133
  for (int32_t i = 0; i < pSyncNode->replicaNum; ++i) {
315,638✔
134
    int64_t tsMs = syncIndexMgrGetRecvTime(pSyncNode->pMatchIndex, &(pSyncNode->replicasId[i]));
197,626✔
135
    syncPrintTime(formatTime, &len, tsMs, i, buf, bufLen);
197,624✔
136
    if (i < pSyncNode->replicaNum - 1) {
197,622✔
137
      len += tsnprintf(buf + len, bufLen - len, "%s", ",");
79,617✔
138
    }
139
  }
140
  len += tsnprintf(buf + len, bufLen - len, "%s", "}");
118,012✔
141
}
118,014✔
142

143
static void syncSentHearbeatTime2Str(SSyncNode* pSyncNode, char* buf, int32_t bufLen, bool formatTime) {
118,012✔
144
  int32_t len = 0;
118,012✔
145
  len += tsnprintf(buf + len, bufLen - len, "%s", "{");
118,012✔
146
  for (int32_t i = 0; i < pSyncNode->replicaNum; ++i) {
315,637✔
147
    int64_t tsMs = syncIndexMgrGetSentTime(pSyncNode->pMatchIndex, &(pSyncNode->replicasId[i]));
197,627✔
148
    syncPrintTime(formatTime, &len, tsMs, i, buf, bufLen);
197,628✔
149
    if (i < pSyncNode->replicaNum - 1) {
197,626✔
150
      len += tsnprintf(buf + len, bufLen - len, "%s", ",");
79,617✔
151
    }
152
  }
153
  len += tsnprintf(buf + len, bufLen - len, "%s", "}");
118,010✔
154
}
118,013✔
155

156
// for follower
157
static void syncHearbeatTime2Str(SSyncNode* pSyncNode, char* buf, int32_t bufLen, bool formatTime) {
117,993✔
158
  int32_t len = 0;
117,993✔
159
  len += tsnprintf(buf + len, bufLen - len, "%s", "{");
117,993✔
160
  for (int32_t i = 0; i < pSyncNode->replicaNum; ++i) {
315,639✔
161
    int64_t tsMs = syncIndexMgrGetRecvTime(pSyncNode->pNextIndex, &(pSyncNode->replicasId[i]));
197,615✔
162
    syncPrintTime(formatTime, &len, tsMs, i, buf, bufLen);
197,629✔
163
    if (i < pSyncNode->replicaNum - 1) {
197,627✔
164
      len += tsnprintf(buf + len, bufLen - len, "%s", ",");
79,618✔
165
    }
166
  }
167
  len += tsnprintf(buf + len, bufLen - len, "%s", "}");
118,024✔
168
}
118,012✔
169

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

180
static void syncLogReplStates2Str(SSyncNode* pSyncNode, char* buf, int32_t bufLen) {
118,004✔
181
  int32_t len = 0;
118,004✔
182
  len += tsnprintf(buf + len, bufLen - len, "%s", "{");
118,004✔
183
  for (int32_t i = 0; i < pSyncNode->replicaNum; i++) {
315,640✔
184
    SSyncLogReplMgr* pMgr = pSyncNode->logReplMgrs[i];
197,631✔
185
    if (pMgr == NULL) break;
197,631!
186
    len += tsnprintf(buf + len, bufLen - len, "%d:%d [%" PRId64 ", %" PRId64 ", %" PRId64 "] ", i, pMgr->restored,
197,631✔
187
                     pMgr->startIndex, pMgr->matchIndex, pMgr->endIndex);
188
    len += tsnprintf(buf + len, bufLen - len, "%" PRId64, pMgr->sendCount);
197,626✔
189
    if (i + 1 < pSyncNode->replicaNum) {
197,628✔
190
      len += tsnprintf(buf + len, bufLen - len, "%s", ", ");
79,618✔
191
    }
192
  }
193
  len += tsnprintf(buf + len, bufLen - len, "%s", "}");
118,009✔
194
}
118,013✔
195

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

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

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

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

221
  SyncIndex logLastIndex = SYNC_INDEX_INVALID;
113,185✔
222
  SyncIndex logBeginIndex = SYNC_INDEX_INVALID;
113,185✔
223
  if (pNode->pLogStore != NULL) {
113,185!
224
    logLastIndex = pNode->pLogStore->syncLogLastIndex(pNode->pLogStore);
113,189✔
225
    logBeginIndex = pNode->pLogStore->syncLogBeginIndex(pNode->pLogStore);
113,186✔
226
  }
227

228
  int32_t cacheHit = pNode->pLogStore->cacheHit;
113,182✔
229
  int32_t cacheMiss = pNode->pLogStore->cacheMiss;
113,182✔
230

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

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

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

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

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

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

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

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

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

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

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

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

294
  int32_t cacheHit = pNode->pLogStore->cacheHit;
4,824✔
295
  int32_t cacheMiss = pNode->pLogStore->cacheMiss;
4,824✔
296

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

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

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

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

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

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

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

321
  terrno = errCode;
4,824✔
322

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

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

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

351
  SyncIndex logLastIndex = SYNC_INDEX_INVALID;
81,737✔
352
  SyncIndex logBeginIndex = SYNC_INDEX_INVALID;
81,737✔
353
  if (pNode->pLogStore != NULL) {
81,737✔
354
    logLastIndex = pNode->pLogStore->syncLogLastIndex(pNode->pLogStore);
81,734✔
355
    logBeginIndex = pNode->pLogStore->syncLogBeginIndex(pNode->pLogStore);
81,731✔
356
  }
357

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

514
void syncLogRecvHeartbeat(SSyncNode* pSyncNode, const SyncHeartbeat* pMsg, int64_t netElapsed, const STraceId* trace,
44,360✔
515
                          int64_t timeDiff) {
516
  if (timeDiff > SYNC_HEARTBEAT_SLOW_MS) {
44,360✔
517
    pSyncNode->hbSlowNum++;
2,263✔
518

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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