Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kvserver: stop pretending to deal with Raft leadership when draining
The draining code was pretending to deal with transferring Raft leadership, besides leases, but it was all an illusion. This patch stops the pretending, simplifying the code and preventing mis-interpretation (which I've suffered from). There are a few cases to discuss: 1) There is no lease. The code really looked like it will try to do something to the leadership, but ended up not doing anything because maybeTransferRaftLeadership() is a no-op when there's no lease. 2) The leases needs to be moved. In this case, the code was first trying to move the lease and then, if that *failed, was trying to move the leadership. This was a no-op since maybeTransferRaftLeadership() only moves to the leadership to the leaseholder; if the leaseholder hasn't moved, it's a no-op. 3) The lease doesn't need to be moved, but the leadership does. In this case the code could theoretically do the leadership transfer, but this case is very rare - the leadership moves as lease transfers apply, and if that fails, we'll continue attempting to move the leadership every Raft tick (every 200ms). Release note: None
- Loading branch information