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: latching changes to support shared locks #109633

Merged
merged 1 commit into from
Aug 29, 2023

Conversation

arulajmani
Copy link
Collaborator

Reads that acquire shared locks need to be isolated with concurrent write requests. They also need to be isolated with exclusive-locking reads. They can, however, run concurrently with other shared locking reads and non-locking reads.

As described in the shared locks RFC, to make these semantics work, shared-locking reads should acquire read latches at hlc.MaxTimestamp. This patch makes that change and adds test cases for all these interactions.

Closes #102264

Release note: None

@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Member

@nvanbenschoten nvanbenschoten left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 4 of 4 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @arulajmani)


pkg/kv/kvserver/concurrency/testdata/concurrency_manager/shared_locks_latches line 65 at r1 (raw file):

# Ensure non-locking reads do not conflict with shared locks on latches. We
# test non-locking reads above, below, and at the timestamps at which shared
# locking requests were issues.

"issued"


pkg/kv/kvserver/concurrency/testdata/concurrency_manager/shared_locks_latches line 643 at r1 (raw file):

finish req=req34
----
[-] finish req34: finishing request

Nice tests!

Reads that acquire shared locks need to be isolated with concurrent
write requests. They also need to be isolated with exclusive-locking
reads. They can, however, run concurrently with other shared locking
reads and non-locking reads.

As described in the shared locks RFC, to make these semantics work,
shared-locking reads should acquire read latches at `hlc.MaxTimestamp`.
This patch makes that change and adds test cases for all these
interactions.

Closes cockroachdb#102264

Release note: None
Copy link
Collaborator Author

@arulajmani arulajmani left a comment

Choose a reason for hiding this comment

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

TFTR!

bors r=nvanbenschoten

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @nvanbenschoten)


pkg/kv/kvserver/concurrency/testdata/concurrency_manager/shared_locks_latches line 643 at r1 (raw file):

Previously, nvanbenschoten (Nathan VanBenschoten) wrote…

Nice tests!

Thanks!

@craig
Copy link
Contributor

craig bot commented Aug 29, 2023

Build succeeded:

@craig craig bot merged commit c0f7217 into cockroachdb:master Aug 29, 2023
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.

concurrency: implement latching changes to support SHARED locks
3 participants