-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
73725: kv: add TestTxnReadWithinUncertaintyInterval r=lidorcarmel a=nvanbenschoten Extracted from #72121, because that PR is on-hold. The first commit adds a new test called `TestTxnReadWithinUncertaintyInterval` which tests cases where a transaction observes a committed value below its global uncertainty limit while performing a read. In one variant, the transaction does not have an observed timestamp, so it hits a ReadWithinUncertaintyIntervalError. In a second variant, it does have an observed timestamp, so it avoids the error. This is very old functionality, but I could not find a functional test like this in `pkg/kv/kvserver`, so I figured I'd add one. We have tests below this level (in pkg/storage) and above this level (jepsen, I hope elsewhere as well), but I couldn't find a similar test operating at this exact level. The second commit adds an additional variant of this test which exercises a case where a transaction observes a committed value in its uncertainty interval that was written under a previous leaseholder. In the test, the transaction does collect an observed timestamp from the KV node that eventually serves the read, but this observed timestamp is not allowed to be used to constrain its local uncertainty limit below the lease start time and avoid the uncertainty error. As a result, it observes the committed value in its uncertain future and receives a ReadWithinUncertaintyIntervalError, which avoids a stale read. Co-authored-by: Nathan VanBenschoten <[email protected]>
- Loading branch information
Showing
1 changed file
with
200 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters