Skip to content

Commit

Permalink
Merge pull request #99755 from cockroachdb/blathers/backport-release-…
Browse files Browse the repository at this point in the history
…23.1-99695

release-23.1: storage: CheckSSTConflicts: fix instance of iterator mismatch
  • Loading branch information
itsbilal authored Mar 28, 2023
2 parents 3551dc0 + 2503486 commit 71ab986
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/kv/kvserver/batcheval/cmd_add_sstable_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1083,6 +1083,12 @@ func TestEvalAddSSTable(t *testing.T) {
sst: kvs{pointKV("oe", 11, "foo"), pointKV("oih", 12, "foo"), rangeKV("ods", "ogvh", 10, ""), rangeKV("ogvh", "ohl", 10, ""), rangeKV("ogvh", "ohl", 9, "")},
ignoreExpect: true,
},
"DisallowConflict maintains ext iter ahead of sst iter": {
noConflict: true,
data: kvs{pointKV("c", 6, "foo"), rangeKV("c", "e", 5, "")},
sst: kvs{rangeKV("a", "b", 10, ""), pointKV("d", 9, "foo")},
ignoreExpect: true,
},
}
testutils.RunTrueAndFalse(t, "IngestAsWrites", func(t *testing.T, ingestAsWrites bool) {
testutils.RunValues(t, "RewriteConcurrency", []interface{}{0, 8}, func(t *testing.T, c interface{}) {
Expand Down
4 changes: 4 additions & 0 deletions pkg/storage/sst.go
Original file line number Diff line number Diff line change
Expand Up @@ -1137,6 +1137,10 @@ func CheckSSTConflicts(
if sstChangedKeys && !extChangedKeys {
sstIter.SeekGE(MVCCKey{Key: extIter.UnsafeKey().Key})
sstOK, sstErr = sstIter.Valid()
if sstOK && extIter.UnsafeKey().Key.Compare(sstIter.UnsafeKey().Key) < 0 {
extIter.SeekGE(MVCCKey{Key: sstIter.UnsafeKey().Key})
extOK, extErr = extIter.Valid()
}
}
// Re-seek the ext iterator if the ext iterator changed keys and:
// 1) the SST iterator did not change keys, and we need to bring the ext
Expand Down

0 comments on commit 71ab986

Please sign in to comment.