keith-turner commented on code in PR #2792:
URL: https://github.com/apache/accumulo/pull/2792#discussion_r975446459
##########
server/gc/src/test/java/org/apache/accumulo/gc/GarbageCollectionTest.java:
##########
@@ -122,6 +158,28 @@ public void incrementInUseStat(long i) {}
public Iterator<Entry<String,Status>> getReplicationNeededIterator() {
return filesToReplicate.entrySet().iterator();
}
+
+ @Override
+ public Set<TableId> getCandidateTableIDs() {
+ if (level == Ample.DataLevel.ROOT) {
+ return Set.of(RootTable.ID);
+ } else if (level == Ample.DataLevel.METADATA) {
+ return Collections.singleton(MetadataTable.ID);
+ } else if (level == Ample.DataLevel.USER) {
+ tableIds.remove(MetadataTable.ID);
+ tableIds.remove(RootTable.ID);
+ getTableIDs().forEach((k, v) -> {
+ if (v == TableState.ONLINE || v == TableState.OFFLINE) {
+ // Don't return tables that are NEW, DELETING, or in an
+ // UNKNOWN state.
+ tableIds.add(k);
+ }
+ });
+ return tableIds;
Review Comment:
It would be good to avoid modifying the instance var tableIds.
```suggestion
Set<TableId> tableIds = new HashSet<>();
getTableIDs().forEach((k, v) -> {
if (v == TableState.ONLINE || v == TableState.OFFLINE) {
// Don't return tables that are NEW, DELETING, or in an
// UNKNOWN state.
tableIds.add(k);
}
});
tableIds.remove(MetadataTable.ID);
tableIds.remove(RootTable.ID);
return tableIds;
```
--
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]