etcd-io / raft

Raft library for maintaining a replicated state machine
Apache License 2.0
666 stars 164 forks source link

testdata: add a lagging commit test #137

Closed pav-kv closed 9 months ago

pav-kv commented 9 months ago

This commit adds a test demonstrating the effect of delayed commit on a follower node after a network hiccup between the leader and this follower.

In the described scenario, after the moment of committing an entry on the leader, it takes HeartbeatInterval + 3/2 * RTT until the follower learns this entry is committed.

This is suboptimal, and could take HeartbeatInverval + 1/2 * RTT if the leader didn't cut the commit index at Progress.Match before sending it to the follower.

Informs #138

pav-kv commented 9 months ago

@nvanbenschoten @ahrtr PTAL. This is a regression test for potential future fixes for #138.

erikgrinaker commented 9 months ago

This is suboptimal, and could take HeartbeatInverval + 1/2 * RTT if the leader didn't cut the commit index at Progress.Match before sending it to the follower.

Why do we care? Follower reads?

pav-kv commented 9 months ago

Why do we care? Follower reads?

Yes, and also the general "convergence" of the system (resulting in fewer messages etc). For other kinds of reads, like quorum reads, this also seems relevant.

pav-kv commented 9 months ago

@ahrtr Good to merge?