accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [2/3] accumulo git commit: ACCUMULO-4425 Fix VolumeIT.testDirtyReplaceVolumes
Date Sun, 28 Aug 2016 22:32:24 GMT
ACCUMULO-4425 Fix VolumeIT.testDirtyReplaceVolumes

Retry checking WAL state information in ZooKeeper until it stabilizes,
or until the test times out. Handle the case where the ZK node is
removed underneath the WalStateManager and the case where the state
hasn't yet been updated by the time the test checks it.

Closes apache/accumulo#142

Signed-off-by: Josh Elser <elserj@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/60279978
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/60279978
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/60279978

Branch: refs/heads/master
Commit: 602799787470c9d2d8524242889ea59f12e50581
Parents: e68b8db
Author: Christopher Tubbs <ctubbsii@apache.org>
Authored: Fri Aug 26 19:22:42 2016 -0400
Committer: Josh Elser <elserj@apache.org>
Committed: Sun Aug 28 16:43:28 2016 -0400

----------------------------------------------------------------------
 .../java/org/apache/accumulo/test/VolumeIT.java | 32 +++++++++++++++-----
 1 file changed, 24 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/60279978/test/src/main/java/org/apache/accumulo/test/VolumeIT.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/VolumeIT.java b/test/src/main/java/org/apache/accumulo/test/VolumeIT.java
index f9a6a326..2b02541 100644
--- a/test/src/main/java/org/apache/accumulo/test/VolumeIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/VolumeIT.java
@@ -67,6 +67,7 @@ import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl;
 import org.apache.accumulo.server.ServerConstants;
 import org.apache.accumulo.server.init.Initialize;
 import org.apache.accumulo.server.log.WalStateManager;
+import org.apache.accumulo.server.log.WalStateManager.WalMarkerException;
 import org.apache.accumulo.server.log.WalStateManager.WalState;
 import org.apache.accumulo.server.util.Admin;
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
@@ -77,6 +78,7 @@ import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.fs.RawLocalFileSystem;
 import org.apache.hadoop.io.Text;
+import org.apache.zookeeper.KeeperException.NoNodeException;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -429,16 +431,30 @@ public class VolumeIT extends ConfigurableMacBase {
       Assert.fail("Unexpected volume " + path);
     }
 
-    Instance i = conn.getInstance();
-    ZooReaderWriter zk = new ZooReaderWriter(i.getZooKeepers(), i.getZooKeepersSessionTimeOut(),
"");
-    WalStateManager wals = new WalStateManager(i, zk);
-    outer: for (Entry<Path,WalState> entry : wals.getAllState().entrySet()) {
-      for (Path path : paths) {
-        if (entry.getKey().toString().startsWith(path.toString())) {
-          continue outer;
+    // keep retrying until WAL state information in ZooKeeper stabilizes or until test times
out
+    retry: while (true) {
+      Instance i = conn.getInstance();
+      ZooReaderWriter zk = new ZooReaderWriter(i.getZooKeepers(), i.getZooKeepersSessionTimeOut(),
"");
+      WalStateManager wals = new WalStateManager(i, zk);
+      try {
+        outer: for (Entry<Path,WalState> entry : wals.getAllState().entrySet()) {
+          for (Path path : paths) {
+            if (entry.getKey().toString().startsWith(path.toString())) {
+              continue outer;
+            }
+          }
+          log.warn("Unexpected volume " + entry.getKey() + " (" + entry.getValue() + ")");
+          continue retry;
+        }
+      } catch (WalMarkerException e) {
+        Throwable cause = e.getCause();
+        if (cause instanceof NoNodeException) {
+          // ignore WALs being cleaned up
+          continue retry;
         }
+        throw e;
       }
-      Assert.fail("Unexpected volume " + entry.getKey());
+      break;
     }
 
     // if a volume is chosen randomly for each tablet, then the probability that a volume
will not be chosen for any tablet is ((num_volumes -


Mime
View raw message