rpuch commented on code in PR #3609:
URL: https://github.com/apache/ignite-3/pull/3609#discussion_r1567250183


##########
modules/storage-api/src/testFixtures/java/org/apache/ignite/internal/storage/AbstractMvTableStorageTest.java:
##########
@@ -324,6 +324,33 @@ public void testDestroyIndex(boolean waitForDestroyFuture) 
throws Exception {
         assertThat(tableStorage.getIndex(PARTITION_ID, hashIdx.id()), 
is(nullValue()));
     }
 
+    /**
+     * Tests that an attempt to destroy an index in a table storage that is 
already destroyed does not
+     * cause an exception.
+     */
+    @ParameterizedTest
+    @ValueSource(booleans = {false, true})
+    public void indexDestructionDoesNotFailIfTableStorageIsDestroyed(boolean 
waitForDestroyFuture) throws Exception {
+        MvPartitionStorage partitionStorage = 
getOrCreateMvPartition(PARTITION_ID);
+
+        SortedIndexStorage sortedIndexStorage = 
tableStorage.getOrCreateSortedIndex(PARTITION_ID, sortedIdx);
+        assertThat(sortedIndexStorage, is(notNullValue()));
+
+        HashIndexStorage hashIndexStorage = 
tableStorage.getOrCreateHashIndex(PARTITION_ID, hashIdx);
+        assertThat(hashIndexStorage, is(notNullValue()));
+
+        assertThat(partitionStorage.flush(), willCompleteSuccessfully());
+
+        CompletableFuture<Void> destroyTableStorageFuture = 
tableStorage.destroy();
+
+        if (waitForDestroyFuture) {
+            assertThat(destroyTableStorageFuture, willCompleteSuccessfully());
+        }
+
+        assertDoesNotThrow(() -> 
tableStorage.destroyIndex(sortedIdx.id()).get(10, SECONDS));

Review Comment:
   It passes basically immediately. I'm just very cautious to not fail the test 
due to a random GC pause, for example.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to