dlmarion commented on code in PR #2792:
URL: https://github.com/apache/accumulo/pull/2792#discussion_r910110142


##########
server/gc/src/main/java/org/apache/accumulo/gc/GCRun.java:
##########
@@ -457,4 +459,28 @@ public long getErrorsStat() {
   public long getCandidatesStat() {
     return candidates;
   }
+
+  @Override
+  public boolean isRootTable() {
+    return level == DataLevel.ROOT;
+  }
+
+  @Override
+  public boolean isMetadataTable() {
+    return level == DataLevel.METADATA;
+  }
+
+  @Override
+  public Set<TableId> getCandidateTableIDs() {
+    if (isRootTable()) {
+      return Collections.singleton(MetadataTable.ID);
+    } else if (isMetadataTable()) {
+      Set<TableId> tableIds = new HashSet<>(getTableIDs());

Review Comment:
   do you think this is a better implementation of `getTableIDs()`: 
   ```
     @Override
     public Set<TableId> getTableIDs() {
       final String tablesPath = context.getZooKeeperRoot() + Constants.ZTABLES;
       final ZooReader zr = context.getZooReader();
       final Set<TableId> tids = new HashSet<>();
       while (true) {
         try {
           zr.sync(tablesPath);
           zr.getChildren(tablesPath).forEach(t -> tids.add(TableId.of(t)));
           return tids;
         } catch (KeeperException | InterruptedException e) {
           log.error("Error getting tables from ZooKeeper, retrying", e);
           UtilWaitThread.sleepUninterruptibly(1, TimeUnit.SECONDS);
           continue;
         }
       }
     }
   ```



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