ibessonov commented on code in PR #1952:
URL: https://github.com/apache/ignite-3/pull/1952#discussion_r1182171704


##########
modules/table/src/test/java/org/apache/ignite/internal/table/distributed/StorageUpdateHandlerTest.java:
##########
@@ -104,6 +118,56 @@ void testBuildIndex() {
         verify(indexes, times(2)).addIndexToWaitIfAbsent(indexId);
     }
 
+    @Test
+    void testVacuum() {
+        PartitionDataStorage partitionStorage = createPartitionDataStorage();
+
+        StorageUpdateHandler storageUpdateHandler = 
createStorageUpdateHandler(partitionStorage, 
mock(TableIndexStoragesSupplier.class));
+
+        HybridTimestamp lowWatermark = new HybridTimestamp(100, 100);
+
+        assertFalse(storageUpdateHandler.vacuum(lowWatermark));
+        verify(partitionStorage).pollForVacuum(lowWatermark);
+        // Let's check that StorageUpdateHandler#vacuumBatch returns true.
+        clearInvocations(partitionStorage);
+
+        BinaryRowAndRowId binaryRowAndRowId = new 
BinaryRowAndRowId(mock(BinaryRow.class), new RowId(PARTITION_ID));
+
+        
when(partitionStorage.scanVersions(any(RowId.class))).thenReturn(CursorUtils.emptyCursor());
+        
when(partitionStorage.pollForVacuum(lowWatermark)).thenReturn(binaryRowAndRowId);
+
+        assertTrue(storageUpdateHandler.vacuum(lowWatermark));
+        verify(partitionStorage).pollForVacuum(lowWatermark);
+    }
+
+    @Test
+    void testExecuteBatchGc() {
+        PartitionDataStorage partitionStorage = createPartitionDataStorage();
+
+        StorageUpdateHandler storageUpdateHandler = 
createStorageUpdateHandler(partitionStorage, 
mock(TableIndexStoragesSupplier.class));
+
+        // Let's check that if lwm is {@code null} then nothing will happen.
+        storageUpdateHandler.executeBatchGc(null);

Review Comment:
   We can use the lowest timestamp possible, like every other component in the 
system, such partitions or meta-storage with their safe-times. Why would you 
introduce null where non-null value would work just fine?



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