@Override public void kill(ServerType server, String hostname) throws IOException { stop(server, hostname); }
@Override public synchronized void stopAllServers(ServerType server) throws IOException { stop(server); }
public void stop(ServerType server) throws IOException { stop(server, null); }
@Override public void run() { try { int i = 0; while (!stop.get()) { sleepUninterruptibly(10, TimeUnit.SECONDS); System.out.println("Restarting"); getCluster().getClusterControl().stop(ServerType.TABLET_SERVER); getCluster().start(); // read the metadata table to know everything is back up Iterators.size( getConnector().createScanner(MetadataTable.NAME, Authorizations.EMPTY).iterator()); i++; } System.out.println("Restarted " + i + " times"); } catch (Exception ex) { log.error("{}", ex.getMessage(), ex); } } };
mac.getClusterControl().stop(ServerType.MASTER); Thread.sleep(5000); log.info("Restarting master");
private void testWalPerformanceOnce() throws Exception { // get time with a small WAL, which will cause many WAL roll-overs long avg1 = getAverage(); // use a bigger WAL max size to eliminate WAL roll-overs Connector c = getConnector(); c.instanceOperations().setProperty(Property.TSERV_WALOG_MAX_SIZE.getKey(), "1G"); c.tableOperations().flush(MetadataTable.NAME, null, null, true); c.tableOperations().flush(RootTable.NAME, null, null, true); getCluster().getClusterControl().stop(ServerType.TABLET_SERVER); getCluster().start(); long avg2 = getAverage(); log.info(String.format("Average run time with small WAL %,d with large WAL %,d", avg1, avg2)); assertTrue(avg1 > avg2); double percent = (100. * avg1) / avg2; log.info(String.format("Percent of large log: %.2f%%", percent)); assertTrue(percent < 125.); }
@Test(timeout = 2 * 60 * 1000) public void test() throws Exception { // not yet, please String tableName = getUniqueNames(1)[0]; cluster.getClusterControl().stop(ServerType.GARBAGE_COLLECTOR); Connector c = getConnector(); c.tableOperations().create(tableName); // count the number of WALs in the filesystem assertEquals(2, countWALsInFS(cluster)); cluster.getClusterControl().stop(ServerType.TABLET_SERVER); cluster.getClusterControl().start(ServerType.GARBAGE_COLLECTOR); cluster.getClusterControl().start(ServerType.TABLET_SERVER); Iterators.size(c.createScanner(MetadataTable.NAME, Authorizations.EMPTY).iterator()); // let GC run UtilWaitThread.sleep(3 * 5 * 1000); assertEquals(2, countWALsInFS(cluster)); }
getCluster().getClusterControl().stop(ServerType.GARBAGE_COLLECTOR);