Skip to content

Commit

Permalink
sstable: strengthen assertion around mutual exclusion of seek optimiz…
Browse files Browse the repository at this point in the history
…ations

Previously an assertion that the TrySeekUsingNext and monotonic bounds
optimizations could not simultaneously be active was disabled due to the
TestIterRandomizedMaybeFilteredKeys test that could violate the invariant. The
test has been removed (along with the method it was testing), so we can
now uncondtionally restore the invariant.
  • Loading branch information
jbowens committed Apr 5, 2024
1 parent 5655486 commit 45b7a80
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions sstable/reader_iter_two_lvl.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,18 +310,9 @@ func (i *twoLevelIterator) SeekGE(
// i.topLevelIndex.Key().UserKey) <= 0, we are at the correct lower level
// index block. No need to reset the state of singleLevelIterator.
//
// Note that cases 1 and 2 never overlap, and one of them must be true,
// but we used to have some test code (TestIterRandomizedMaybeFilteredKeys)
// that set both to true, so we fix things here and then do an invariant
// check.
//
// Note that cases 1 and 2 never overlap, and one of them must be true.
// This invariant checking is important enough that we do not gate it
// behind invariants.Enabled.
if i.boundsCmp > 0 {
// TODO(sumeer): fix now that TestIterRandomizedMaybeFilteredKeys does
// nnot exist.
flags = flags.DisableTrySeekUsingNext()
}
if i.boundsCmp > 0 == flags.TrySeekUsingNext() {
panic(fmt.Sprintf("inconsistency in optimization case 1 %t and case 2 %t",
i.boundsCmp > 0, flags.TrySeekUsingNext()))
Expand Down

0 comments on commit 45b7a80

Please sign in to comment.