From 45b7a800f081446b8b30186cca45df5c2d5eee06 Mon Sep 17 00:00:00 2001 From: Jackson Owens Date: Fri, 29 Mar 2024 11:03:23 -0400 Subject: [PATCH] sstable: strengthen assertion around mutual exclusion of seek optimizations 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. --- sstable/reader_iter_two_lvl.go | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/sstable/reader_iter_two_lvl.go b/sstable/reader_iter_two_lvl.go index a8e9485cf5..b9615f5c60 100644 --- a/sstable/reader_iter_two_lvl.go +++ b/sstable/reader_iter_two_lvl.go @@ -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()))