See etcd-io/etcd#14627 (comment).
In becomeLeader, we call r.reset() which resets the uncommitted log size. This means that in theory the uncommitted log size isn't bounded:
- 5x replication
- peer 1 becomes leader (committed = 1)
- peer 1 amasses uncommitted log up to the limit, only replicates it to peer 2 but not 3-5 (so no quorum)
- peer 1 loses leadership
- peer 2 becomes leader (committed = 1)
- peer 2 amasses more log entries
- peer 1 becomes leader
- ...
We could either
- live with that, but uncommitted log is amassed precisely in situations where leadership is unstable, so the counter-example could happen in practice (esp. under a workload that proposes large log entries)
- not reset the uncommitted log size across term changes
- scan the uncommitted log when becoming leader to obtain its size (can be expensive and has potential to further destabilize the system).
See etcd-io/etcd#14627 (comment).
In
becomeLeader, we callr.reset()which resets the uncommitted log size. This means that in theory the uncommitted log size isn't bounded:We could either