sashapolo commented on code in PR #2126:
URL: https://github.com/apache/ignite-3/pull/2126#discussion_r1214252558
##########
modules/table/src/test/java/org/apache/ignite/internal/table/distributed/gc/GcUpdateHandlerTest.java:
##########
@@ -55,20 +56,54 @@ void testVacuum() {
HybridTimestamp lowWatermark = new HybridTimestamp(100, 100);
- assertFalse(gcUpdateHandler.vacuum(lowWatermark));
- verify(partitionStorage).pollForVacuum(lowWatermark);
+ assertFalse(gcUpdateHandler.vacuumBatch(lowWatermark, 1));
+ verify(partitionStorage).peek(lowWatermark);
// Let's check that StorageUpdateHandler#vacuumBatch returns true.
clearInvocations(partitionStorage);
- BinaryRowAndRowId binaryRowAndRowId = new
BinaryRowAndRowId(mock(BinaryRow.class), new RowId(PARTITION_ID));
+ RowId rowId = new RowId(PARTITION_ID);
+
+ GcEntry gcEntry = new GcEntryImpl(rowId, lowWatermark);
+ BinaryRow binaryRow = mock(BinaryRow.class);
when(partitionStorage.scanVersions(any(RowId.class))).thenReturn(emptyCursor());
-
when(partitionStorage.pollForVacuum(lowWatermark)).thenReturn(binaryRowAndRowId);
+ when(partitionStorage.peek(lowWatermark)).thenReturn(gcEntry);
+ when(partitionStorage.vacuum(gcEntry)).thenReturn(binaryRow);
- assertTrue(gcUpdateHandler.vacuum(lowWatermark));
- verify(partitionStorage).pollForVacuum(lowWatermark);
-
verify(indexUpdateHandler).tryRemoveFromIndexes(binaryRowAndRowId.binaryRow(),
binaryRowAndRowId.rowId(), emptyCursor());
+ assertTrue(gcUpdateHandler.vacuumBatch(lowWatermark, 1));
+ verify(partitionStorage).peek(lowWatermark);
+ verify(indexUpdateHandler).tryRemoveFromIndexes(binaryRow, rowId,
emptyCursor());
+ }
+
+ @Test
+ void testVacuumBatch() {
+ PartitionDataStorage partitionStorage = createPartitionDataStorage();
+
+ IndexUpdateHandler indexUpdateHandler = spy(new
IndexUpdateHandler(mock(TableIndexStoragesSupplier.class)));
+
+ GcUpdateHandler gcUpdateHandler =
createGcUpdateHandler(partitionStorage, indexUpdateHandler);
+
+ HybridTimestamp lowWatermark = new HybridTimestamp(100, 100);
+
+ RowId rowId0 = new RowId(PARTITION_ID);
+ RowId rowId1 = new RowId(PARTITION_ID);
+
+ BinaryRow binaryRow0 = mock(BinaryRow.class);
+ BinaryRow binaryRow1 = mock(BinaryRow.class);
+
+ GcEntry gcEntry0 = new GcEntryImpl(rowId0, lowWatermark);
+ GcEntry gcEntry1 = new GcEntryImpl(rowId1, lowWatermark);
+
+
when(partitionStorage.peek(lowWatermark)).thenReturn(gcEntry0).thenReturn(gcEntry1);
+ when(partitionStorage.vacuum(gcEntry0)).thenReturn(binaryRow0);
+ when(partitionStorage.vacuum(gcEntry1)).thenReturn(binaryRow1);
+
+ assertTrue(gcUpdateHandler.vacuumBatch(lowWatermark, 2));
Review Comment:
I'd use a larger batch size here, to check that we don't fall out of bounds
--
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]