Skip to content

Commit

Permalink
When the leader gracefully closes, the follower can re-enter the elec…
Browse files Browse the repository at this point in the history
…tion more quickly, instead of waiting to detect the RecordingSignal.STOP signal in the slowTickWork method.
  • Loading branch information
WorkingChen committed Jun 4, 2024
1 parent 57376c8 commit 752e54c
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2227,10 +2227,13 @@ private int consensusWork(final long timestamp, final long nowNs)
{
final long limit = null != appendPosition ? appendPosition.get() : logRecordingStopPosition;
final int count = logAdapter.poll(Math.min(notifiedCommitPosition, limit));
if (0 == count && logAdapter.isImageClosed())
if (0 == count)
{
final boolean isEos = logAdapter.isLogEndOfStream();
enterElection(isEos, "log disconnected from leader: eos=" + isEos);
if(isEos || logAdapter.isImageClosed())
{
enterElection(isEos, "log disconnected from leader: eos=" + isEos);
}
return 1;
}

Expand Down

0 comments on commit 752e54c

Please sign in to comment.