public void waitForServerOnline(){ while (!isStopped() && !isOnline()) { synchronized (online) { try { online.wait(msgInterval); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); break; } } } }
@Override public void run() { while (!server.isStopped()) { FlushQueueEntry fqe = null; try {
@Override public void run() { Preconditions.checkNotNull(server); if (server.isStopped() || (region.getTableDescriptor() != null && !region.getTableDescriptor().isCompactionEnabled())) { region.decrementCompactionsQueuedCount(); return; } doCompaction(user); }
ReportProcedureDoneRequest.Builder builder = ReportProcedureDoneRequest.newBuilder(); int tries = 0; while (!server.isStopped()) { if (builder.getResultCount() == 0) { try {
private void requestCompactionInternal(HRegion region, HStore store, String why, int priority, boolean selectNow, CompactionLifeCycleTracker tracker, CompactionCompleteTracker completeTracker, User user) throws IOException { if (this.server.isStopped() || (region.getTableDescriptor() != null && !region.getTableDescriptor().isCompactionEnabled())) { return;
/** * Called to verify that this server is up and running. */ // TODO : Rename this and HMaster#checkInitialized to isRunning() (or a better name). protected void checkOpen() throws IOException { if (regionServer.isAborted()) { throw new RegionServerAbortedException("Server " + regionServer.serverName + " aborting"); } if (regionServer.isStopped()) { throw new RegionServerStoppedException("Server " + regionServer.serverName + " stopping"); } if (!regionServer.fsOk) { throw new RegionServerStoppedException("File system not available"); } if (!regionServer.isOnline()) { throw new ServerNotRunningYetException("Server " + regionServer.serverName + " is not running yet"); } }
private void startServices() throws IOException { if (!isStopped() && !isAborted()) { initializeThreads();
/** * Get the location of the specified region * @param regionName Name of the region in bytes * @return Index into List of {@link MiniHBaseCluster#getRegionServerThreads()} * of HRS carrying hbase:meta. Returns -1 if none found. */ public int getServerWith(byte[] regionName) { int index = -1; int count = 0; for (JVMClusterUtil.RegionServerThread rst: getRegionServerThreads()) { HRegionServer hrs = rst.getRegionServer(); if (!hrs.isStopped()) { Region region = hrs.getOnlineRegion(regionName); if (region != null) { index = count; break; } } count++; } return index; }
if (isStopped() || isAborted()) { return; // No need for further initialization
@Test public void testStop() throws Exception { HRegionServer rs = TEST_UTIL.getMiniHBaseCluster().getRegionServer(0); assertFalse(rs.isStopped()); admin.stopRegionServer(rs.getServerName()).join(); assertTrue(rs.isStopped()); HMaster master = TEST_UTIL.getMiniHBaseCluster().getMaster(); assertFalse(master.isStopped()); admin.stopMaster().join(); assertTrue(master.isStopped()); }
if (!isStopped() && !isAborted()) { ShutdownHook.install(conf, fs, this, Thread.currentThread()); if (!isStopped() && isHealthy()) { long oldRequestCount = -1; while (!isStopped() && isHealthy()) { if (!isClusterUp()) { if (isOnlineRegionsEmpty()) { lastMsg = System.currentTimeMillis(); if (!isStopped() && !isAborted()) { this.sleeper.sleep();
/** * Make sure that at least the specified number of region servers * are running. We don't count the ones that are currently stopping or are * stopped. * @param num minimum number of region servers that should be running * @return true if we started some servers * @throws IOException */ public boolean ensureSomeNonStoppedRegionServersAvailable(final int num) throws IOException { boolean startedServer = ensureSomeRegionServersAvailable(num); int nonStoppedServers = 0; for (JVMClusterUtil.RegionServerThread rst : getMiniHBaseCluster().getRegionServerThreads()) { HRegionServer hrs = rst.getRegionServer(); if (hrs.isStopping() || hrs.isStopped()) { LOG.info("A region server is stopped or stopping:"+hrs); } else { nonStoppedServers++; } } for (int i=nonStoppedServers; i<num; ++i) { LOG.info("Started new server=" + getMiniHBaseCluster().startRegionServer()); startedServer = true; } return startedServer; }
@Test public void testShutdown() throws Exception { TEST_UTIL.getMiniHBaseCluster().getMasterThreads().forEach(thread -> { assertFalse(thread.getMaster().isStopped()); }); TEST_UTIL.getMiniHBaseCluster().getRegionServerThreads().forEach(thread -> { assertFalse(thread.getRegionServer().isStopped()); }); admin.shutdown().join(); TEST_UTIL.getMiniHBaseCluster().getMasterThreads().forEach(thread -> { while (!thread.getMaster().isStopped()) { trySleep(100, TimeUnit.MILLISECONDS); } }); TEST_UTIL.getMiniHBaseCluster().getRegionServerThreads().forEach(thread -> { while (!thread.getRegionServer().isStopped()) { trySleep(100, TimeUnit.MILLISECONDS); } }); }
try { while (System.currentTimeMillis() <= endTime && !regionServer.isStopped() && !regionServer.isOnline()) { regionServer.online.wait(regionServer.msgInterval);
when(mockServer.isStopped()).thenReturn(false); when(mockServer.getConfiguration()).thenReturn(conf); when(mockServer.getChoreService()).thenReturn(new ChoreService("test"));
/** * Find regionserver other than the one passed. * Can't rely on indexes into list of regionservers since crashed servers * occupy an index. * @param cluster * @param notThisOne * @return A regionserver that is not <code>notThisOne</code> or null if none * found */ private HRegionServer getOtherRegionServer(final MiniHBaseCluster cluster, final HRegionServer notThisOne) { for (RegionServerThread rst: cluster.getRegionServerThreads()) { HRegionServer hrs = rst.getRegionServer(); if (hrs.getServerName().equals(notThisOne.getServerName())) continue; if (hrs.isStopping() || hrs.isStopped()) continue; return hrs; } return null; }
try { flushType = isAboveHighWaterMark(); while (flushType != FlushType.NORMAL && !server.isStopped()) { server.cacheFlusher.setFlushType(flushType); if (!blocked) {
/** * Test that a coprocessor is able to override a normal regionserver stop request. */ @Test public void testStopOverrideFromCoprocessor() throws Exception { Admin admin = testUtil.getHBaseAdmin(); HRegionServer regionserver = cluster.getRegionServer(0); admin.stopRegionServer(regionserver.getServerName().getHostAndPort()); // regionserver should have failed to stop due to coprocessor assertFalse(cluster.getRegionServer(0).isAborted()); assertFalse(cluster.getRegionServer(0).isStopped()); }
if (server.isStopping() || server.isStopped() || server.isAborted()) { LOG.info("\t== Offline: " + server.getServerName()); continue;