提交 8dbacfdf 编写于 作者: M Minghao Li

refactor(sync): make leader life longer

上级 27d72283
...@@ -125,6 +125,14 @@ int32_t syncNodeOnRequestVoteReplySnapshotCb(SSyncNode* ths, SyncRequestVoteRepl ...@@ -125,6 +125,14 @@ int32_t syncNodeOnRequestVoteReplySnapshotCb(SSyncNode* ths, SyncRequestVoteRepl
// This tallies votes even when the current state is not Candidate, // This tallies votes even when the current state is not Candidate,
// but they won't be looked at, so it doesn't matter. // but they won't be looked at, so it doesn't matter.
if (ths->state == TAOS_SYNC_STATE_CANDIDATE) { if (ths->state == TAOS_SYNC_STATE_CANDIDATE) {
if (ths->pVotesRespond->term != pMsg->term) {
char logBuf[128];
snprintf(logBuf, sizeof(logBuf), "vote respond error vote-respond-mgr term:%lu, msg term:lu",
ths->pVotesRespond->term, pMsg->term);
syncNodeErrorLog(ths, logBuf);
return -1;
}
votesRespondAdd(ths->pVotesRespond, pMsg); votesRespondAdd(ths->pVotesRespond, pMsg);
if (pMsg->voteGranted) { if (pMsg->voteGranted) {
// add vote // add vote
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册