HBASE-1169 When a shutdown is requested, stop scanning META regions immediately
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@751172 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c45dc36738
commit
2ae864d629
|
@ -39,6 +39,7 @@ Release 0.20.0 - Unreleased
|
|||
to compact when loaded with hundreds of regions
|
||||
HBASE-1247 checkAndSave doesn't Write Ahead Log
|
||||
HBASE-1243 oldlogfile.dat is screwed, so is it's region
|
||||
HBASE-1169 When a shutdown is requested, stop scanning META regions immediately
|
||||
|
||||
IMPROVEMENTS
|
||||
HBASE-1089 Add count of regions on filesystem to master UI; add percentage
|
||||
|
|
|
@ -95,8 +95,8 @@ public class HMaster extends Thread implements HConstants, HMasterInterface,
|
|||
|
||||
static final Log LOG = LogFactory.getLog(HMaster.class.getName());
|
||||
|
||||
public long getProtocolVersion(String protocol,
|
||||
long clientVersion) {
|
||||
public long getProtocolVersion(@SuppressWarnings("unused") String protocol,
|
||||
@SuppressWarnings("unused") long clientVersion) {
|
||||
return HBaseRPCProtocolVersion.versionID;
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ public class HMaster extends Thread implements HConstants, HMasterInterface,
|
|||
// started here in HMaster rather than have them have to know about the
|
||||
// hosting class
|
||||
volatile AtomicBoolean closed = new AtomicBoolean(true);
|
||||
volatile boolean shutdownRequested = false;
|
||||
volatile AtomicBoolean shutdownRequested = new AtomicBoolean(false);
|
||||
volatile boolean fsOk = true;
|
||||
final Path rootdir;
|
||||
private final HBaseConfiguration conf;
|
||||
|
@ -337,7 +337,7 @@ public class HMaster extends Thread implements HConstants, HMasterInterface,
|
|||
*/
|
||||
public HServerAddress getRootRegionLocation() {
|
||||
HServerAddress rootServer = null;
|
||||
if (!shutdownRequested && !closed.get()) {
|
||||
if (!shutdownRequested.get() && !closed.get()) {
|
||||
rootServer = regionManager.getRootRegionLocation();
|
||||
}
|
||||
return rootServer;
|
||||
|
@ -367,9 +367,14 @@ public class HMaster extends Thread implements HConstants, HMasterInterface,
|
|||
try {
|
||||
while (!closed.get()) {
|
||||
// check if we should be shutting down
|
||||
if (shutdownRequested && serverManager.numServers() == 0) {
|
||||
startShutdown();
|
||||
break;
|
||||
if (shutdownRequested.get()) {
|
||||
// The region servers won't all exit until we stop scanning the
|
||||
// meta regions
|
||||
regionManager.stopScanners();
|
||||
if (serverManager.numServers() == 0) {
|
||||
startShutdown();
|
||||
break;
|
||||
}
|
||||
}
|
||||
// work on the TodoQueue. If that fails, we should shut down.
|
||||
if (!processToDoQueue()) {
|
||||
|
@ -380,8 +385,6 @@ public class HMaster extends Thread implements HConstants, HMasterInterface,
|
|||
LOG.fatal("Unhandled exception. Starting shutdown.", t);
|
||||
closed.set(true);
|
||||
}
|
||||
// The region servers won't all exit until we stop scanning the meta regions
|
||||
regionManager.stopScanners();
|
||||
|
||||
// Wait for all the remaining region servers to report in.
|
||||
serverManager.letRegionServersShutdown();
|
||||
|
@ -593,7 +596,7 @@ public class HMaster extends Thread implements HConstants, HMasterInterface,
|
|||
|
||||
public void shutdown() {
|
||||
LOG.info("Cluster shutdown requested. Starting to quiesce servers");
|
||||
this.shutdownRequested = true;
|
||||
this.shutdownRequested.set(true);
|
||||
}
|
||||
|
||||
public void createTable(HTableDescriptor desc)
|
||||
|
@ -958,7 +961,7 @@ public class HMaster extends Thread implements HConstants, HMasterInterface,
|
|||
|
||||
/**
|
||||
* Get the ZK wrapper object
|
||||
* @return
|
||||
* @return the zookeeper wrapper
|
||||
*/
|
||||
public ZooKeeperWrapper getZooKeeperWrapper() {
|
||||
return zooKeeperWrapper;
|
||||
|
|
|
@ -51,7 +51,7 @@ class MetaScanner extends BaseScanner {
|
|||
* @param master
|
||||
*/
|
||||
public MetaScanner(HMaster master) {
|
||||
super(master, false, master.metaRescanInterval, master.closed);
|
||||
super(master, false, master.metaRescanInterval, master.shutdownRequested);
|
||||
}
|
||||
|
||||
// Don't retry if we get an error while scanning. Errors are most often
|
||||
|
|
|
@ -132,7 +132,7 @@ class RegionManager implements HConstants {
|
|||
private final int zooKeeperNumRetries;
|
||||
private final int zooKeeperPause;
|
||||
|
||||
RegionManager(HMaster master) throws IOException {
|
||||
RegionManager(HMaster master) {
|
||||
HBaseConfiguration conf = master.getConfiguration();
|
||||
|
||||
this.master = master;
|
||||
|
@ -169,7 +169,7 @@ class RegionManager implements HConstants {
|
|||
|
||||
void reassignRootRegion() {
|
||||
unsetRootRegion();
|
||||
if (!master.shutdownRequested) {
|
||||
if (!master.shutdownRequested.get()) {
|
||||
synchronized (regionsInTransition) {
|
||||
RegionState s = new RegionState(HRegionInfo.ROOT_REGIONINFO);
|
||||
s.setUnassigned();
|
||||
|
@ -1014,10 +1014,8 @@ class RegionManager implements HConstants {
|
|||
/**
|
||||
* Set the root region location.
|
||||
* @param address Address of the region server where the root lives
|
||||
* @throws IOException If there's a problem connection to ZooKeeper.
|
||||
*/
|
||||
public void setRootRegionLocation(HServerAddress address)
|
||||
throws IOException {
|
||||
public void setRootRegionLocation(HServerAddress address) {
|
||||
writeRootRegionLocationToZooKeeper(address);
|
||||
|
||||
synchronized (rootRegionLocation) {
|
||||
|
|
|
@ -31,7 +31,7 @@ class RootScanner extends BaseScanner {
|
|||
* @param master
|
||||
*/
|
||||
public RootScanner(HMaster master) {
|
||||
super(master, true, master.metaRescanInterval, master.closed);
|
||||
super(master, true, master.metaRescanInterval, master.shutdownRequested);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -116,7 +116,6 @@ class ServerManager implements HConstants {
|
|||
* them or the server is shutting down.
|
||||
*/
|
||||
private boolean checkForGhostReferences(final HServerInfo serverInfo) {
|
||||
String s = serverInfo.getServerAddress().toString().trim();
|
||||
boolean result = false;
|
||||
for (long sleepTime = -1; !master.closed.get() && !result;) {
|
||||
if (sleepTime != -1) {
|
||||
|
@ -225,7 +224,7 @@ class ServerManager implements HConstants {
|
|||
}
|
||||
}
|
||||
|
||||
if (master.shutdownRequested) {
|
||||
if (master.shutdownRequested.get()) {
|
||||
if(quiescedServers.get() >= serversToServerInfo.size()) {
|
||||
// If the only servers we know about are meta servers, then we can
|
||||
// proceed with shutdown
|
||||
|
|
Loading…
Reference in New Issue