Skip to content

Commit

Permalink
Fix broken test testCommitOnCloseThrowsException_decRefStore (#10621)
Browse files Browse the repository at this point in the history
This test was incorrectly hardcoding a segment to delete to force corruption.
If a merge occurs randomly before segments are copied the expected segment did not exist failing the test.
This will now look for any .si and delete it.

Signed-off-by: Marc Handalian <handalm@amazon.com>
  • Loading branch information
mch2 committed Oct 13, 2023
1 parent daf1350 commit 53be8f3
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicLong;
Expand Down Expand Up @@ -591,7 +592,9 @@ public void testCommitOnCloseThrowsException_decRefStore() throws Exception {
indexOperations(nrtEngine, operations);
// wipe the nrt directory initially so we can sync with primary.
cleanAndCopySegmentsFromPrimary(nrtEngine);
nrtEngineStore.directory().deleteFile("_0.si");
final Optional<String> toDelete = Set.of(nrtEngineStore.directory().listAll()).stream().filter(f -> f.endsWith(".si")).findAny();
assertTrue(toDelete.isPresent());
nrtEngineStore.directory().deleteFile(toDelete.get());
assertEquals(2, nrtEngineStore.refCount());
nrtEngine.close();
assertEquals(1, nrtEngineStore.refCount());
Expand Down

0 comments on commit 53be8f3

Please sign in to comment.