You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by "meatballspaghetti (via GitHub)" <gi...@apache.org> on 2025/03/10 18:16:18 UTC

Re: [PR] Completed functionality for `admin check` command [accumulo]

meatballspaghetti commented on code in PR #5348:
URL: https://github.com/apache/accumulo/pull/5348#discussion_r1987799970


##########
server/base/src/main/java/org/apache/accumulo/server/util/checkCommand/SystemConfigCheckRunner.java:
##########
@@ -18,22 +18,205 @@
  */
 package org.apache.accumulo.server.util.checkCommand;
 
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.accumulo.core.Constants;
+import org.apache.accumulo.core.lock.ServiceLock;
+import org.apache.accumulo.core.metadata.AccumuloTable;
+import org.apache.accumulo.core.metadata.TServerInstance;
+import org.apache.accumulo.core.metadata.schema.TabletMetadata;
+import org.apache.accumulo.core.zookeeper.ZooSession;
 import org.apache.accumulo.server.ServerContext;
 import org.apache.accumulo.server.cli.ServerUtilOpts;
+import org.apache.accumulo.server.log.WalStateManager;
 import org.apache.accumulo.server.util.Admin;
 
 public class SystemConfigCheckRunner implements CheckRunner {
   private static final Admin.CheckCommand.Check check = Admin.CheckCommand.Check.SYSTEM_CONFIG;
 
+  public enum ServerProcess {
+    MANAGER, GC, TSERVER, COMPACTION_COORDINATOR, COMPACTOR, MONITOR, SCAN_SERVER
+  }
+
   @Override
   public Admin.CheckCommand.CheckStatus runCheck(ServerContext context, ServerUtilOpts opts,
       boolean fixFiles) throws Exception {
     Admin.CheckCommand.CheckStatus status = Admin.CheckCommand.CheckStatus.OK;
     printRunning();
+
+    log.trace("********** Checking validity of some ZooKeeper nodes **********");
+    status = checkZkNodes(context, status);
+
     printCompleted(status);
     return status;
   }
 
+  private static Admin.CheckCommand.CheckStatus checkZkNodes(ServerContext context,
+      Admin.CheckCommand.CheckStatus status) throws Exception {
+    status = checkZKLocks(context, status);
+    status = checkZKTableNodes(context, status);
+    status = checkZKWALsMetadata(context, status);
+
+    return status;
+  }
+
+  private static Admin.CheckCommand.CheckStatus checkZKLocks(ServerContext context,
+      Admin.CheckCommand.CheckStatus status) throws Exception {
+    final ServerProcess[] serverProcesses = ServerProcess.values();
+    final String zkRoot = context.getZooKeeperRoot();

Review Comment:
   Just noting now that if #5350 is merged before this PR, then the ZooKeeper root when using ServerContext will be moved to after `ZROOT+instanceId`. When that happens, the uses of `zkRoot` and `getZooKeeperRoot()` here will need to be omitted.
   
   You can disregard this if this PR happens to be merged before #5350 though.



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