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

ctubbsii 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 139d850e85 Remove zookeeper-jute from minicluster (#5261)
139d850e85 is described below

commit 139d850e850277cfc0fd5e0da15abe1467b8fa5c
Author: Christopher Tubbs <[email protected]>
AuthorDate: Thu Jan 16 19:01:29 2025 -0500

    Remove zookeeper-jute from minicluster (#5261)
    
    Use ZooReaderWriter to do ZK updates in MiniAccumuloClusterImpl instead
    of requiring zookeeper-jute on the classpath (also makes the code
    shorter and more readable)
---
 minicluster/pom.xml                                        |  4 ----
 .../accumulo/miniclusterImpl/MiniAccumuloClusterImpl.java  | 14 ++++----------
 2 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/minicluster/pom.xml b/minicluster/pom.xml
index 50ca43cdc7..9904356bff 100644
--- a/minicluster/pom.xml
+++ b/minicluster/pom.xml
@@ -96,10 +96,6 @@
       <groupId>org.apache.zookeeper</groupId>
       <artifactId>zookeeper</artifactId>
     </dependency>
-    <dependency>
-      <groupId>org.apache.zookeeper</groupId>
-      <artifactId>zookeeper-jute</artifactId>
-    </dependency>
     <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-api</artifactId>
diff --git 
a/minicluster/src/main/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloClusterImpl.java
 
b/minicluster/src/main/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloClusterImpl.java
index 86cec11696..4eddb61c9e 100644
--- 
a/minicluster/src/main/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloClusterImpl.java
+++ 
b/minicluster/src/main/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloClusterImpl.java
@@ -81,7 +81,7 @@ import org.apache.accumulo.core.conf.SiteConfiguration;
 import org.apache.accumulo.core.data.InstanceId;
 import org.apache.accumulo.core.data.TableId;
 import org.apache.accumulo.core.fate.zookeeper.ZooReaderWriter;
-import org.apache.accumulo.core.fate.zookeeper.ZooUtil;
+import org.apache.accumulo.core.fate.zookeeper.ZooUtil.NodeExistsPolicy;
 import org.apache.accumulo.core.lock.ServiceLock;
 import org.apache.accumulo.core.lock.ServiceLock.AccumuloLockWatcher;
 import org.apache.accumulo.core.lock.ServiceLock.LockLossReason;
@@ -121,7 +121,6 @@ import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hdfs.DFSConfigKeys;
 import org.apache.hadoop.hdfs.MiniDFSCluster;
-import org.apache.zookeeper.CreateMode;
 import org.apache.zookeeper.KeeperException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -723,14 +722,9 @@ public class MiniAccumuloClusterImpl implements 
AccumuloCluster {
       String miniZDirPath =
           miniZInstancePath.substring(0, miniZInstancePath.indexOf("/" + 
miniUUID.toString()));
       try {
-        if (miniLockZk.exists(miniZDirPath, null) == null) {
-          miniLockZk.create(miniZDirPath, new byte[0], ZooUtil.PUBLIC, 
CreateMode.PERSISTENT);
-          log.info("Created: {}", miniZDirPath);
-        }
-        if (miniLockZk.exists(miniZInstancePath, null) == null) {
-          miniLockZk.create(miniZInstancePath, new byte[0], ZooUtil.PUBLIC, 
CreateMode.PERSISTENT);
-          log.info("Created: {}", miniZInstancePath);
-        }
+        var zrw = miniLockZk.asReaderWriter();
+        zrw.putPersistentData(miniZDirPath, new byte[0], 
NodeExistsPolicy.SKIP);
+        zrw.putPersistentData(miniZInstancePath, new byte[0], 
NodeExistsPolicy.SKIP);
       } catch (KeeperException | InterruptedException e) {
         throw new IllegalStateException("Error creating path in ZooKeeper", e);
       }

Reply via email to