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


##########
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);
+
+        verify(partitionStorage, 
never()).pollForVacuum(any(HybridTimestamp.class));
+
+        // Let's check that if lvm is greater than the safe time, then nothing 
will happen.
+        safeTimeTracker.update(new HybridTimestamp(10, 10));
+
+        storageUpdateHandler.executeBatchGc(new HybridTimestamp(11, 1));

Review Comment:
   Didn't understand you.



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