Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kv: don't serve non-locking, read-write requests on followers
Discovered while investigating a test failure in cockroachdb#59566. In 278a21b, we shifted from talking about read and write requests to locking and non-locking requests when deciding whether a request could be served on a follower. This prevented locking scans and gets from being served on followers. However, it began letting lone HeartbeatTxn and EndTxn requests past the old `!IsReadOnly()` check. Luckily, these were still prevented from being served on followers because they are only sent in read-write transactions, which were also prevented from performing follower reads. Yesterday, in 0ac8ab9, we lifted this second limitation, allowing read-write transactions to perform follower reads for non-locking batches. However, this no longer prevented HeartbeatTxn and EndTxn requests from being routed and served on follower replicas. This resulted in a pretty disastrous situation where in very rare cases, a follower was proposing a write under a lease that it did not own. Luckily, new assertions added in cockroachdb#59566 caught this. This commit fixes this oversight be re-introducing "read-only" as a condition for serving follower reads. Release note: None
- Loading branch information