refactor(sync): add leader transfer callback

This commit is contained in:
Minghao Li 2022-07-15 16:07:45 +08:00
parent 681993884f
commit 59c7348c94
1 changed files with 4 additions and 0 deletions

View File

@ -2601,6 +2601,10 @@ const char* syncStr(ESyncState state) {
int32_t syncDoLeaderTransfer(SSyncNode* ths, SRpcMsg* pRpcMsg, SSyncRaftEntry* pEntry) {
SyncLeaderTransfer* pSyncLeaderTransfer = syncLeaderTransferFromRpcMsg2(pRpcMsg);
if (ths->state != TAOS_SYNC_STATE_FOLLOWER) {
syncNodeEventLog(ths, "I am not follower, can not do leader transfer");
return 0;
}
syncNodeEventLog(ths, "do leader transfer");
bool sameId = syncUtilSameId(&(pSyncLeaderTransfer->newLeaderId), &(ths->myRaftId));