HBASE-4034 HRegionServer should be stopped even if no META regions are hosted by the HRegionServer
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1142120 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
fae21de189
commit
fb23289cd1
|
@ -385,6 +385,8 @@ Release 0.90.4 - Unreleased
|
||||||
HBASE-3984 CT.verifyRegionLocation isn't doing a very good check,
|
HBASE-3984 CT.verifyRegionLocation isn't doing a very good check,
|
||||||
can delay cluster recovery
|
can delay cluster recovery
|
||||||
HBASE-4045 [replication] NPE in ReplicationSource when ZK is gone
|
HBASE-4045 [replication] NPE in ReplicationSource when ZK is gone
|
||||||
|
HBASE-4034 HRegionServer should be stopped even if no META regions
|
||||||
|
are hosted by the HRegionServer (Akash Ashok)
|
||||||
|
|
||||||
IMPROVEMENT
|
IMPROVEMENT
|
||||||
HBASE-3882 hbase-config.sh needs to be updated so it can auto-detects the
|
HBASE-3882 hbase-config.sh needs to be updated so it can auto-detects the
|
||||||
|
|
|
@ -615,7 +615,6 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler,
|
||||||
|
|
||||||
// We registered with the Master. Go into run mode.
|
// We registered with the Master. Go into run mode.
|
||||||
long lastMsg = 0;
|
long lastMsg = 0;
|
||||||
boolean onlyMetaRegionsRemaining = false;
|
|
||||||
long oldRequestCount = -1;
|
long oldRequestCount = -1;
|
||||||
// The main run loop.
|
// The main run loop.
|
||||||
while (!this.stopped && isHealthy()) {
|
while (!this.stopped && isHealthy()) {
|
||||||
|
@ -627,11 +626,11 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler,
|
||||||
LOG.info("Closing user regions");
|
LOG.info("Closing user regions");
|
||||||
closeUserRegions(this.abortRequested);
|
closeUserRegions(this.abortRequested);
|
||||||
} else if (this.stopping) {
|
} else if (this.stopping) {
|
||||||
LOG.info("Only meta regions remain open");
|
LOG.info("Stopping meta regions, if the HRegionServer hosts any");
|
||||||
if (!onlyMetaRegionsRemaining) {
|
|
||||||
onlyMetaRegionsRemaining = isOnlyMetaRegionsRemaining();
|
boolean allUserRegionsOffline = areAllUserRegionsOffline();
|
||||||
}
|
|
||||||
if (onlyMetaRegionsRemaining) {
|
if (allUserRegionsOffline) {
|
||||||
// Set stopped if no requests since last time we went around the loop.
|
// Set stopped if no requests since last time we went around the loop.
|
||||||
// The remaining meta regions will be closed on our way out.
|
// The remaining meta regions will be closed on our way out.
|
||||||
if (oldRequestCount == this.requestCount.get()) {
|
if (oldRequestCount == this.requestCount.get()) {
|
||||||
|
@ -721,17 +720,16 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler,
|
||||||
LOG.info(Thread.currentThread().getName() + " exiting");
|
LOG.info(Thread.currentThread().getName() + " exiting");
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isOnlyMetaRegionsRemaining() {
|
private boolean areAllUserRegionsOffline() {
|
||||||
if (getNumberOfOnlineRegions() > 2) return false;
|
if (getNumberOfOnlineRegions() > 2) return false;
|
||||||
boolean onlyMetaRegionsRemaining = false;
|
boolean allUserRegionsOffline = true;
|
||||||
for (Map.Entry<String, HRegion> e: this.onlineRegions.entrySet()) {
|
for (Map.Entry<String, HRegion> e: this.onlineRegions.entrySet()) {
|
||||||
if (!e.getValue().getRegionInfo().isMetaRegion()) {
|
if (!e.getValue().getRegionInfo().isMetaRegion()) {
|
||||||
onlyMetaRegionsRemaining = false;
|
allUserRegionsOffline = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
onlyMetaRegionsRemaining = true;
|
|
||||||
}
|
}
|
||||||
return onlyMetaRegionsRemaining;
|
return allUserRegionsOffline;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tryRegionServerReport()
|
void tryRegionServerReport()
|
||||||
|
|
Loading…
Reference in New Issue