You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "tkalkirill (via GitHub)" <gi...@apache.org> on 2023/06/02 06:58:48 UTC

[GitHub] [ignite-3] tkalkirill commented on a diff in pull request #2126: IGNITE-19367 Remove MvPartitionStorage#pollForVacuum

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


##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/gc/GcUpdateHandler.java:
##########
@@ -65,56 +65,59 @@ public PendingComparableValuesTracker<HybridTimestamp, Void> getSafeTimeTracker(
 
     /**
      * Tries removing {@code count} oldest stale entries and their indexes.
-     * If there's less entries that can be removed, then exits prematurely.
+     * If there are fewer rows than the {@code count}, or it was not possible to lock any, then exits prematurely.
      *
      * @param lowWatermark Low watermark for the vacuum.
      * @param count Count of entries to GC.
+     * @return {@code False} if there is no garbage left in the storage.
      */
-    public void vacuumBatch(HybridTimestamp lowWatermark, int count) {
-        for (int i = 0; i < count; i++) {
-            if (!storage.runConsistently(locker -> internalVacuum(lowWatermark))) {
-                break;
+    public boolean vacuumBatch(HybridTimestamp lowWatermark, int count) {
+        return storage.runConsistently(locker -> {
+            for (int i = 0; i < count; i++) {
+                if (!internalVacuum(lowWatermark, locker)) {
+                    return false;
+                }
             }
-        }
-    }
 
-    /**
-     * Tries removing partition's oldest stale entry and its indexes.
-     *
-     * @param lowWatermark Low watermark for the vacuum.
-     * @return {@code true} if an entry was garbage collected, {@code false} if there was nothing to collect.
-     * @see MvPartitionStorage#pollForVacuum(HybridTimestamp)
-     */
-    public boolean vacuum(HybridTimestamp lowWatermark) {
-        return storage.runConsistently(locker -> internalVacuum(lowWatermark));
+            return true;
+        });
     }
 
     /**
-     * Executes garbage collection.
+     * Attempts to collect garbage for one {@link RowId}, if it fails to lock it, then immediately breaks.

Review Comment:
   fix it



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org