Skip to content

Commit

Permalink
Remove zookeeper-jute from minicluster (apache#5261)
Browse files Browse the repository at this point in the history
Use ZooReaderWriter to do ZK updates in MiniAccumuloClusterImpl instead
of requiring zookeeper-jute on the classpath (also makes the code
shorter and more readable)
  • Loading branch information
ctubbsii authored Jan 17, 2025
1 parent 2a12b13 commit 139d850
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
4 changes: 0 additions & 4 deletions minicluster/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 139d850

Please sign in to comment.