HBASE-6713 Stopping META/ROOT RS may take 50mins when some region is splitting (Chunhui)
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1382164 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2845bf5587
commit
2c270de896
|
@ -932,17 +932,29 @@ public class HRegionServer implements ClientProtocol,
|
|||
// Just skip out w/o closing regions. Used when testing.
|
||||
} else if (abortRequested) {
|
||||
if (this.fsOk) {
|
||||
closeAllRegions(abortRequested); // Don't leave any open file handles
|
||||
closeUserRegions(abortRequested); // Don't leave any open file handles
|
||||
}
|
||||
LOG.info("aborting server " + this.serverNameFromMasterPOV);
|
||||
} else {
|
||||
closeAllRegions(abortRequested);
|
||||
closeUserRegions(abortRequested);
|
||||
closeAllScanners();
|
||||
LOG.info("stopping server " + this.serverNameFromMasterPOV);
|
||||
}
|
||||
// Interrupt catalog tracker here in case any regions being opened out in
|
||||
// handlers are stuck waiting on meta or root.
|
||||
if (this.catalogTracker != null) this.catalogTracker.stop();
|
||||
|
||||
// Closing the compactSplit thread before closing meta regions
|
||||
if (!this.killed && containsMetaTableRegions()) {
|
||||
if (!abortRequested || this.fsOk) {
|
||||
if (this.compactSplitThread != null) {
|
||||
this.compactSplitThread.join();
|
||||
this.compactSplitThread = null;
|
||||
}
|
||||
closeMetaTableRegions(abortRequested);
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.killed && this.fsOk) {
|
||||
waitOnAllRegionsToClose(abortRequested);
|
||||
LOG.info("stopping server " + this.serverNameFromMasterPOV +
|
||||
|
@ -980,11 +992,16 @@ public class HRegionServer implements ClientProtocol,
|
|||
LOG.info(Thread.currentThread().getName() + " exiting");
|
||||
}
|
||||
|
||||
private boolean containsMetaTableRegions() {
|
||||
return onlineRegions.containsKey(HRegionInfo.ROOT_REGIONINFO.getEncodedName())
|
||||
|| onlineRegions.containsKey(HRegionInfo.FIRST_META_REGIONINFO.getEncodedName());
|
||||
}
|
||||
|
||||
private boolean areAllUserRegionsOffline() {
|
||||
if (getNumberOfOnlineRegions() > 2) return false;
|
||||
boolean allUserRegionsOffline = true;
|
||||
for (Map.Entry<String, HRegion> e: this.onlineRegions.entrySet()) {
|
||||
if (!e.getValue().getRegionInfo().isMetaRegion()) {
|
||||
if (!e.getValue().getRegionInfo().isMetaTable()) {
|
||||
allUserRegionsOffline = false;
|
||||
break;
|
||||
}
|
||||
|
@ -2011,7 +2028,14 @@ public class HRegionServer implements ClientProtocol,
|
|||
*/
|
||||
protected void closeAllRegions(final boolean abort) {
|
||||
closeUserRegions(abort);
|
||||
// Only root and meta should remain. Are we carrying root or meta?
|
||||
closeMetaTableRegions(abort);
|
||||
}
|
||||
|
||||
/**
|
||||
* Close root and meta regions if we carry them
|
||||
* @param abort Whether we're running an abort.
|
||||
*/
|
||||
void closeMetaTableRegions(final boolean abort) {
|
||||
HRegion meta = null;
|
||||
HRegion root = null;
|
||||
this.lock.writeLock().lock();
|
||||
|
@ -2043,7 +2067,7 @@ public class HRegionServer implements ClientProtocol,
|
|||
try {
|
||||
for (Map.Entry<String, HRegion> e: this.onlineRegions.entrySet()) {
|
||||
HRegion r = e.getValue();
|
||||
if (!r.getRegionInfo().isMetaRegion() && r.isAvailable()) {
|
||||
if (!r.getRegionInfo().isMetaTable() && r.isAvailable()) {
|
||||
// Don't update zk with this close transition; pass false.
|
||||
closeRegion(r.getRegionInfo(), abort, false);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue