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 2E79611373 for ; Fri, 19 Sep 2014 00:38:15 +0000 (UTC) Received: (qmail 17194 invoked by uid 500); 19 Sep 2014 00:38:14 -0000 Delivered-To: apmail-accumulo-commits-archive@accumulo.apache.org Received: (qmail 17081 invoked by uid 500); 19 Sep 2014 00:38:14 -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 16992 invoked by uid 99); 19 Sep 2014 00:38:14 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 19 Sep 2014 00:38:14 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id DF44BA1C7F9; Fri, 19 Sep 2014 00:38:13 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: cjnolet@apache.org To: commits@accumulo.apache.org Date: Fri, 19 Sep 2014 00:38:16 -0000 Message-Id: <2e3b3f0a62d545579fc2ac2460dcb7da@git.apache.org> In-Reply-To: <6a52d7f53a2848f585ca220cb7c34efc@git.apache.org> References: <6a52d7f53a2848f585ca220cb7c34efc@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [4/6] git commit: ACCUMULO-3146 Try to stabilize BalanceAfterCommsFailureIT and SimpleBalancerFairnessIT ACCUMULO-3146 Try to stabilize BalanceAfterCommsFailureIT and SimpleBalancerFairnessIT Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/7a40f7bf Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/7a40f7bf Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/7a40f7bf Branch: refs/heads/1.6.1-rc1 Commit: 7a40f7bfa4c6e30467a24105da974687ac442cdf Parents: 992414e Author: Josh Elser Authored: Thu Sep 18 18:12:12 2014 -0400 Committer: Josh Elser Committed: Thu Sep 18 18:12:12 2014 -0400 ---------------------------------------------------------------------- .../functional/BalanceAfterCommsFailureIT.java | 30 +++++++++---- .../functional/SimpleBalancerFairnessIT.java | 44 ++++++++++++++------ 2 files changed, 53 insertions(+), 21 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/7a40f7bf/test/src/test/java/org/apache/accumulo/test/functional/BalanceAfterCommsFailureIT.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/test/functional/BalanceAfterCommsFailureIT.java b/test/src/test/java/org/apache/accumulo/test/functional/BalanceAfterCommsFailureIT.java index 39e7e70..7b4a774 100644 --- a/test/src/test/java/org/apache/accumulo/test/functional/BalanceAfterCommsFailureIT.java +++ b/test/src/test/java/org/apache/accumulo/test/functional/BalanceAfterCommsFailureIT.java @@ -92,22 +92,33 @@ public class BalanceAfterCommsFailureIT extends ConfigurableMacIT { c.tableOperations().addSplits("test", splits); // Ensure all of the tablets are actually assigned assertEquals(0, Iterables.size(c.createScanner("test", Authorizations.EMPTY))); - UtilWaitThread.sleep(10 * 1000); + UtilWaitThread.sleep(30 * 1000); checkBalance(c); } private void checkBalance(Connector c) throws Exception { Credentials creds = new Credentials("root", new PasswordToken(ROOT_PASSWORD)); - MasterClientService.Iface client = null; MasterMonitorInfo stats = null; - try { - client = MasterClient.getConnectionWithRetry(c.getInstance()); - stats = client.getMasterStats(Tracer.traceInfo(), creds.toThrift(c.getInstance())); - } finally { - if (client != null) - MasterClient.close(client); + int unassignedTablets = 1; + for (int i = 0; unassignedTablets > 0 && i < 10; i++) { + MasterClientService.Iface client = null; + try { + client = MasterClient.getConnectionWithRetry(c.getInstance()); + stats = client.getMasterStats(Tracer.traceInfo(), creds.toThrift(c.getInstance())); + } finally { + if (client != null) + MasterClient.close(client); + } + unassignedTablets = stats.getUnassignedTablets(); + if (unassignedTablets > 0) { + log.info("Found " + unassignedTablets + " unassigned tablets, sleeping 3 seconds for tablet assignment"); + Thread.sleep(3000); + } } + + assertEquals("Unassigned tablets were not assigned within 30 seconds", 0, unassignedTablets); + List counts = new ArrayList(); for (TabletServerStatus server : stats.tServerInfo) { int count = 0; @@ -119,7 +130,8 @@ public class BalanceAfterCommsFailureIT extends ConfigurableMacIT { assertTrue("Expected to have at least two TabletServers", counts.size() > 1); for (int i = 1; i < counts.size(); i++) { int diff = Math.abs(counts.get(0) - counts.get(i)); - assertTrue("Expected difference in tablets to be less than or equal to " + counts.size() + " but was " + diff, diff <= counts.size()); + assertTrue("Expected difference in tablets to be less than or equal to " + counts.size() + " but was " + diff + ". Counts " + counts, + diff <= counts.size()); } } } http://git-wip-us.apache.org/repos/asf/accumulo/blob/7a40f7bf/test/src/test/java/org/apache/accumulo/test/functional/SimpleBalancerFairnessIT.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/test/functional/SimpleBalancerFairnessIT.java b/test/src/test/java/org/apache/accumulo/test/functional/SimpleBalancerFairnessIT.java index 6904563..7d37615 100644 --- a/test/src/test/java/org/apache/accumulo/test/functional/SimpleBalancerFairnessIT.java +++ b/test/src/test/java/org/apache/accumulo/test/functional/SimpleBalancerFairnessIT.java @@ -16,12 +16,14 @@ */ package org.apache.accumulo.test.functional; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.TreeSet; import org.apache.accumulo.core.cli.BatchWriterOpts; import org.apache.accumulo.core.client.Connector; @@ -38,6 +40,7 @@ import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl; import org.apache.accumulo.test.TestIngest; import org.apache.accumulo.trace.instrument.Tracer; import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.io.Text; import org.junit.Test; public class SimpleBalancerFairnessIT extends ConfigurableMacIT { @@ -61,24 +64,38 @@ public class SimpleBalancerFairnessIT extends ConfigurableMacIT { c.tableOperations().create("test_ingest"); c.tableOperations().setProperty("test_ingest", Property.TABLE_SPLIT_THRESHOLD.getKey(), "10K"); c.tableOperations().create("unused"); - c.tableOperations().addSplits("unused", TestIngest.getSplitPoints(0, 10000000, 2000)); + TreeSet splits = TestIngest.getSplitPoints(0, 10000000, 2000); + log.info("Creating " + splits.size() + " splits"); + c.tableOperations().addSplits("unused", splits); List tservers = c.instanceOperations().getTabletServers(); TestIngest.Opts opts = new TestIngest.Opts(); opts.rows = 200000; TestIngest.ingest(c, opts, new BatchWriterOpts()); c.tableOperations().flush("test_ingest", null, null, false); - UtilWaitThread.sleep(15 * 1000); + UtilWaitThread.sleep(45 * 1000); Credentials creds = new Credentials("root", new PasswordToken(ROOT_PASSWORD)); - MasterClientService.Iface client = null; MasterMonitorInfo stats = null; - try { - client = MasterClient.getConnectionWithRetry(c.getInstance()); - stats = client.getMasterStats(Tracer.traceInfo(), creds.toThrift(c.getInstance())); - } finally { - if (client != null) - MasterClient.close(client); + int unassignedTablets = 1; + for (int i = 0; unassignedTablets > 0 && i < 10; i++) { + MasterClientService.Iface client = null; + try { + client = MasterClient.getConnectionWithRetry(c.getInstance()); + stats = client.getMasterStats(Tracer.traceInfo(), creds.toThrift(c.getInstance())); + } finally { + if (client != null) + MasterClient.close(client); + } + unassignedTablets = stats.getUnassignedTablets(); + if (unassignedTablets > 0) { + log.info("Found " + unassignedTablets + " unassigned tablets, sleeping 3 seconds for tablet assignment"); + Thread.sleep(3000); + } } + + assertEquals("Unassigned tablets were not assigned within 30 seconds", 0, unassignedTablets); + + // Compute online tablets per tserver List counts = new ArrayList(); for (TabletServerStatus server : stats.tServerInfo) { int count = 0; @@ -87,9 +104,12 @@ public class SimpleBalancerFairnessIT extends ConfigurableMacIT { } counts.add(count); } - assertTrue(counts.size() > 1); - for (int i = 1; i < counts.size(); i++) - assertTrue(Math.abs(counts.get(0) - counts.get(i)) <= tservers.size()); + assertTrue("Expected to have at least two TabletServers", counts.size() > 1); + for (int i = 1; i < counts.size(); i++) { + int diff = Math.abs(counts.get(0) - counts.get(i)); + assertTrue("Expected difference in tablets to be less than or equal to " + counts.size() + " but was " + diff + ". Counts " + counts, + diff <= tservers.size()); + } } }