keith-turner commented on a change in pull request #2214:
URL: https://github.com/apache/accumulo/pull/2214#discussion_r677507750



##########
File path: 
server/gc/src/main/java/org/apache/accumulo/gc/GarbageCollectionAlgorithm.java
##########
@@ -290,30 +290,26 @@ private void deleteConfirmed(GarbageCollectionEnvironment 
gce,
     cleanUpDeletedTableDirs(gce, candidateMap);
   }
 
-  public void collect(GarbageCollectionEnvironment gce) throws 
TableNotFoundException, IOException {
-
-    String lastCandidate = "";
-
-    boolean outOfMemory = true;
-    while (outOfMemory) {
-      List<String> candidates = new ArrayList<>();
+  /**
+   * Given a sub-list of possible delection candidates, process and remove 
valid deletion
+   * candidates.
+   */
+  public void collectBatch(GarbageCollectionEnvironment gce, List<String> 
currentBatch)
+      throws TableNotFoundException, IOException {
 
-      outOfMemory = getCandidates(gce, lastCandidate, candidates);
-
-      if (candidates.isEmpty())
-        break;
-      else
-        lastCandidate = candidates.get(candidates.size() - 1);
+    long origSize = currentBatch.size();
+    gce.incrementCandidatesStat(origSize);
 
-      long origSize = candidates.size();
-      gce.incrementCandidatesStat(origSize);
+    SortedMap<String,String> candidateMap = makeRelative(currentBatch);
 
-      SortedMap<String,String> candidateMap = makeRelative(candidates);
+    confirmDeletesTrace(gce, candidateMap);
+    gce.incrementInUseStat(origSize - candidateMap.size());
 
-      confirmDeletesTrace(gce, candidateMap);
-      gce.incrementInUseStat(origSize - candidateMap.size());
+    deleteConfirmed(gce, candidateMap);
+  }

Review comment:
       I suspect the ConcurrentModificationException occurs in the test.  I 
would suggest refactoring the test GCE so that this does not happen rather than 
the GCA.  The GarbageCollectionAlgorithm was designed to pull the logic of 
collection into a single place where it could be unit tested.  This change 
pushes some logic of collection into the GarbCollEnv, resulting in a need to 
change logic in the test which means the full algorithm is not being tested.




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