HBASE-4341 HRS#closeAllRegions should take care of HRS#onlineRegions's weak consistency

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1166754 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2011-09-08 15:38:04 +00:00
parent 9a54fc8a4f
commit 52ccf8db35
2 changed files with 14 additions and 2 deletions

View File

@ -245,6 +245,8 @@ Release 0.91.0 - Unreleased
(Alejandro Abdelnur via todd) (Alejandro Abdelnur via todd)
HBASE-4271 Clean up coprocessor handling of table operations HBASE-4271 Clean up coprocessor handling of table operations
(Ming Ma via garyh) (Ming Ma via garyh)
HBASE-4341 HRS#closeAllRegions should take care of HRS#onlineRegions's
weak consistency (Jieshan Bean)
IMPROVEMENTS IMPROVEMENTS
HBASE-3290 Max Compaction Size (Nicolas Spiegelberg via Stack) HBASE-3290 Max Compaction Size (Nicolas Spiegelberg via Stack)

View File

@ -704,7 +704,7 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler,
// Interrupt catalog tracker here in case any regions being opened out in // Interrupt catalog tracker here in case any regions being opened out in
// handlers are stuck waiting on meta or root. // handlers are stuck waiting on meta or root.
if (this.catalogTracker != null) this.catalogTracker.stop(); if (this.catalogTracker != null) this.catalogTracker.stop();
if (this.fsOk) waitOnAllRegionsToClose(); if (this.fsOk) waitOnAllRegionsToClose(abortRequested);
// Make sure the proxy is down. // Make sure the proxy is down.
if (this.hbaseMaster != null) { if (this.hbaseMaster != null) {
@ -783,7 +783,7 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler,
/** /**
* Wait on regions close. * Wait on regions close.
*/ */
private void waitOnAllRegionsToClose() { private void waitOnAllRegionsToClose(final boolean abort) {
// Wait till all regions are closed before going out. // Wait till all regions are closed before going out.
int lastCount = -1; int lastCount = -1;
while (!isOnlineRegionsEmpty()) { while (!isOnlineRegionsEmpty()) {
@ -798,6 +798,16 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler,
LOG.debug(this.onlineRegions); LOG.debug(this.onlineRegions);
} }
} }
// Ensure all user regions have been sent a close. Use this to
// protect against the case where an open comes in after we start the
// iterator of onlineRegions to close all user regions.
for (Map.Entry<String, HRegion> e : this.onlineRegions.entrySet()) {
HRegionInfo hri = e.getValue().getRegionInfo();
if (!this.regionsInTransitionInRS.contains(hri.getEncodedNameAsBytes())) {
// Don't update zk with this close transition; pass false.
closeRegion(hri, abort, false);
}
}
Threads.sleep(1000); Threads.sleep(1000);
} }
} }