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