real-logic / aeron

Efficient reliable UDP unicast, UDP multicast, and IPC message transport
Apache License 2.0
7.37k stars 888 forks source link

Why not directly enter the FollowerLeplay state from the FollowerLogReplication state? #1646

Closed moyeanl closed 2 months ago

moyeanl commented 2 months ago

When the log replication of the follower node is done, it will enter the Canvass state and wait for the newLeadershipTerm message to enter the Follower Replay state. The only point to enter the Follower Replay state is onNewLeadershipTerm. Why not directly enter the FollowerLeplay state from the FollowerLogReplication state?

moyeanl commented 2 months ago

image

mikeb01 commented 2 months ago

If the follower is multiple terms behind it will replicate the log a term at a time rather than try and replicate all of the log crossing multiple terms. This simplifies some of the state management within the election and consensus module. Because of this it is preferred to bounce between FOLLOWER_LOG_REPLICATION and CANVASS to effectively query each leadership term as they are replicated. Thereby determining whether to jump to FOLLOWER_REPLAY or to follower FOLLOWER_REPLICATION based on progress.

moyeanl commented 2 months ago

If the follower is multiple terms behind it will replicate the log a term at a time rather than try and replicate all of the log crossing multiple terms. This simplifies some of the state management within the election and consensus module. Because of this it is preferred to bounce between FOLLOWER_LOG_REPLICATION and CANVASS to effectively query each leadership term as they are replicated. Thereby determining whether to jump to FOLLOWER_REPLAY or to follower FOLLOWER_REPLICATION based on progress.

Got it. Thanks a lot.