diff --git a/minicluster/pom.xml b/minicluster/pom.xml index 50ca43cdc71..9904356bfff 100644 --- a/minicluster/pom.xml +++ b/minicluster/pom.xml @@ -96,10 +96,6 @@ org.apache.zookeeper zookeeper - - org.apache.zookeeper - zookeeper-jute - org.slf4j slf4j-api 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 86cec11696d..4eddb61c9e2 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.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.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 void failedToAcquireLock(Exception e) { 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); }