-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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: implement ranged locks for unreplicated locks #55896
Comments
Hi @ajwerner, I've guessed the C-ategory of your issue and suitably labeled it. Please re-label if inaccurate. While you're here, please consider adding an A- label to help keep our repository tidy. 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan. |
What is a workload for which we expect to see a benefit from this? |
It's not immediately obvious that we'd even want to enable this in any workload up-front as it does differ from postgres semantics. I'd anticipate if we did enable it by default to use ranged locks with select for update, then a workload which runs a whole-table The primary motivation is the ability for transactional schema changes to hold off invalidating writes.
I think that |
It seems like if we wanted the ranged locks to be durable, we might be able to leverage the work in cockroachdb/pebble#1339. |
We have marked this issue as stale because it has been inactive for |
Is your feature request related to a problem? Please describe.
As of 20.1, read requests can acquire unreplicated locks to support
SELECT FOR UPDATE
. In the case ofScanRequest
andReverseScanRequest
these locks acquire point locks on every row read. Such point locks do not prevent new rows from being inserted and invalidating the read upon refresh. Ranged locks would block the writing of new rows within the span that had been read.Describe the solution you'd like
I'd like to see a bit that could be set on the
ScanRequest
andReverseScanRequest
which would enable the acquired locks to be ranged rather than point.Additional context
See #49684 (comment).
If I understand correctly, postgres and many other relational databases do not acquire ranged locks for
SELECT FOR UPDATE
. I anticipate the reason is that these databases are generally operated using lower thenSERIALIZABLE
isolation levels where such inserts are not problematic.It's an open question as to whether we'd want to default to using ranged locks in that context. They will certainly be valuable in supporting #52768 which is an important add-on to #55047.
This issue also relates to #49684 as acquiring exclusive ranged locks will lead to a worse user experience without obvious benefit.
Jira issue: CRDB-3618
The text was updated successfully, but these errors were encountered: