milleruntime commented on a change in pull request #2214:
URL: https://github.com/apache/accumulo/pull/2214#discussion_r678219389



##########
File path: 
server/gc/src/main/java/org/apache/accumulo/gc/GarbageCollectionAlgorithm.java
##########
@@ -292,28 +292,29 @@ private void deleteConfirmed(GarbageCollectionEnvironment 
gce,
 
   public void collect(GarbageCollectionEnvironment gce) throws 
TableNotFoundException, IOException {
 
-    String lastCandidate = "";
+    Iterator<String> candidatesIter = getCandidates(gce);
 
-    boolean outOfMemory = true;
-    while (outOfMemory) {
-      List<String> candidates = new ArrayList<>();
-
-      outOfMemory = getCandidates(gce, lastCandidate, candidates);
+    while (candidatesIter.hasNext()) {
+      List<String> batchOfCandidates = 
gce.readCandidatesThatFitInMemory(candidatesIter);
+      collectBatch(gce, batchOfCandidates);
+    }
+  }
 
-      if (candidates.isEmpty())
-        break;
-      else
-        lastCandidate = candidates.get(candidates.size() - 1);
+  /**
+   * Given a sub-list of possible deletion candidates, process and remove 
valid deletion candidates.
+   */
+  private void collectBatch(GarbageCollectionEnvironment gce, List<String> 
currentBatch)

Review comment:
       Could call this method `deleteBatch` since it doesn't do any collecting. 
That makes more sense to me since you already have the top level `collect()` 
method for the overall garbage collection.




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