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


##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/StorageUpdateHandler.java:
##########
@@ -252,10 +254,34 @@ private void tryRemoveFromIndexes(BinaryRow rowToRemove, 
RowId rowId, Cursor<Rea
         }
     }
 
-    private void removeFromIndex(BinaryRow row, RowId rowId) {
-        for (TableSchemaAwareIndexStorage index : indexes.get().values()) {
-            index.remove(row, rowId);
-        }
+    /**
+     * Tries removing partition's oldest stale entry and its indexes.
+     *
+     * @param lowWatermark Low watermark for the vacuum.
+     */
+    public boolean vacuum(HybridTimestamp lowWatermark) {
+        return storage.runConsistently(() -> {
+            BinaryRowAndRowId vacuumed = storage.pollForVacuum(lowWatermark);
+
+            if (vacuumed == null) {
+                // Nothing was garbage collected.
+                return false;
+            }
+
+            BinaryRow binaryRow = vacuumed.binaryRow();
+
+            assert binaryRow != null;

Review Comment:
   It's interesting that if you add a test to 
`org.apache.ignite.internal.storage.AbstractMvPartitionStorageGcTest`, then 
everyone except `RocksDbMvPartitionStorageGcTest` will pass it, in general this 
is a possible situation.    
   ```
       @Test
       void testTombstone() {
           addAndCommit(null);
   
           addAndCommit(TABLE_ROW);
   
           addAndCommit(TABLE_ROW2);
   
           BinaryRowAndRowId row = pollForVacuum(HybridTimestamp.MAX_VALUE);
   
           assertNull(row.binaryRow());
       }
   ```



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