braft icon indicating copy to clipboard operation
braft copied to clipboard

check follower's log gap before transfer leader to it

Open JayiceZ opened this issue 1 year ago • 0 comments

In braft's current implementation. if user call transfer_leadership_to a follower, The original leader will call on_leader_stop then wait for the destination follower to catch up log and become new leader. During this time, the raft group can not serve writes.

If there's a big gap between leader's log and the destination follower's log, it will take a long time to wait for the follower to catch up until transfer timeout.

Similar issue: https://github.com/baidu/braft/issues/422

Checking if follower's log is new enough before we actually do transfer_leader may be a nice improvement.

If the improvement is needed, I can submit a PR for it

JayiceZ avatar Mar 12 '24 10:03 JayiceZ