diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java index 789626399f9..d097f46168f 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java @@ -877,13 +877,14 @@ public class HRegionServer implements ClientProtos.ClientService.BlockingInterfa } 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 @@ -1033,6 +1034,17 @@ public class HRegionServer implements ClientProtos.ClientService.BlockingInterfa 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(long reportStartTime, long reportEndTime) throws IOException { if (this.rssStub == null) {