diff --git a/CHANGES.txt b/CHANGES.txt index 6ea83511df7..4cc8c9bac16 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -245,6 +245,8 @@ Release 0.91.0 - Unreleased (Alejandro Abdelnur via todd) HBASE-4271 Clean up coprocessor handling of table operations (Ming Ma via garyh) + HBASE-4341 HRS#closeAllRegions should take care of HRS#onlineRegions's + weak consistency (Jieshan Bean) IMPROVEMENTS HBASE-3290 Max Compaction Size (Nicolas Spiegelberg via Stack) diff --git a/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java b/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java index 2f97a397438..83523f3b93d 100644 --- a/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java +++ b/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java @@ -704,7 +704,7 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler, // 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(); - if (this.fsOk) waitOnAllRegionsToClose(); + if (this.fsOk) waitOnAllRegionsToClose(abortRequested); // Make sure the proxy is down. if (this.hbaseMaster != null) { @@ -783,7 +783,7 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler, /** * Wait on regions close. */ - private void waitOnAllRegionsToClose() { + private void waitOnAllRegionsToClose(final boolean abort) { // Wait till all regions are closed before going out. int lastCount = -1; while (!isOnlineRegionsEmpty()) { @@ -798,6 +798,16 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler, 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 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); } }