You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by kt...@apache.org on 2013/11/07 04:13:38 UTC

git commit: ACCUMULO-1614 fixed bug in conditional writer random walk test.

Updated Branches:
  refs/heads/1.6.0-SNAPSHOT 7a83c145b -> 61a4298c6


ACCUMULO-1614 fixed bug in conditional writer random walk test.


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

Branch: refs/heads/1.6.0-SNAPSHOT
Commit: 61a4298c60c00bc9ae1db4ef02b5dca13f2f3c5b
Parents: 7a83c14
Author: Keith Turner <kt...@apache.org>
Authored: Wed Nov 6 22:13:03 2013 -0500
Committer: Keith Turner <kt...@apache.org>
Committed: Wed Nov 6 22:13:03 2013 -0500

----------------------------------------------------------------------
 .../core/client/impl/ConditionalWriterImpl.java         |  3 ++-
 .../accumulo/test/randomwalk/conditional/Transfer.java  | 12 +++++++++---
 2 files changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/61a4298c/core/src/main/java/org/apache/accumulo/core/client/impl/ConditionalWriterImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/ConditionalWriterImpl.java b/core/src/main/java/org/apache/accumulo/core/client/impl/ConditionalWriterImpl.java
index bb5987d..6b2a1cf 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/ConditionalWriterImpl.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ConditionalWriterImpl.java
@@ -380,7 +380,8 @@ class ConditionalWriterImpl implements ConditionalWriter {
       public void run() {
         List<QCMutation> mutations = new ArrayList<QCMutation>();
         failedMutations.drainTo(mutations);
-        queue(mutations);
+        if (mutations.size() > 0)
+          queue(mutations);
       }
     };
     

http://git-wip-us.apache.org/repos/asf/accumulo/blob/61a4298c/test/src/main/java/org/apache/accumulo/test/randomwalk/conditional/Transfer.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/conditional/Transfer.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/conditional/Transfer.java
index be4deb1..70aa3dd 100644
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/conditional/Transfer.java
+++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/conditional/Transfer.java
@@ -67,6 +67,8 @@ public class Transfer extends Test {
     String bank = Utils.getBank(rand.nextInt((Integer) state.get("numBanks")));
     String acct1 = Utils.getAccount(rand.nextInt(numAccts));
     String acct2 = Utils.getAccount(rand.nextInt(numAccts));
+    while (acct2.equals(acct1))
+      acct2 = Utils.getAccount(rand.nextInt(numAccts));
 
     // TODO document how data should be read when using ConditionalWriter
     Scanner scanner = new IsolatedScanner(conn.createScanner(table, Authorizations.EMPTY));
@@ -85,19 +87,23 @@ public class Transfer extends Test {
 
       if (cf.equals(acct1))
         a = a1;
-      else
+      else if (cf.equals(acct2))
         a = a2;
+      else
+        throw new Exception("Unexpected column fam: " + cf);
 
       if (cq.equals("bal"))
         a.setBal(entry.getValue().toString());
-      else
+      else if (cq.equals("seq"))
         a.setSeq(entry.getValue().toString());
+      else
+        throw new Exception("Unexpected column qual: " + cq);
     }
 
 
     int amt = rand.nextInt(50);
 
-    log.debug("transfer req " + bank + " " + amt + " " + a1 + " " + a2);
+    log.debug("transfer req " + bank + " " + amt + " " + acct1 + " " + a1 + " " + acct2 + " " + a2);
 
     if (a1.bal >= amt) {
       ConditionalMutation cm = new ConditionalMutation(bank, new Condition(acct1, "seq").setValue(Utils.getSeq(a1.seq)),