Skip to content

Commit

Permalink
Merge #71053
Browse files Browse the repository at this point in the history
71053: kvserver: QueryResolvedTimestamp should declare lock table keys r=shralex a=shralex

Release note: None

Co-authored-by: shralex <[email protected]>
  • Loading branch information
craig[bot] and shralex committed Oct 4, 2021
2 parents 95affc1 + e6dd076 commit 0dcfa15
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion pkg/kv/kvserver/replica_read.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"context"
"sync"

"github.com/cockroachdb/cockroach/pkg/keys"
"github.com/cockroachdb/cockroach/pkg/kv/kvserver/batcheval"
"github.com/cockroachdb/cockroach/pkg/kv/kvserver/batcheval/result"
"github.com/cockroachdb/cockroach/pkg/kv/kvserver/concurrency"
Expand Down Expand Up @@ -63,7 +64,18 @@ func (r *Replica) executeReadOnlyBatch(
panic("expected consistent iterators")
}
if util.RaceEnabled {
rw = spanset.NewReadWriterAt(rw, spans, ba.Timestamp)
// To account for direct access to separated intents in the lock table,
// add on corresponding lock table spans for all latches.
assertSpans := spans.Copy()
spans.Iterate(func(sa spanset.SpanAccess, _ spanset.SpanScope, span spanset.Span) {
ltKey, _ := keys.LockTableSingleKey(span.Key, nil)
var ltEndKey roachpb.Key
if span.EndKey != nil {
ltEndKey, _ = keys.LockTableSingleKey(span.EndKey, nil)
}
assertSpans.AddNonMVCC(sa, roachpb.Span{Key: ltKey, EndKey: ltEndKey})
})
rw = spanset.NewReadWriterAt(rw, assertSpans, ba.Timestamp)
}
defer rw.Close()

Expand Down

0 comments on commit 0dcfa15

Please sign in to comment.