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

concurrency: implement latching changes to support SHARED locks #102264

Closed
arulajmani opened this issue Apr 25, 2023 · 0 comments · Fixed by #109633
Closed

concurrency: implement latching changes to support SHARED locks #102264

arulajmani opened this issue Apr 25, 2023 · 0 comments · Fixed by #109633
Assignees
Labels
A-kv-transactions Relating to MVCC and the transactional model. A-read-committed Related to the introduction of Read Committed C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. T-kv KV Team

Comments

@arulajmani
Copy link
Collaborator

arulajmani commented Apr 25, 2023

Describe the problem

Currently, non-locking read requests acquire read latches at their read timestamp. This isolates them from concurrent writers at equal or lower timestamps. However, this permits write requests at higher timestamps to proceed, as they do not conflict with such non-locking reads.

The expectation with Shared locks is that they should protect the read at higher timestamps as well. This makes the current read latch semantics inadequate. As proposed in the Shared locks RFC, shared lock requests should acquire read latches at max timestamp instead of the requests's timestamp. This ensures they don't conflict with concurrent reads (reads that acquire shared locks or non-locking reads) but do conflict with all concurrent writes.

Jira issue: CRDB-27371

@arulajmani arulajmani added C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. A-kv-transactions Relating to MVCC and the transactional model. T-kv KV Team A-read-committed Related to the introduction of Read Committed labels Apr 25, 2023
arulajmani added a commit to arulajmani/cockroach that referenced this issue Aug 28, 2023
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
craig bot pushed a commit that referenced this issue Aug 29, 2023
109633: kv: latching changes to support shared locks r=nvanbenschoten a=arulajmani

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

Co-authored-by: Arul Ajmani <[email protected]>
@craig craig bot closed this as completed in 82cc8d2 Aug 29, 2023
@github-project-automation github-project-automation bot moved this to Closed in KV Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-kv-transactions Relating to MVCC and the transactional model. A-read-committed Related to the introduction of Read Committed C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. T-kv KV Team
Projects
No open projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant