HBASE-10545 RS Hangs waiting on region to close on shutdown; has to timeout before can go down

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1568707 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2014-02-16 02:00:20 +00:00
parent aa111b80b7
commit f3072b07bf
1 changed files with 16 additions and 4 deletions

View File

@ -877,13 +877,14 @@ public class HRegionServer implements ClientProtos.ClientService.BlockingInterfa
} else if (this.stopping) { } else if (this.stopping) {
boolean allUserRegionsOffline = areAllUserRegionsOffline(); boolean allUserRegionsOffline = areAllUserRegionsOffline();
if (allUserRegionsOffline) { if (allUserRegionsOffline) {
// Set stopped if no requests since last time we went around the loop. // Set stopped if no more write requests tp meta tables
// The remaining meta regions will be closed on our way out. // since last time we went around the loop. Any open
if (oldRequestCount == this.requestCount.get()) { // meta regions will be closed on our way out.
if (oldRequestCount == getWriteRequestCount()) {
stop("Stopped; only catalog regions remaining online"); stop("Stopped; only catalog regions remaining online");
break; break;
} }
oldRequestCount = this.requestCount.get(); oldRequestCount = getWriteRequestCount();
} else { } else {
// Make sure all regions have been closed -- some regions may // Make sure all regions have been closed -- some regions may
// have not got it because we were splitting at the time of // 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 allUserRegionsOffline;
} }
/**
* @return Current write count for all online regions.
*/
private long getWriteRequestCount() {
int writeCount = 0;
for (Map.Entry<String, HRegion> e: this.onlineRegions.entrySet()) {
writeCount += e.getValue().getWriteRequestsCount();
}
return writeCount;
}
void tryRegionServerReport(long reportStartTime, long reportEndTime) void tryRegionServerReport(long reportStartTime, long reportEndTime)
throws IOException { throws IOException {
if (this.rssStub == null) { if (this.rssStub == null) {