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



##########
File path: 
server/gc/src/main/java/org/apache/accumulo/gc/GarbageCollectionAlgorithm.java
##########
@@ -267,10 +267,10 @@ private void 
cleanUpDeletedTableDirs(GarbageCollectionEnvironment gce,
 
   }
 
-  private boolean getCandidates(GarbageCollectionEnvironment gce, String 
lastCandidate,
-      List<String> candidates) throws TableNotFoundException {
+  private Iterator<String> getCandidates(GarbageCollectionEnvironment gce)
+      throws TableNotFoundException, IOException {
     try (TraceScope candidatesSpan = Trace.startSpan("getCandidates")) {
-      return gce.getCandidates(lastCandidate, candidates);
+      return gce.getCandidates();
     }
   }

Review comment:
       This method doesn't make sense anymore. Since it's just returning an 
iterator and not actually doing all the fetching, tracing this operation isn't 
useful. The trace should be moved to wrap the retrieval of a batch.

##########
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);

Review comment:
       This line is what the `try (TraceScope candidatesSpan = 
Trace.startSpan("getCandidates")) {` should wrap.




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