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-3828 More attempted stabilization of ProxyITs
Date Fri, 22 May 2015 04:02:08 GMT
ACCUMULO-3828 More attempted stabilization of ProxyITs


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

Branch: refs/heads/master
Commit: 76547d41e930bbd6e56960707296b5dd708a55b1
Parents: 2eeaebb
Author: Josh Elser <elserj@apache.org>
Authored: Thu May 21 23:52:35 2015 -0400
Committer: Josh Elser <elserj@apache.org>
Committed: Fri May 22 00:01:51 2015 -0400

----------------------------------------------------------------------
 .../apache/accumulo/proxy/SimpleProxyBase.java  | 57 ++++++++++++++------
 1 file changed, 42 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/76547d41/test/src/test/java/org/apache/accumulo/proxy/SimpleProxyBase.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/proxy/SimpleProxyBase.java b/test/src/test/java/org/apache/accumulo/proxy/SimpleProxyBase.java
index cf2d3ab..efdc4f1 100644
--- a/test/src/test/java/org/apache/accumulo/proxy/SimpleProxyBase.java
+++ b/test/src/test/java/org/apache/accumulo/proxy/SimpleProxyBase.java
@@ -1121,17 +1121,30 @@ public abstract class SimpleProxyBase extends SharedMiniClusterIT
{
       Thread.sleep(2000);
     }
 
-    String batchWriter = client.createWriter(creds, table, writerOptions);
-    client.update(batchWriter, mutation("row1", "cf", "cq", "x"));
-    client.update(batchWriter, mutation("row1", "cf", "cq", "x"));
-    try {
-      client.flush(batchWriter);
-      fail("constraint did not fire");
-    } catch (MutationsRejectedException ex) {}
-    try {
-      client.closeWriter(batchWriter);
+    boolean success = false;
+    for (int i = 0; i < 5; i++) {
+      String batchWriter = client.createWriter(creds, table, writerOptions);
+      client.update(batchWriter, mutation("row1", "cf", "cq", "x"));
+      client.update(batchWriter, mutation("row1", "cf", "cq", "x"));
+      try {
+        client.flush(batchWriter);
+        log.debug("Constraint failed to fire. Waiting and retrying");
+        Thread.sleep(5000);
+        continue;
+      } catch (MutationsRejectedException ex) {}
+      try {
+        client.closeWriter(batchWriter);
+        log.debug("Constraint failed to fire. Waiting and retrying");
+        Thread.sleep(5000);
+        continue;
+      } catch (MutationsRejectedException e) {}
+      success = true;
+      break;
+    }
+
+    if (!success) {
       fail("constraint did not fire");
-    } catch (MutationsRejectedException e) {}
+    }
 
     client.removeConstraint(creds, table, 2);
 
@@ -1143,7 +1156,7 @@ public abstract class SimpleProxyBase extends SharedMiniClusterIT {
 
     assertScan(new String[][] {}, table);
 
-    UtilWaitThread.sleep(2000);
+    UtilWaitThread.sleep(ZOOKEEPER_PROPAGATION_TIME);
 
     writerOptions = new WriterOptions();
     writerOptions.setLatencyMs(10000);
@@ -1151,11 +1164,25 @@ public abstract class SimpleProxyBase extends SharedMiniClusterIT
{
     writerOptions.setThreads(1);
     writerOptions.setTimeoutMs(100000);
 
-    batchWriter = client.createWriter(creds, table, writerOptions);
+    success = false;
+    for (int i = 0; i < 5; i++) {
+      try {
+        String batchWriter = client.createWriter(creds, table, writerOptions);
+
+        client.update(batchWriter, mutation("row1", "cf", "cq", "x"));
+        client.flush(batchWriter);
+        client.closeWriter(batchWriter);
+        success = true;
+        break;
+      } catch (MutationsRejectedException e) {
+        log.info("Mutations were rejected, assuming constraint is still active", e);
+        Thread.sleep(5000);
+      }
+    }
 
-    client.update(batchWriter, mutation("row1", "cf", "cq", "x"));
-    client.flush(batchWriter);
-    client.closeWriter(batchWriter);
+    if (!success) {
+      fail("Failed to successfully write data after constraint was removed");
+    }
 
     assertScan(new String[][] {{"row1", "cf", "cq", "x"}}, table);
 


Mime
View raw message