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: optimistic evaluation does not make use of lock modes #108142

Closed
arulajmani opened this issue Aug 3, 2023 · 0 comments · Fixed by #108179
Closed

concurrency: optimistic evaluation does not make use of lock modes #108142

arulajmani opened this issue Aug 3, 2023 · 0 comments · Fixed by #108179
Assignees
Labels
A-kv-transactions Relating to MVCC and the transactional model. 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 Aug 3, 2023

Describe the problem

Optimistic evaluation performs conflict resolution post evaluation, using CheckOptimisticNoConflicts. Eventually, this function finds itself in isNonConflictingLock, which does not use lock modes to check for conflicts:

func (l *lockState) isNonConflictingLock(g *lockTableGuardImpl, str lock.Strength) bool {
l.mu.Lock()
defer l.mu.Unlock()
// It is possible that this lock is empty and has not yet been deleted.
if l.isEmptyLock() {
return true
}
// Lock is not empty.
lockHolderTxn, lockHolderTS := l.getLockHolder()

It should.

Jira issue: CRDB-30327

@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. labels Aug 3, 2023
@arulajmani arulajmani self-assigned this Aug 3, 2023
@blathers-crl blathers-crl bot added the T-kv KV Team label Aug 3, 2023
craig bot pushed a commit that referenced this issue Aug 10, 2023
108179: concurrency: use lock modes to detect conflicts during optimistic eval r=nvanbenschoten a=arulajmani

This patch switches over conflict resolution performed by optimistic evaluation to use lock modes instead of ad-hoc logic. As a result of this, optimistic evaluation is able to handle shared locks. We add a test to show this.

Closes #108142

Release note: None

108503: sql: do not evaluate AOST timestamp in session migrations r=rafiss a=rafiss

fixes https://github.com/cockroachlabs/support/issues/2510
refs #108305
Release note (bug fix): Fixed a bug where a session migration performed by SHOW TRANSFER STATE would not handle prepared statements that used the AS OF SYSTEM TIME clause. Users who encountered this bug would see errors such as `expected 1 or 0 for number of format codes, got N`. This bug was present since v22.2.0.

108523: roachtest: Reset job load attempt when loading cdc job r=miretskiy a=miretskiy

Fixes #108433

Release note: None

Co-authored-by: Arul Ajmani <[email protected]>
Co-authored-by: Rafi Shamim <[email protected]>
Co-authored-by: Yevgeniy Miretskiy <[email protected]>
@craig craig bot closed this as completed in 90ba1ef Aug 10, 2023
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. C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. T-kv KV Team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant