Skip to content

Commit

Permalink
storage: check for conflicting replicated locks in mvccPutInternal
Browse files Browse the repository at this point in the history
Fixes cockroachdb#109647.
Informs cockroachdb#100193.

This commit uses the `lockTableKeyScanner` introduced in cockroachdb#110323 to scan
for conflicting replicated locks at the same time as we can for intents
(the writer's or others') when performing mutations in mvccPutInternal.
In doing so, the commit removes use of `intentInterleavingIter` on the
mutation path, opting for the explicit scan of the lock table instead.

Use of the lockTableKeyScanner to both check for conflicting locks and
to scan for intents ensures that in the common case where there are no
locks on a key, we only perform one (prefix) seek. This should avoid any
regression. I'll collect some benchmark results to verify that this
reasoning holds and that this does not cause a performance regression
for write-heavy workloads.

Release note: None
  • Loading branch information
nvanbenschoten committed Sep 15, 2023
1 parent bd50c84 commit 9b84f56
Show file tree
Hide file tree
Showing 4 changed files with 331 additions and 58 deletions.
6 changes: 0 additions & 6 deletions pkg/storage/enginepb/mvcc.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,6 @@ func (meta MVCCMetadata) IsInline() bool {
return meta.RawBytes != nil
}

// AddToIntentHistory adds the sequence and value to the intent history.
func (meta *MVCCMetadata) AddToIntentHistory(seq TxnSeq, val []byte) {
meta.IntentHistory = append(meta.IntentHistory,
MVCCMetadata_SequencedIntent{Sequence: seq, Value: val})
}

// GetPrevIntentSeq goes through the intent history and finds the previous
// intent's sequence number given the current sequence.
func (meta *MVCCMetadata) GetPrevIntentSeq(
Expand Down
Loading

0 comments on commit 9b84f56

Please sign in to comment.