You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2022/06/29 15:27:13 UTC

[GitHub] [accumulo] dlmarion commented on a diff in pull request #2792: closes #1377 - ensure all tables are checked ...

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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org