refactor(sync): append noop in become leader
This commit is contained in:
parent
b247762931
commit
f5366425ed
|
@ -841,15 +841,6 @@ void syncNodeStart(SSyncNode* pSyncNode) {
|
||||||
syncNodeBecomeLeader(pSyncNode, "one replica start");
|
syncNodeBecomeLeader(pSyncNode, "one replica start");
|
||||||
|
|
||||||
// Raft 3.6.2 Committing entries from previous terms
|
// Raft 3.6.2 Committing entries from previous terms
|
||||||
|
|
||||||
// use this now
|
|
||||||
syncNodeAppendNoop(pSyncNode);
|
|
||||||
syncMaybeAdvanceCommitIndex(pSyncNode); // maybe only one replica
|
|
||||||
|
|
||||||
if (gRaftDetailLog) {
|
|
||||||
syncNodeLog2("==state change become leader immediately==", pSyncNode);
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1583,6 +1574,10 @@ void syncNodeBecomeLeader(SSyncNode* pSyncNode, const char* debugStr) {
|
||||||
// start heartbeat timer
|
// start heartbeat timer
|
||||||
syncNodeStartHeartbeatTimer(pSyncNode);
|
syncNodeStartHeartbeatTimer(pSyncNode);
|
||||||
|
|
||||||
|
// append noop
|
||||||
|
syncNodeAppendNoop(pSyncNode);
|
||||||
|
syncMaybeAdvanceCommitIndex(pSyncNode); // maybe only one replica
|
||||||
|
|
||||||
// trace log
|
// trace log
|
||||||
do {
|
do {
|
||||||
int32_t debugStrLen = strlen(debugStr);
|
int32_t debugStrLen = strlen(debugStr);
|
||||||
|
@ -1608,10 +1603,6 @@ void syncNodeCandidate2Leader(SSyncNode* pSyncNode) {
|
||||||
|
|
||||||
// Raft 3.6.2 Committing entries from previous terms
|
// Raft 3.6.2 Committing entries from previous terms
|
||||||
|
|
||||||
// use this now
|
|
||||||
syncNodeAppendNoop(pSyncNode);
|
|
||||||
syncMaybeAdvanceCommitIndex(pSyncNode); // maybe only one replica
|
|
||||||
|
|
||||||
// do not use this
|
// do not use this
|
||||||
// syncNodeEqNoop(pSyncNode);
|
// syncNodeEqNoop(pSyncNode);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue