sashapolo commented on code in PR #3435:
URL: https://github.com/apache/ignite-3/pull/3435#discussion_r1530534629


##########
modules/storage-api/src/testFixtures/java/org/apache/ignite/internal/storage/AbstractMvTableStorageTest.java:
##########
@@ -314,6 +314,113 @@ public void testDestroyIndex(boolean 
waitForDestroyFuture) throws Exception {
         assertThat(tableStorage.getIndex(PARTITION_ID, hashIdx.id()), 
is(nullValue()));
     }
 
+    /**
+     * Tests that removing one Sorted Index does not affect the data in the 
other.
+     */
+    @Test
+    public void testDestroySortedIndexIndependence() {
+        CatalogTableDescriptor catalogTableDescriptor = 
catalogService.table(TABLE_NAME, clock.nowLong());
+
+        var catalogSortedIndex1 = new CatalogSortedIndexDescriptor(
+                200,
+                "TEST_INDEX_1",
+                catalogTableDescriptor.id(),
+                false,
+                AVAILABLE,
+                catalogService.latestCatalogVersion(),
+                List.of(new CatalogIndexColumnDescriptor("STRKEY", 
ASC_NULLS_LAST))
+        );
+
+        var catalogSortedIndex2 = new CatalogSortedIndexDescriptor(
+                201,
+                "TEST_INDEX_2",
+                catalogTableDescriptor.id(),
+                false,
+                AVAILABLE,
+                catalogService.latestCatalogVersion(),
+                List.of(new CatalogIndexColumnDescriptor("STRKEY", 
ASC_NULLS_LAST))
+        );
+
+        var sortedIndex1 = new 
StorageSortedIndexDescriptor(catalogTableDescriptor, catalogSortedIndex1);

Review Comment:
   Fixed



##########
modules/storage-api/src/testFixtures/java/org/apache/ignite/internal/storage/AbstractMvTableStorageTest.java:
##########
@@ -314,6 +314,113 @@ public void testDestroyIndex(boolean 
waitForDestroyFuture) throws Exception {
         assertThat(tableStorage.getIndex(PARTITION_ID, hashIdx.id()), 
is(nullValue()));
     }
 
+    /**
+     * Tests that removing one Sorted Index does not affect the data in the 
other.
+     */
+    @Test
+    public void testDestroySortedIndexIndependence() {
+        CatalogTableDescriptor catalogTableDescriptor = 
catalogService.table(TABLE_NAME, clock.nowLong());
+
+        var catalogSortedIndex1 = new CatalogSortedIndexDescriptor(
+                200,
+                "TEST_INDEX_1",
+                catalogTableDescriptor.id(),
+                false,
+                AVAILABLE,
+                catalogService.latestCatalogVersion(),
+                List.of(new CatalogIndexColumnDescriptor("STRKEY", 
ASC_NULLS_LAST))
+        );
+
+        var catalogSortedIndex2 = new CatalogSortedIndexDescriptor(
+                201,
+                "TEST_INDEX_2",
+                catalogTableDescriptor.id(),
+                false,
+                AVAILABLE,
+                catalogService.latestCatalogVersion(),
+                List.of(new CatalogIndexColumnDescriptor("STRKEY", 
ASC_NULLS_LAST))
+        );
+
+        var sortedIndex1 = new 
StorageSortedIndexDescriptor(catalogTableDescriptor, catalogSortedIndex1);
+        var sortedIndex2 = new 
StorageSortedIndexDescriptor(catalogTableDescriptor, catalogSortedIndex2);
+
+        MvPartitionStorage partitionStorage = 
getOrCreateMvPartition(PARTITION_ID);
+
+        SortedIndexStorage sortedIndexStorage1 = 
tableStorage.getOrCreateSortedIndex(PARTITION_ID, sortedIndex1);
+        SortedIndexStorage sortedIndexStorage2 = 
tableStorage.getOrCreateSortedIndex(PARTITION_ID, sortedIndex2);
+
+        List<TestRow> rows = List.of(
+                new TestRow(new RowId(PARTITION_ID), binaryRow(new TestKey(0, 
"0"), new TestValue(0, "0"))),
+                new TestRow(new RowId(PARTITION_ID), binaryRow(new TestKey(1, 
"1"), new TestValue(1, "1")))
+        );
+
+        fillStorages(partitionStorage, null, sortedIndexStorage1, rows);
+        fillStorages(partitionStorage, null, sortedIndexStorage2, rows);
+
+        checkForPresenceRows(null, null, sortedIndexStorage1, rows);
+        checkForPresenceRows(null, null, sortedIndexStorage2, rows);
+
+        assertThat(tableStorage.destroyIndex(sortedIndex1.id()), 
willCompleteSuccessfully());
+
+        assertThat(tableStorage.getIndex(PARTITION_ID, sortedIndex1.id()), 
is(nullValue()));
+
+        checkForPresenceRows(null, null, sortedIndexStorage2, rows);
+    }
+
+    /**
+     * Tests that removing one Hash Index does not affect the data in the 
other.
+     */
+    @Test
+    public void testDestroyHashIndexIndependence() {
+        CatalogTableDescriptor catalogTableDescriptor = 
catalogService.table(TABLE_NAME, clock.nowLong());
+
+        var catalogHashIndex1 = new CatalogHashIndexDescriptor(
+                200,
+                "TEST_INDEX_1",
+                catalogTableDescriptor.id(),
+                true,
+                AVAILABLE,
+                catalogService.latestCatalogVersion(),
+                List.of("STRKEY")
+        );
+
+        var catalogHashIndex2 = new CatalogHashIndexDescriptor(
+                201,
+                "TEST_INDEX_2",
+                catalogTableDescriptor.id(),
+                true,
+                AVAILABLE,
+                catalogService.latestCatalogVersion(),
+                List.of("STRKEY")
+        );
+
+        var hashIndex1 = new 
StorageHashIndexDescriptor(catalogTableDescriptor, catalogHashIndex1);

Review Comment:
   Fixed



-- 
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