-
Notifications
You must be signed in to change notification settings - Fork 4.1k
kv: implement SHARED lock strength for unreplicated locks #91545
Copy link
Copy link
Closed
Labels
A-kv-transactionsRelating to MVCC and the transactional model.Relating to MVCC and the transactional model.A-read-committedRelated to the introduction of Read CommittedRelated to the introduction of Read CommittedC-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)P-1Issues/test failures with a fix SLA of 1 monthIssues/test failures with a fix SLA of 1 monthT-kvKV TeamKV Team
Description
The lockTable currently only supports the exclusive lock strength, but was designed to support varying degrees of lock strengths. Specifically, it was designed to support both SHARED and UPGRADE (tracked separately in #49684) locking strength as well.
cockroach/pkg/kv/kvserver/concurrency/lock/locking.proto
Lines 40 to 50 in 82b2519
| // +-----------+-----------+-----------+-----------+-----------+ | |
| // | | None | Shared | Upgrade | Exclusive | | |
| // +-----------+-----------+-----------+-----------+-----------+ | |
| // | None | | | | X^† | | |
| // +-----------+-----------+-----------+-----------+-----------+ | |
| // | Shared | | | X | X | | |
| // +-----------+-----------+-----------+-----------+-----------+ | |
| // | Upgrade | | X | X | X | | |
| // +-----------+-----------+-----------+-----------+-----------+ | |
| // | Exclusive | X^† | X | X | X | | |
| // +-----------+-----------+-----------+-----------+-----------+ |
Additional context
Today SQL accepts syntax of the form SELECT ... FOR SHARE but does not lock any of the rows returned. It should be easy enough to correctly use the SHARED locking strength once the lockTable supports it.
Jira issue: CRDB-21312
Epic CRDB-26544
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-kv-transactionsRelating to MVCC and the transactional model.Relating to MVCC and the transactional model.A-read-committedRelated to the introduction of Read CommittedRelated to the introduction of Read CommittedC-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)P-1Issues/test failures with a fix SLA of 1 monthIssues/test failures with a fix SLA of 1 monthT-kvKV TeamKV Team