Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id C0F53200B95 for ; Tue, 27 Sep 2016 22:00:32 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id BF89B160AE9; Tue, 27 Sep 2016 20:00:32 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 14405160AB9 for ; Tue, 27 Sep 2016 22:00:31 +0200 (CEST) Received: (qmail 25236 invoked by uid 500); 27 Sep 2016 20:00:31 -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 25177 invoked by uid 99); 27 Sep 2016 20:00:31 -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; Tue, 27 Sep 2016 20:00:31 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id B3559DFA0B; Tue, 27 Sep 2016 20:00:30 +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: Tue, 27 Sep 2016 20:00:32 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [3/6] accumulo git commit: ACCUMULO-4474 Make ExistingMacIT more deterministic in verification archived-at: Tue, 27 Sep 2016 20:00:32 -0000 ACCUMULO-4474 Make ExistingMacIT more deterministic in verification Remove the use of sleep for some action to happen, actively check for the state we expect to see. Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/450cae50 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/450cae50 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/450cae50 Branch: refs/heads/master Commit: 450cae509b854b418e79376772b27de9e8895031 Parents: e76f3a2 Author: Josh Elser Authored: Tue Sep 27 14:52:13 2016 -0400 Committer: Josh Elser Committed: Tue Sep 27 15:26:58 2016 -0400 ---------------------------------------------------------------------- .../org/apache/accumulo/test/ExistingMacIT.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/450cae50/test/src/test/java/org/apache/accumulo/test/ExistingMacIT.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/test/ExistingMacIT.java b/test/src/test/java/org/apache/accumulo/test/ExistingMacIT.java index 414cb4d..7a516d8 100644 --- a/test/src/test/java/org/apache/accumulo/test/ExistingMacIT.java +++ b/test/src/test/java/org/apache/accumulo/test/ExistingMacIT.java @@ -26,12 +26,14 @@ import java.util.Collection; import java.util.Map.Entry; import java.util.Set; +import org.apache.accumulo.core.Constants; import org.apache.accumulo.core.client.BatchWriter; import org.apache.accumulo.core.client.BatchWriterConfig; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.conf.AccumuloConfiguration; +import org.apache.accumulo.core.conf.DefaultConfiguration; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Mutation; @@ -39,11 +41,13 @@ import org.apache.accumulo.core.data.Value; import org.apache.accumulo.core.metadata.MetadataTable; import org.apache.accumulo.core.metadata.RootTable; import org.apache.accumulo.core.security.Authorizations; -import org.apache.accumulo.core.util.UtilWaitThread; +import org.apache.accumulo.fate.zookeeper.IZooReaderWriter; import org.apache.accumulo.minicluster.ServerType; import org.apache.accumulo.minicluster.impl.MiniAccumuloClusterImpl; import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl; import org.apache.accumulo.minicluster.impl.ProcessReference; +import org.apache.accumulo.server.util.AccumuloStatus; +import org.apache.accumulo.server.zookeeper.ZooReaderWriterFactory; import org.apache.accumulo.test.functional.ConfigurableMacIT; import org.apache.commons.io.FileUtils; import org.apache.hadoop.conf.Configuration; @@ -101,9 +105,14 @@ public class ExistingMacIT extends ConfigurableMacIT { getCluster().killProcess(entry.getKey(), pr); } - // TODO clean out zookeeper? following sleep waits for ephemeral nodes to go away - long zkTimeout = AccumuloConfiguration.getTimeInMillis(getCluster().getConfig().getSiteConfig().get(Property.INSTANCE_ZK_TIMEOUT.getKey())); - UtilWaitThread.sleep(zkTimeout + 500); + final DefaultConfiguration defaultConfig = DefaultConfiguration.getInstance(); + IZooReaderWriter zrw = new ZooReaderWriterFactory().getZooReaderWriter(getCluster().getZooKeepers(), + (int) defaultConfig.getTimeInMillis(Property.INSTANCE_ZK_TIMEOUT), defaultConfig.get(Property.INSTANCE_SECRET)); + final String zInstanceRoot = Constants.ZROOT + "/" + conn.getInstance().getInstanceID(); + while (!AccumuloStatus.isAccumuloOffline(zrw, zInstanceRoot)) { + log.debug("Accumulo services still have their ZK locks held"); + Thread.sleep(1000); + } File hadoopConfDir = createTestDir(ExistingMacIT.class.getSimpleName() + "_hadoop_conf"); FileUtils.deleteQuietly(hadoopConfDir);