Merge branch 'feature/sync-refactor' of https://github.com/taosdata/TDengine into feature/sync-refactor
This commit is contained in:
commit
8bb15c5f97
|
@ -58,6 +58,8 @@ typedef struct SSyncRespMgr SSyncRespMgr;
|
||||||
typedef struct SSyncSnapshotSender SSyncSnapshotSender;
|
typedef struct SSyncSnapshotSender SSyncSnapshotSender;
|
||||||
typedef struct SSyncSnapshotReceiver SSyncSnapshotReceiver;
|
typedef struct SSyncSnapshotReceiver SSyncSnapshotReceiver;
|
||||||
|
|
||||||
|
extern bool gRaftDetailLog;
|
||||||
|
|
||||||
typedef struct SSyncNode {
|
typedef struct SSyncNode {
|
||||||
// init by SSyncInfo
|
// init by SSyncInfo
|
||||||
SyncGroupId vgId;
|
SyncGroupId vgId;
|
||||||
|
|
|
@ -35,6 +35,8 @@
|
||||||
#include "syncVoteMgr.h"
|
#include "syncVoteMgr.h"
|
||||||
#include "tref.h"
|
#include "tref.h"
|
||||||
|
|
||||||
|
bool gRaftDetailLog = false;
|
||||||
|
|
||||||
static int32_t tsNodeRefId = -1;
|
static int32_t tsNodeRefId = -1;
|
||||||
|
|
||||||
// ------ local funciton ---------
|
// ------ local funciton ---------
|
||||||
|
@ -1203,6 +1205,16 @@ void syncNodeBecomeLeader(SSyncNode* pSyncNode) {
|
||||||
pSyncNode->pMatchIndex->index[i] = SYNC_INDEX_INVALID;
|
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
|
// stop elect timer
|
||||||
syncNodeStopElectTimer(pSyncNode);
|
syncNodeStopElectTimer(pSyncNode);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue