I’ve been interested in how read/write path looks like in CockroachDB and how strong consistency is guaranteed (e.g. no stale reads). I understand that you uses “range lease” to serve reads/writes on a range lease holder, which enables reads to be served locally without going through raft. It also addresses the clock drift by introducing a stasis period before the lease expires.
However, I don’t understand how range lease can solve the stale read problem during fail-over case. Say a range holder fails right after committing a write to its local state machine successfully, but the other replicas may have not committed yet. I suppose a new node will be selected as the next lease holder, and a read to the new range holder may not read the already-committed write in the previous lease holder? Is that a concern that CockroachDB has addressed during the lease transfer stage?