Return-Path: X-Original-To: apmail-accumulo-commits-archive@www.apache.org Delivered-To: apmail-accumulo-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0A727183F6 for ; Wed, 27 May 2015 20:54:47 +0000 (UTC) Received: (qmail 44333 invoked by uid 500); 27 May 2015 20:54:47 -0000 Delivered-To: apmail-accumulo-commits-archive@accumulo.apache.org Received: (qmail 44294 invoked by uid 500); 27 May 2015 20:54:46 -0000 Mailing-List: contact commits-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@accumulo.apache.org Delivered-To: mailing list commits@accumulo.apache.org Received: (qmail 44276 invoked by uid 99); 27 May 2015 20:54:46 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 May 2015 20:54:46 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id B6936E0777; Wed, 27 May 2015 20:54:46 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: elserj@apache.org To: commits@accumulo.apache.org Date: Wed, 27 May 2015 20:54:48 -0000 Message-Id: <8bd0486e35534995be1ddbc09ff1458c@git.apache.org> In-Reply-To: <65132b74f242422799f3775626a01a7a@git.apache.org> References: <65132b74f242422799f3775626a01a7a@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [3/5] accumulo git commit: ACCUMULO-3828 Yet-Another-Constraint-Fix for proxy integration tests ACCUMULO-3828 Yet-Another-Constraint-Fix for proxy integration tests Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/7bd66343 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/7bd66343 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/7bd66343 Branch: refs/heads/master Commit: 7bd66343a4d56d9199ad02727359476394f8f3b0 Parents: b477dbc Author: Josh Elser Authored: Wed May 27 16:44:38 2015 -0400 Committer: Josh Elser Committed: Wed May 27 16:49:17 2015 -0400 ---------------------------------------------------------------------- .../apache/accumulo/proxy/SimpleProxyBase.java | 32 ++++++++++++++------ 1 file changed, 23 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/7bd66343/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 efdc4f1..1e071df 100644 --- a/test/src/test/java/org/apache/accumulo/proxy/SimpleProxyBase.java +++ b/test/src/test/java/org/apache/accumulo/proxy/SimpleProxyBase.java @@ -1122,7 +1122,7 @@ public abstract class SimpleProxyBase extends SharedMiniClusterIT { } boolean success = false; - for (int i = 0; i < 5; i++) { + for (int i = 0; i < 15; i++) { String batchWriter = client.createWriter(creds, table, writerOptions); client.update(batchWriter, mutation("row1", "cf", "cq", "x")); client.update(batchWriter, mutation("row1", "cf", "cq", "x")); @@ -1165,7 +1165,7 @@ public abstract class SimpleProxyBase extends SharedMiniClusterIT { writerOptions.setTimeoutMs(100000); success = false; - for (int i = 0; i < 5; i++) { + for (int i = 0; i < 15; i++) { try { String batchWriter = client.createWriter(creds, table, writerOptions); @@ -1658,15 +1658,29 @@ public abstract class SimpleProxyBase extends SharedMiniClusterIT { assertScan(new String[][] { {"00345", "data", "img", "1234567890"}, {"00345", "meta", "seq", "3"}, {"00346", "meta", "seq", "1"}, {"00347", "data", "count", "1"}, {"00347", "data", "img", "1234567890"}}, table); - // test a mutation that violated a constraint - updates.clear(); - updates.put(s2bb("00347"), - new ConditionalUpdates(Arrays.asList(newCondition("data", "img", "1234567890")), Arrays.asList(newColUpdate("data", "count", "A")))); + ConditionalStatus status = null; + for (int i = 0; i < 20; i++) { + // test a mutation that violated a constraint + updates.clear(); + updates.put(s2bb("00347"), + new ConditionalUpdates(Arrays.asList(newCondition("data", "img", "1234567890")), Arrays.asList(newColUpdate("data", "count", "A")))); - results = client.updateRowsConditionally(cwid, updates); + results = client.updateRowsConditionally(cwid, updates); - assertEquals(1, results.size()); - assertEquals(ConditionalStatus.VIOLATED, results.get(s2bb("00347"))); + assertEquals(1, results.size()); + status = results.get(s2bb("00347")); + if (ConditionalStatus.VIOLATED != status) { + log.info("ConditionalUpdate was not rejected by server due to table constraint. Sleeping and retrying"); + Thread.sleep(3000); + continue; + } + + assertEquals(ConditionalStatus.VIOLATED, status); + break; + } + + // Final check to make sure we succeeded and didn't exceed the retries + assertEquals(ConditionalStatus.VIOLATED, status); assertScan(new String[][] { {"00345", "data", "img", "1234567890"}, {"00345", "meta", "seq", "3"}, {"00346", "meta", "seq", "1"}, {"00347", "data", "count", "1"}, {"00347", "data", "img", "1234567890"}}, table);