You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by dl...@apache.org on 2022/09/23 12:46:22 UTC
[accumulo] branch main updated: Wait for ZooKeeper sync call to complete in verifyUp (#2953)
This is an automated email from the ASF dual-hosted git repository.
dlmarion 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 e12f013de6 Wait for ZooKeeper sync call to complete in verifyUp (#2953)
e12f013de6 is described below
commit e12f013de6581355fead5d28bd7788d5c8474c68
Author: Dave Marion <dl...@apache.org>
AuthorDate: Fri Sep 23 08:46:17 2022 -0400
Wait for ZooKeeper sync call to complete in verifyUp (#2953)
---
.../accumulo/miniclusterImpl/MiniAccumuloClusterImpl.java | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
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 15b674f913..63ec64193e 100644
--- a/minicluster/src/main/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloClusterImpl.java
+++ b/minicluster/src/main/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloClusterImpl.java
@@ -46,12 +46,14 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
import java.util.Set;
+import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.FutureTask;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
+import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Function;
import java.util.function.Supplier;
@@ -99,6 +101,7 @@ import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hdfs.DFSConfigKeys;
import org.apache.hadoop.hdfs.MiniDFSCluster;
import org.apache.zookeeper.KeeperException;
+import org.apache.zookeeper.KeeperException.Code;
import org.apache.zookeeper.ZKUtil;
import org.apache.zookeeper.ZooKeeper;
import org.apache.zookeeper.ZooKeeper.States;
@@ -663,7 +666,17 @@ public class MiniAccumuloClusterImpl implements AccumuloCluster {
if (zk.getState() == States.CONNECTED) {
ZooUtil.digestAuth(zk, secret);
try {
- zk.sync("/", null, null);
+ final AtomicInteger rc = new AtomicInteger();
+ final CountDownLatch waiter = new CountDownLatch(1);
+ zk.sync("/", (code, arg1, arg2) -> {
+ rc.set(code);
+ waiter.countDown();
+ }, null);
+ waiter.await();
+ Code code = Code.get(rc.get());
+ if (code != Code.OK) {
+ throw KeeperException.create(code);
+ }
String instanceNamePath =
Constants.ZROOT + Constants.ZINSTANCES + "/" + config.getInstanceName();
byte[] bytes = zk.getData(instanceNamePath, null, null);