Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kv: permit some non-transactional batches to perform follower reads #68192

Merged

Conversation

nvanbenschoten
Copy link
Member

Touches #67562.

This commit adds support for a subset of non-transactional batch requests to perform follower reads. Specifically, it makes those that do not rely on their timestamp being set from the server's clock eligible.

This condition is necessary because if a follower with a lagging clock sets its timestamp and this then allows the follower to evaluate the batch as a follower read, then the batch might miss past writes served at higher timestamps on the leaseholder.

@nvanbenschoten nvanbenschoten requested review from aayushshah15 and a team July 28, 2021 18:57
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Contributor

@aayushshah15 aayushshah15 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

I'm missing some context here, particularly around when we would/wouldn't expect a non-transactional request to receive its timestamp from the server-side. Is there anything you could point me to regarding this? Otherwise, I can bring it up offline with you later.

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained

Touches cockroachdb#67562.

This commit adds support for a subset of non-transactional batch
requests to perform follower reads. Specifically, it makes those that do
not rely on their timestamp being set from the server's clock eligible.

This condition is necessary because if a follower with a lagging clock
sets its timestamp and this then allows the follower to evaluate the
batch as a follower read, then the batch might miss past writes served
at higher timestamps on the leaseholder.
@nvanbenschoten nvanbenschoten force-pushed the nvanbenschoten/nonTxnFollowerRead branch from 7b21d5c to e024445 Compare August 2, 2021 01:58
@nvanbenschoten
Copy link
Member Author

TFTR!

bors r+

Is there anything you could point me to regarding this? Otherwise, I can bring it up offline with you later.

I think the best resources about this are BatchRequest.SetActiveTimestamp and Header.Timestamp, but neither of these is comprehensive. This issue about removing them might actually be more helpful: #58459. The way to think about this is that allowing a non-transactional request (which is always single-range) to get its read timestamp from the server is how we can ensure single-key linearizability without uncertainty intervals. But there is a class of non-transactional requests that aren't concerned with linearizability and are fine with staleness. Instead, they have a specific timestamp that they want to operate at. These are the requests that set a timestamp on the client and these are the requests that this PR permits to run on suitable followers (subject to other requirements in BatchCanBeEvaluatedOnFollower).

@craig
Copy link
Contributor

craig bot commented Aug 2, 2021

Build succeeded:

@craig craig bot merged commit 89bb4c7 into cockroachdb:master Aug 2, 2021
@nvanbenschoten nvanbenschoten deleted the nvanbenschoten/nonTxnFollowerRead branch August 2, 2021 02:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants