Repository: accumulo Updated Branches: refs/heads/master eca6022f8 -> a0ffb3df2
ACCUMULO-3287 Retry creation of the MAC if we can't start ZK Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/a0ffb3df Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/a0ffb3df Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/a0ffb3df Branch: refs/heads/master Commit: a0ffb3df2867072564a274c157262cc839127390 Parents: eca6022 Author: Josh Elser <els...@apache.org> Authored: Fri Oct 31 19:24:41 2014 -0400 Committer: Josh Elser <els...@apache.org> Committed: Fri Oct 31 19:24:41 2014 -0400 ---------------------------------------------------------------------- .../test/replication/CyclicReplicationIT.java | 86 ++++++++++++-------- 1 file changed, 53 insertions(+), 33 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/a0ffb3df/test/src/test/java/org/apache/accumulo/test/replication/CyclicReplicationIT.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/test/replication/CyclicReplicationIT.java b/test/src/test/java/org/apache/accumulo/test/replication/CyclicReplicationIT.java index 93c8650..59bddc3 100644 --- a/test/src/test/java/org/apache/accumulo/test/replication/CyclicReplicationIT.java +++ b/test/src/test/java/org/apache/accumulo/test/replication/CyclicReplicationIT.java @@ -44,6 +44,7 @@ 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.minicluster.impl.ZooKeeperBindException; import org.apache.accumulo.test.functional.AbstractMacIT; import org.apache.accumulo.tserver.TabletServer; import org.apache.accumulo.tserver.replication.AccumuloReplicaSystem; @@ -74,7 +75,7 @@ public class CyclicReplicationIT { } catch (NumberFormatException exception) { log.warn("Could not parse timeout.factor, not scaling timeout"); } - + return new Timeout(scalingFactor * 5 * 60 * 1000); } @@ -146,38 +147,57 @@ public class CyclicReplicationIT { File master1Dir = createTestDir("master1"), master2Dir = createTestDir("master2"); String password = "password"; - MiniAccumuloConfigImpl master1Cfg = new MiniAccumuloConfigImpl(master1Dir, password); - master1Cfg.setNumTservers(1); - master1Cfg.setInstanceName("master1"); - - // Set up SSL if needed - AbstractMacIT.configureForEnvironment(master1Cfg, AbstractMacIT.createSharedTestDir(this.getClass().getName() + "-ssl")); - - master1Cfg.setProperty(Property.REPLICATION_NAME, master1Cfg.getInstanceName()); - master1Cfg.setProperty(Property.TSERV_WALOG_MAX_SIZE, "5M"); - master1Cfg.setProperty(Property.REPLICATION_THREADCHECK, "5m"); - master1Cfg.setProperty(Property.REPLICATION_WORK_ASSIGNMENT_SLEEP, "1s"); - master1Cfg.setProperty(Property.MASTER_REPLICATION_SCAN_INTERVAL, "1s"); - MiniAccumuloClusterImpl master1Cluster = master1Cfg.build(); - setCoreSite(master1Cluster); - - MiniAccumuloConfigImpl master2Cfg = new MiniAccumuloConfigImpl(master2Dir, password); - master2Cfg.setNumTservers(1); - master2Cfg.setInstanceName("master2"); - - // Set up SSL if needed. Need to share the same SSL truststore as master1 - this.updatePeerConfigFromPrimary(master1Cfg, master2Cfg); - - master2Cfg.setProperty(Property.REPLICATION_NAME, master2Cfg.getInstanceName()); - master2Cfg.setProperty(Property.TSERV_WALOG_MAX_SIZE, "5M"); - master2Cfg.setProperty(Property.REPLICATION_THREADCHECK, "5m"); - master2Cfg.setProperty(Property.REPLICATION_WORK_ASSIGNMENT_SLEEP, "1s"); - master2Cfg.setProperty(Property.MASTER_REPLICATION_SCAN_INTERVAL, "1s"); - MiniAccumuloClusterImpl master2Cluster = master2Cfg.build(); - setCoreSite(master2Cluster); - - master1Cluster.start(); - master2Cluster.start(); + MiniAccumuloConfigImpl master1Cfg; + MiniAccumuloClusterImpl master1Cluster; + while (true) { + master1Cfg= new MiniAccumuloConfigImpl(master1Dir, password); + master1Cfg.setNumTservers(1); + master1Cfg.setInstanceName("master1"); + + // Set up SSL if needed + AbstractMacIT.configureForEnvironment(master1Cfg, AbstractMacIT.createSharedTestDir(this.getClass().getName() + "-ssl")); + + master1Cfg.setProperty(Property.REPLICATION_NAME, master1Cfg.getInstanceName()); + master1Cfg.setProperty(Property.TSERV_WALOG_MAX_SIZE, "5M"); + master1Cfg.setProperty(Property.REPLICATION_THREADCHECK, "5m"); + master1Cfg.setProperty(Property.REPLICATION_WORK_ASSIGNMENT_SLEEP, "1s"); + master1Cfg.setProperty(Property.MASTER_REPLICATION_SCAN_INTERVAL, "1s"); + master1Cluster = master1Cfg.build(); + setCoreSite(master1Cluster); + + try { + master1Cluster.start(); + break; + } catch (ZooKeeperBindException e) { + log.warn("Failed to start ZooKeeper on " + master1Cfg.getZooKeeperPort() + ", will retry"); + } + } + + MiniAccumuloConfigImpl master2Cfg; + MiniAccumuloClusterImpl master2Cluster; + while (true) { + master2Cfg = new MiniAccumuloConfigImpl(master2Dir, password); + master2Cfg.setNumTservers(1); + master2Cfg.setInstanceName("master2"); + + // Set up SSL if needed. Need to share the same SSL truststore as master1 + this.updatePeerConfigFromPrimary(master1Cfg, master2Cfg); + + master2Cfg.setProperty(Property.REPLICATION_NAME, master2Cfg.getInstanceName()); + master2Cfg.setProperty(Property.TSERV_WALOG_MAX_SIZE, "5M"); + master2Cfg.setProperty(Property.REPLICATION_THREADCHECK, "5m"); + master2Cfg.setProperty(Property.REPLICATION_WORK_ASSIGNMENT_SLEEP, "1s"); + master2Cfg.setProperty(Property.MASTER_REPLICATION_SCAN_INTERVAL, "1s"); + master2Cluster = master2Cfg.build(); + setCoreSite(master2Cluster); + + try { + master2Cluster.start(); + break; + } catch (ZooKeeperBindException e) { + log.warn("Failed to start ZooKeeper on " + master2Cfg.getZooKeeperPort() + ", will retry"); + } + } try { Connector connMaster1 = master1Cluster.getConnector("root", password), connMaster2 = master2Cluster.getConnector("root", password);