提交 8bb15c5f 编写于 作者: S Shengliang Guan

Merge branch 'feature/sync-refactor' of https://github.com/taosdata/TDengine...

Merge branch 'feature/sync-refactor' of https://github.com/taosdata/TDengine into feature/sync-refactor
......@@ -58,6 +58,8 @@ typedef struct SSyncRespMgr SSyncRespMgr;
typedef struct SSyncSnapshotSender SSyncSnapshotSender;
typedef struct SSyncSnapshotReceiver SSyncSnapshotReceiver;
extern bool gRaftDetailLog;
typedef struct SSyncNode {
// init by SSyncInfo
SyncGroupId vgId;
......
......@@ -35,6 +35,8 @@
#include "syncVoteMgr.h"
#include "tref.h"
bool gRaftDetailLog = false;
static int32_t tsNodeRefId = -1;
// ------ local funciton ---------
......@@ -1203,6 +1205,16 @@ void syncNodeBecomeLeader(SSyncNode* pSyncNode) {
pSyncNode->pMatchIndex->index[i] = SYNC_INDEX_INVALID;
}
// update sender private term
SSyncSnapshotSender* pMySender = syncNodeGetSnapshotSender(pSyncNode, &(pSyncNode->myRaftId));
ASSERT(pMySender != NULL);
for (int i = 0; i < pSyncNode->pMatchIndex->replicaNum; ++i) {
if ((pSyncNode->senders)[i]->privateTerm > pMySender->privateTerm) {
pMySender->privateTerm = (pSyncNode->senders)[i]->privateTerm;
}
}
(pMySender->privateTerm) += 100;
// stop elect timer
syncNodeStopElectTimer(pSyncNode);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册