You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by mm...@apache.org on 2022/03/25 17:24:42 UTC

[accumulo] branch main updated: Make ZooZap keyword executable (#2591)

This is an automated email from the ASF dual-hosted git repository.

mmiller pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/main by this push:
     new 69c31d4  Make ZooZap keyword executable (#2591)
69c31d4 is described below

commit 69c31d48058e8fbf121ace69324f186ab56a4e70
Author: Mike Miller <mm...@apache.org>
AuthorDate: Fri Mar 25 13:24:35 2022 -0400

    Make ZooZap keyword executable (#2591)
---
 .../java/org/apache/accumulo/server/util/ZooZap.java   | 18 ++++++++++++++++--
 .../org/apache/accumulo/test/start/KeywordStartIT.java |  2 ++
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/ZooZap.java b/server/base/src/main/java/org/apache/accumulo/server/util/ZooZap.java
index e931d7a..6f6578e 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/util/ZooZap.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/ZooZap.java
@@ -33,6 +33,7 @@ import org.apache.accumulo.fate.zookeeper.ZooReaderWriter;
 import org.apache.accumulo.fate.zookeeper.ZooUtil.NodeMissingPolicy;
 import org.apache.accumulo.server.fs.VolumeManager;
 import org.apache.accumulo.server.security.SecurityUtil;
+import org.apache.accumulo.start.spi.KeywordExecutable;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Path;
 import org.apache.zookeeper.KeeperException;
@@ -41,8 +42,10 @@ import org.slf4j.LoggerFactory;
 
 import com.beust.jcommander.JCommander;
 import com.beust.jcommander.Parameter;
+import com.google.auto.service.AutoService;
 
-public class ZooZap {
+@AutoService(KeywordExecutable.class)
+public class ZooZap implements KeywordExecutable {
   private static final Logger log = LoggerFactory.getLogger(ZooZap.class);
 
   private static void message(String msg, Opts opts) {
@@ -51,6 +54,16 @@ public class ZooZap {
     }
   }
 
+  @Override
+  public String keyword() {
+    return "zoo-zap";
+  }
+
+  @Override
+  public String description() {
+    return "Utility for zapping Zookeeper locks";
+  }
+
   static class Opts extends Help {
     @Deprecated(since = "2.1.0")
     @Parameter(names = "-master",
@@ -69,7 +82,8 @@ public class ZooZap {
     boolean verbose = false;
   }
 
-  public static void main(String[] args) {
+  @Override
+  public void execute(String[] args) throws Exception {
     Opts opts = new Opts();
     opts.parseArgs(ZooZap.class.getName(), args);
 
diff --git a/test/src/main/java/org/apache/accumulo/test/start/KeywordStartIT.java b/test/src/main/java/org/apache/accumulo/test/start/KeywordStartIT.java
index 2e6d800..7ddd46c 100644
--- a/test/src/main/java/org/apache/accumulo/test/start/KeywordStartIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/start/KeywordStartIT.java
@@ -60,6 +60,7 @@ import org.apache.accumulo.server.util.ECAdmin;
 import org.apache.accumulo.server.util.Info;
 import org.apache.accumulo.server.util.LoginProperties;
 import org.apache.accumulo.server.util.ZooKeeperMain;
+import org.apache.accumulo.server.util.ZooZap;
 import org.apache.accumulo.shell.Shell;
 import org.apache.accumulo.start.Main;
 import org.apache.accumulo.start.spi.KeywordExecutable;
@@ -133,6 +134,7 @@ public class KeywordStartIT {
     expectSet.put("zookeeper", ZooKeeperMain.class);
     expectSet.put("create-empty", CreateEmpty.class);
     expectSet.put("split-large", SplitLarge.class);
+    expectSet.put("zoo-zap", ZooZap.class);
 
     Iterator<Entry<String,Class<? extends KeywordExecutable>>> expectIter =
         expectSet.entrySet().iterator();