@Override public void abort(String reason, Throwable cause) { if (isAborted() || isStopped()) { return; } if (cpHost != null) { // HBASE-4014: dump a list of loaded coprocessors. LOG.error(HBaseMarkers.FATAL, "Master server abort: loaded coprocessors are: " + getLoadedCoprocessors()); } String msg = "***** ABORTING master " + this + ": " + reason + " *****"; if (cause != null) { LOG.error(HBaseMarkers.FATAL, msg, cause); } else { LOG.error(HBaseMarkers.FATAL, msg); } try { stopMaster(); } catch (IOException e) { LOG.error("Exception occurred while stopping master", e); } }
@Override public StopMasterResponse stopMaster(RpcController controller, StopMasterRequest request) throws ServiceException { LOG.info(master.getClientIdAuditPrefix() + " stop"); try { master.stopMaster(); } catch (IOException e) { LOG.error("Exception occurred while stopping master", e); throw new ServiceException(e); } return StopMasterResponse.newBuilder().build(); }
@Override public Object run() throws Exception { HMaster master = TEST_UTIL.getHBaseCluster().getMaster(); master.stopMaster(); return null; } };
@AfterClass public static void after() throws Exception { master.stopMaster(); TEST_UTIL.shutdownMiniCluster(); }
if (!t.master.isActiveMaster()) { try { t.master.stopMaster(); } catch (IOException e) { LOG.error("Exception occurred while stopping master", e);
@After public void tearDown() throws IOException { if (rpcClient != null) { rpcClient.close(); } if (master != null) { master.stopMaster(); } testUtil.shutdownMiniZKCluster(); }
@Test(timeout = 60000) public void testMasterInitWithObserverModeClientZKQuorum() throws Exception { Configuration conf = new Configuration(TESTUTIL.getConfiguration()); Assert.assertFalse(Boolean.getBoolean(HConstants.CLIENT_ZOOKEEPER_OBSERVER_MODE)); // set client ZK to some non-existing address and make sure server won't access client ZK // (server start should not be affected) conf.set(HConstants.CLIENT_ZOOKEEPER_QUORUM, HConstants.LOCALHOST); conf.setInt(HConstants.CLIENT_ZOOKEEPER_CLIENT_PORT, TESTUTIL.getZkCluster().getClientPort() + 1); // settings to allow us not to start additional RS conf.setInt(ServerManager.WAIT_ON_REGIONSERVERS_MINTOSTART, 1); conf.setBoolean(LoadBalancer.TABLES_ON_MASTER, true); // main setting for this test case conf.setBoolean(HConstants.CLIENT_ZOOKEEPER_OBSERVER_MODE, true); HMaster master = new HMaster(conf); master.start(); while (!master.isInitialized()) { Threads.sleep(200); } Assert.assertNull(master.metaLocationSyncer); Assert.assertNull(master.masterAddressSyncer); master.stopMaster(); master.join(); } }
/** * Test starting master then stopping it before its fully up. * @throws IOException * @throws KeeperException * @throws InterruptedException */ @Test public void testStopDuringStart() throws IOException, KeeperException, InterruptedException { HMaster master = new HMaster(TESTUTIL.getConfiguration()); master.start(); // Immediately have it stop. We used hang in assigning meta. master.stopMaster(); master.join(); }
@Test public void testMasterSwitch() throws Exception { // get an admin instance and issue some request first Connection conn = TEST_UTIL.getConnection(); Admin admin = conn.getAdmin(); LOG.debug("Tables: " + admin.listTableDescriptors()); try { MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster(); // switch active master HMaster master = cluster.getMaster(); master.stopMaster(); while (!master.isShutDown()) { Thread.sleep(200); } while (cluster.getMaster() == null || !cluster.getMaster().isInitialized()) { Thread.sleep(200); } // confirm client access still works Assert.assertTrue(admin.balance(false)); } finally { admin.close(); } }
Thread masterThread = HTU.getHBaseCluster().getMasterThread(); ServerName masterAddr = master.getServerName(); master.stopMaster();
TEST_UTIL.getHBaseCluster().getMaster().stopMaster(); LOG.info("Waiting for offline mode..."); TEST_UTIL.waitFor(WAIT_TIMEOUT, new Waiter.Predicate<Exception>() { master.stopMaster();
master.getServerManager().isServerOnline(deadServer)); } finally { master.stopMaster(); master.join();
assertEquals("replication lag of peer2", replicationLag + 1, replicationLoad.get(peer2).get(0).getSecond().getReplicationLag()); master.stopMaster();
rs1.stop("Test is done"); rs2.stop("Test is done"); master.stopMaster(); master.join();
@Override public StopMasterResponse stopMaster(RpcController controller, StopMasterRequest request) throws ServiceException { LOG.info(master.getClientIdAuditPrefix() + " stop"); master.stopMaster(); return StopMasterResponse.newBuilder().build(); }
@Override public Object run() throws Exception { HMaster master = TEST_UTIL.getHBaseCluster().getMaster(); master.stopMaster(); return null; } };
@After public void tearDown() throws IOException { if (rpcClient != null) { rpcClient.close(); } if (master != null) { master.stopMaster(); } testUtil.shutdownMiniZKCluster(); }
@Test(timeout = 60000) public void testMasterInitWithObserverModeClientZKQuorum() throws Exception { Configuration conf = new Configuration(TESTUTIL.getConfiguration()); Assert.assertFalse(Boolean.getBoolean(HConstants.CLIENT_ZOOKEEPER_OBSERVER_MODE)); // set client ZK to some non-existing address and make sure server won't access client ZK // (server start should not be affected) conf.set(HConstants.CLIENT_ZOOKEEPER_QUORUM, HConstants.LOCALHOST); conf.setInt(HConstants.CLIENT_ZOOKEEPER_CLIENT_PORT, TESTUTIL.getZkCluster().getClientPort() + 1); // settings to allow us not to start additional RS conf.setInt(ServerManager.WAIT_ON_REGIONSERVERS_MINTOSTART, 1); conf.setBoolean(LoadBalancer.TABLES_ON_MASTER, true); // main setting for this test case conf.setBoolean(HConstants.CLIENT_ZOOKEEPER_OBSERVER_MODE, true); HMaster master = new HMaster(conf); master.start(); while (!master.isInitialized()) { Threads.sleep(200); } Assert.assertNull(master.metaLocationSyncer); Assert.assertNull(master.masterAddressSyncer); master.stopMaster(); master.join(); } }
/** * Test starting master then stopping it before its fully up. * @throws IOException * @throws KeeperException * @throws InterruptedException */ @Test public void testStopDuringStart() throws IOException, KeeperException, InterruptedException { HMaster master = new HMaster(TESTUTIL.getConfiguration()); master.start(); // Immediately have it stop. We used hang in assigning meta. master.stopMaster(); master.join(); }
@Test public void testMasterSwitch() throws Exception { // get an admin instance and issue some request first Connection conn = TEST_UTIL.getConnection(); Admin admin = conn.getAdmin(); LOG.debug("Tables: " + admin.listTableDescriptors()); try { MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster(); // switch active master HMaster master = cluster.getMaster(); master.stopMaster(); while (!master.isShutDown()) { Thread.sleep(200); } while (cluster.getMaster() == null || !cluster.getMaster().isInitialized()) { Thread.sleep(200); } // confirm client access still works Assert.assertTrue(admin.balance(false)); } finally { admin.close(); } }