Index: src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java (revision 1568709) +++ src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java (working copy) @@ -779,13 +779,14 @@ } else if (this.stopping) { boolean allUserRegionsOffline = areAllUserRegionsOffline(); if (allUserRegionsOffline) { - // Set stopped if no requests since last time we went around the loop. - // The remaining meta regions will be closed on our way out. - if (oldRequestCount == this.requestCount.get()) { + // Set stopped if no more write requests tp meta tables + // since last time we went around the loop. Any open + // meta regions will be closed on our way out. + if (oldRequestCount == getWriteRequestCount()) { stop("Stopped; only catalog regions remaining online"); break; } - oldRequestCount = this.requestCount.get(); + oldRequestCount = getWriteRequestCount(); } else { // Make sure all regions have been closed -- some regions may // have not got it because we were splitting at the time of @@ -927,6 +928,17 @@ return allUserRegionsOffline; } + /** + * @return Current write count for all online regions. + */ + private long getWriteRequestCount() { + int writeCount = 0; + for (Map.Entry e: this.onlineRegions.entrySet()) { + writeCount += e.getValue().getWriteRequestsCount(); + } + return writeCount; + } + void tryRegionServerReport() throws IOException { if (!keepLooping() && hbaseMaster == null) {