hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r1568709 - /hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
Date Sun, 16 Feb 2014 02:01:06 GMT
Author: stack
Date: Sun Feb 16 02:01:05 2014
New Revision: 1568709

URL: http://svn.apache.org/r1568709
Log:
HBASE-10545 RS Hangs waiting on region to close on shutdown; has to timeout before can go
down

Modified:
    hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java

Modified: hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java?rev=1568709&r1=1568708&r2=1568709&view=diff
==============================================================================
--- hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
(original)
+++ hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
Sun Feb 16 02:01:05 2014
@@ -821,13 +821,14 @@ public class HRegionServer implements Cl
           } 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
@@ -977,6 +978,17 @@ public class HRegionServer implements Cl
     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)
   throws IOException {
     if (this.rssStub == null) {



Mime
View raw message