jmark99 commented on a change in pull request #2214:
URL: https://github.com/apache/accumulo/pull/2214#discussion_r677494725
##########
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'll take another look, but primarily I was following @keith-turner
format suggestion in the inital ticket. Since the call to Ample takes place in
the classes implementing the GarbageCollectionEnvironment code, the few short
lines seemed to belong in a single method. Not sure if better naming of methods
would clear things up.
Realistically the call to collect could be dropped altogether and just be
replaced by a call to processCandidates (since that is all it calls anyway). I
just kept it so the existing GC initial call would not be changed. Then the
GCA could have a public method called' processCandidates' (or maybe even
processDeletionCandidates). That seems clearer to me than using 'collect'.
Then the the collectBatch call does what is implies. It collects a batch of
potential deletion candidates and processes them. Maybe even get away from the
'collect' naming altogether and call it 'processBatch' or something similar.
--
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]