ACCUMULO-3167 Stub out more control for MAC. Fix RestartIT
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/b0e3008f Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/b0e3008f Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/b0e3008f Branch: refs/heads/metrics2 Commit: b0e3008f9f2dddfa518bc79dd63273154b25a91b Parents: 0c54425 Author: Josh Elser <[email protected]> Authored: Sun Nov 23 14:00:03 2014 -0500 Committer: Josh Elser <[email protected]> Committed: Mon Nov 24 18:08:51 2014 -0500 ---------------------------------------------------------------------- minicluster/pom.xml | 4 ++++ .../impl/MiniAccumuloClusterControl.java | 24 +++++++++++++++++++- .../accumulo/test/functional/RestartIT.java | 16 +++++++++---- 3 files changed, 39 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0e3008f/minicluster/pom.xml ---------------------------------------------------------------------- diff --git a/minicluster/pom.xml b/minicluster/pom.xml index b7bc889..65d5007 100644 --- a/minicluster/pom.xml +++ b/minicluster/pom.xml @@ -72,6 +72,10 @@ </dependency> <dependency> <groupId>org.apache.accumulo</groupId> + <artifactId>accumulo-tracer</artifactId> + </dependency> + <dependency> + <groupId>org.apache.accumulo</groupId> <artifactId>accumulo-tserver</artifactId> </dependency> <dependency> http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0e3008f/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterControl.java ---------------------------------------------------------------------- diff --git a/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterControl.java b/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterControl.java index 6e7d073..ed90cbf 100644 --- a/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterControl.java +++ b/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterControl.java @@ -30,6 +30,7 @@ import org.apache.accumulo.master.Master; import org.apache.accumulo.minicluster.ServerType; import org.apache.accumulo.monitor.Monitor; import org.apache.accumulo.server.util.Admin; +import org.apache.accumulo.tracer.TraceServer; import org.apache.accumulo.tserver.TabletServer; import org.apache.log4j.Logger; import org.apache.zookeeper.server.ZooKeeperServerMain; @@ -48,6 +49,7 @@ public class MiniAccumuloClusterControl implements ClusterControl { Process masterProcess = null; Process gcProcess = null; Process monitor = null; + Process tracer = null; List<Process> tabletServerProcesses = Collections.synchronizedList(new ArrayList<Process>()); public MiniAccumuloClusterControl(MiniAccumuloClusterImpl cluster) { @@ -121,7 +123,12 @@ public class MiniAccumuloClusterControl implements ClusterControl { if (null == monitor) { monitor = cluster._exec(Monitor.class, server); } - // TODO Enabled Monitor and Tracer for proper mini-ness + break; + case TRACER: + if (null == tracer) { + tracer = cluster._exec(TraceServer.class, server); + } + break; default: throw new UnsupportedOperationException("Cannot start process for " + server); } @@ -220,6 +227,21 @@ public class MiniAccumuloClusterControl implements ClusterControl { } } break; + case TRACER: + if (tracer != null) { + try { + cluster.stopProcessWithTimeout(tracer, 30, TimeUnit.SECONDS); + } catch (ExecutionException e) { + log.warn("Tracer did not fully stop after 30 seconds", e); + } catch (TimeoutException e) { + log.warn("Tracer did not fully stop after 30 seconds", e); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } finally { + tracer = null; + } + } + break; default: throw new UnsupportedOperationException("ServerType is not yet supported " + server); } http://git-wip-us.apache.org/repos/asf/accumulo/blob/b0e3008f/test/src/test/java/org/apache/accumulo/test/functional/RestartIT.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/test/functional/RestartIT.java b/test/src/test/java/org/apache/accumulo/test/functional/RestartIT.java index 27d8119..8d5a1dd 100644 --- a/test/src/test/java/org/apache/accumulo/test/functional/RestartIT.java +++ b/test/src/test/java/org/apache/accumulo/test/functional/RestartIT.java @@ -143,8 +143,14 @@ public class RestartIT extends AccumuloClusterIT { VOPTS.tableName = tableName; TestIngest.ingest(c, OPTS, BWOPTS); ClusterControl control = getCluster().getClusterControl(); + // TODO implement a kill all too? - cluster.stop(); + // cluster.stop() would also stop ZooKeeper + control.stopAllServers(ServerType.MASTER); + control.stopAllServers(ServerType.TRACER); + control.stopAllServers(ServerType.TABLET_SERVER); + control.stopAllServers(ServerType.GARBAGE_COLLECTOR); + control.stopAllServers(ServerType.MONITOR); ZooReader zreader = new ZooReader(c.getInstance().getZooKeepers(), c.getInstance().getZooKeepersSessionTimeOut()); ZooCache zcache = new ZooCache(zreader, null); @@ -280,10 +286,12 @@ public class RestartIT extends AccumuloClusterIT { TestIngest.ingest(c, opts, BWOPTS); c.tableOperations().flush(tableName, null, null, false); VerifyIngest.verifyIngest(c, VOPTS, SOPTS); - getCluster().getClusterControl().adminStopAll(); + getCluster().stop(); } finally { - getCluster().start(); - c.tableOperations().setProperty(MetadataTable.NAME, Property.TABLE_SPLIT_THRESHOLD.getKey(), splitThreshold); + if (getClusterType() == ClusterType.STANDALONE) { + getCluster().start(); + c.tableOperations().setProperty(MetadataTable.NAME, Property.TABLE_SPLIT_THRESHOLD.getKey(), splitThreshold); + } } } }
