private static void closeAllRegionServerThreads( List<JVMClusterUtil.RegionServerThread> regionservers) { for(JVMClusterUtil.RegionServerThread t : regionservers){ t.getRegionServer().stop("HMaster Aborted; Bringing down regions servers"); } }
@Override public void stop(final String msg) { stop(msg, false, RpcServer.getRequestUser().orElse(null)); }
@Override public void stop(String msg) { if (!isStopped()) { super.stop(msg); if (this.activeMasterManager != null) { this.activeMasterManager.stop(); } } }
/** * Stop the region server. * * @param controller the RPC controller * @param request the request * @throws ServiceException */ @Override @QosPriority(priority=HConstants.ADMIN_QOS) public StopServerResponse stopServer(final RpcController controller, final StopServerRequest request) throws ServiceException { requestCount.increment(); String reason = request.getReason(); regionServer.stop(reason); return StopServerResponse.newBuilder().build(); }
@Override public void run() { try { Thread.sleep(timeout); utility.getHBaseCluster().getRegionServer(rs).stop("Stopping as part of the test"); } catch (Exception e) { LOG.error("Couldn't kill a region server", e); } } };
stop(reason, true, null);
private boolean isHealthy() { if (!fsOk) { // File system problem return false; } // Verify that all threads are alive boolean healthy = (this.leases == null || this.leases.isAlive()) && (this.cacheFlusher == null || this.cacheFlusher.isAlive()) && (this.walRoller == null || this.walRoller.isAlive()) && (this.compactionChecker == null || this.compactionChecker.isScheduled()) && (this.periodicFlusher == null || this.periodicFlusher.isScheduled()); if (!healthy) { stop("One or more threads are no longer alive -- stop"); } return healthy; }
/** * Shut down the specified region server cleanly * * @param serverNumber Used as index into a list. * @param shutdownFS True is we are to shutdown the filesystem as part of this * regionserver's shutdown. Usually we do but you do not want to do this if * you are running multiple regionservers in a test and you shut down one * before end of the test. * @return the region server that was stopped */ public JVMClusterUtil.RegionServerThread stopRegionServer(int serverNumber, final boolean shutdownFS) { JVMClusterUtil.RegionServerThread server = hbaseCluster.getRegionServers().get(serverNumber); LOG.info("Stopping " + server.toString()); server.getRegionServer().stop("Stopping rs " + serverNumber); return server; }
t.getRegionServer().stop("Shutdown requested");
stop("Failed initialization"); throw convertThrowableToIOE(cleanup(e, "Failed init"), "Region server startup failed");
@After public void tearDown() throws Exception { TEST_UTIL.shutdownMiniCluster(); if(rst != null && rst.getRegionServer() != null) { rst.getRegionServer().stop("end of test"); rst.join(); } }
TEST_UTIL.getHBaseCluster().getRegionServer(0).stop("Testing");
@BeforeClass public static void setUpBeforeClass() throws Exception { Configuration conf = HBaseConfiguration.create(); conf.set(CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY, MyObserver.class.getName()); UTIL = new HBaseTestingUtility(conf); StartMiniClusterOption option = StartMiniClusterOption.builder() .numMasters(MASTERS).numRegionServers(SLAVES).numDataNodes(SLAVES).build(); UTIL.startMiniCluster(option); CLUSTER = UTIL.getHBaseCluster(); CLUSTER.waitForActiveAndReadyMaster(); ADMIN = UTIL.getAdmin(); // Kill one region server List<RegionServerThread> rsts = CLUSTER.getLiveRegionServerThreads(); RegionServerThread rst = rsts.get(rsts.size() - 1); DEAD = rst.getRegionServer(); DEAD.stop("Test dead servers metrics"); while (rst.isAlive()) { Thread.sleep(500); } }
@BeforeClass public static void setUpBeforeClass() throws Exception { Configuration conf = HBaseConfiguration.create(); conf.set(CoprocessorHost.MASTER_COPROCESSOR_CONF_KEY, MyObserver.class.getName()); UTIL = new HBaseTestingUtility(conf); StartMiniClusterOption option = StartMiniClusterOption.builder() .numMasters(MASTERS).numRegionServers(SLAVES).numDataNodes(SLAVES).build(); UTIL.startMiniCluster(option); CLUSTER = UTIL.getHBaseCluster(); CLUSTER.waitForActiveAndReadyMaster(); ADMIN = UTIL.getAdmin(); // Kill one region server List<RegionServerThread> rsts = CLUSTER.getLiveRegionServerThreads(); RegionServerThread rst = rsts.get(rsts.size() - 1); DEAD = rst.getRegionServer(); DEAD.stop("Test dead servers status"); while (rst.isAlive()) { Thread.sleep(500); } }
int metaServerId = cluster.getServerWithMeta(); HRegionServer metaServer = cluster.getRegionServer(metaServerId); metaServer.stop("Stop current RS holding meta region"); while (!metaServer.isShutDown()) { Thread.sleep(200);
toKillRSThread.getRegionServer().stop("Stop for test");
utility1.getHBaseCluster().getRegionServer(1).stop("Stop RegionServer"); Thread.sleep(10000); status = new ClusterStatus(hbaseAdmin.getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS)));
for (JVMClusterUtil.RegionServerThread rst : regionServers) { ServerName serverName = rst.getRegionServer().getServerName(); rst.getRegionServer().stop("Stop RS for test"); waitForRSShutdownToStartAndFinish(activeMaster, serverName); JVMClusterUtil.RegionServerThread restarted =
log("Stopping region server " + num + " of " + total + " [ " + serverName + "]"); rst.getRegionServer().stop("Stopping RS during rolling restart"); cluster.hbaseCluster.waitOnRegionServer(rst); log("Waiting for RS shutdown to be handled by master");