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/09/20 11:07:40 UTC

[GitHub] [accumulo] dlmarion commented on a diff in pull request #2937: Combine CleanZookeeper and DeleteZooInstance utilities

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


##########
server/base/src/main/java/org/apache/accumulo/server/util/DeleteZooInstance.java:
##########
@@ -21,53 +21,112 @@
 import static java.nio.charset.StandardCharsets.UTF_8;
 
 import java.util.HashSet;
+import java.util.List;
 import java.util.Objects;
 import java.util.Set;
 
 import org.apache.accumulo.core.Constants;
-import org.apache.accumulo.core.conf.SiteConfiguration;
 import org.apache.accumulo.fate.zookeeper.ZooReaderWriter;
+import org.apache.accumulo.fate.zookeeper.ZooUtil;
 import org.apache.accumulo.fate.zookeeper.ZooUtil.NodeMissingPolicy;
+import org.apache.accumulo.server.ServerContext;
 import org.apache.zookeeper.KeeperException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class DeleteZooInstance {
 
-  static void deleteRetry(ZooReaderWriter zk, String path) throws Exception {
-    for (int i = 0; i < 10; i++) {
-      try {
-        zk.recursiveDelete(path, NodeMissingPolicy.SKIP);
-        return;
-      } catch (KeeperException.NotEmptyException ex) {
-        // ignored
-      } catch (Exception ex) {
-        throw ex;
+  private static final Logger log = LoggerFactory.getLogger(DeleteZooInstance.class);
+
+  public static void execute(final ServerContext context, final boolean clean,
+      final String instance, final String auth) throws InterruptedException, KeeperException {
+
+    final ZooReaderWriter zk = context.getZooReaderWriter();
+    if (auth != null) {
+      ZooUtil.digestAuth(zk.getZooKeeper(), auth);
+    }
+
+    if (clean) {
+      // If clean is set to true thenn a specific instance should not be set

Review Comment:
   ```suggestion
         // If clean is set to true then a specific instance should not be set
   ```



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