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/07/19 12:32:37 UTC

[accumulo] branch main updated: Updating DumpZookeeper utility to extend KeywordExecutable (#2807) (#2813)

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 ba049d5f10 Updating DumpZookeeper utility to extend KeywordExecutable (#2807) (#2813)
ba049d5f10 is described below

commit ba049d5f10880d722453668bb3112b7d012db3e4
Author: Christopher L. Shannon <ch...@gmail.com>
AuthorDate: Tue Jul 19 08:32:33 2022 -0400

    Updating DumpZookeeper utility to extend KeywordExecutable (#2807) (#2813)
---
 .../apache/accumulo/server/util/DumpZookeeper.java | 22 ++++++++++++++++++++--
 .../apache/accumulo/test/start/KeywordStartIT.java |  3 +++
 2 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/DumpZookeeper.java b/server/base/src/main/java/org/apache/accumulo/server/util/DumpZookeeper.java
index 9a1907ab40..f3e92bd8e4 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/util/DumpZookeeper.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/DumpZookeeper.java
@@ -25,15 +25,28 @@ import java.util.Base64;
 
 import org.apache.accumulo.core.cli.ConfigOpts;
 import org.apache.accumulo.fate.zookeeper.ZooReaderWriter;
+import org.apache.accumulo.start.spi.KeywordExecutable;
 import org.apache.zookeeper.KeeperException;
 import org.apache.zookeeper.data.Stat;
 
 import com.beust.jcommander.Parameter;
+import com.google.auto.service.AutoService;
 
-public class DumpZookeeper {
+@AutoService(KeywordExecutable.class)
+public class DumpZookeeper implements KeywordExecutable {
 
   private static ZooReaderWriter zk = null;
 
+  @Override
+  public String keyword() {
+    return "dump-zoo";
+  }
+
+  @Override
+  public String description() {
+    return "Writes Zookeeper data as human readable or XML to a file.";
+  }
+
   private static class Encoded {
     public String encoding;
     public String value;
@@ -53,7 +66,8 @@ public class DumpZookeeper {
     boolean xml = false;
   }
 
-  public static void main(String[] args) throws KeeperException, InterruptedException {
+  @Override
+  public void execute(String[] args) throws KeeperException, InterruptedException {
     Opts opts = new Opts();
     opts.parseArgs(DumpZookeeper.class.getName(), args);
 
@@ -66,6 +80,10 @@ public class DumpZookeeper {
     }
   }
 
+  public static void main(String[] args) throws KeeperException, InterruptedException {
+    new DumpZookeeper().execute(args);
+  }
+
   private static void writeXml(PrintStream out, String root)
       throws KeeperException, InterruptedException {
     write(out, 0, "<dump root='%s'>", root);
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 60f9405032..c58b7a6008 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
@@ -57,6 +57,7 @@ import org.apache.accumulo.server.conf.util.ConfigPropertyUpgrader;
 import org.apache.accumulo.server.init.Initialize;
 import org.apache.accumulo.server.util.Admin;
 import org.apache.accumulo.server.util.ConvertConfig;
+import org.apache.accumulo.server.util.DumpZookeeper;
 import org.apache.accumulo.server.util.ECAdmin;
 import org.apache.accumulo.server.util.Info;
 import org.apache.accumulo.server.util.LoginProperties;
@@ -123,6 +124,7 @@ public class KeywordStartIT {
     expectSet.put("config-upgrade", ConfigPropertyUpgrader.class);
     expectSet.put("convert-config", ConvertConfig.class);
     expectSet.put("create-token", CreateToken.class);
+    expectSet.put("dump-zoo", DumpZookeeper.class);
     expectSet.put("ec-admin", ECAdmin.class);
     expectSet.put("gc", GCExecutable.class);
     expectSet.put("generate-splits", GenerateSplits.class);
@@ -183,6 +185,7 @@ public class KeywordStartIT {
     expectSet.add(Admin.class);
     expectSet.add(CheckCompactionConfig.class);
     expectSet.add(CreateToken.class);
+    expectSet.add(DumpZookeeper.class);
     expectSet.add(Info.class);
     expectSet.add(Initialize.class);
     expectSet.add(LoginProperties.class);