hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From syuanji...@apache.org
Subject hbase git commit: HBASE-17023 Region left unassigned due to AM and SSH each thinking others would do the assignment work (Stephen Yuan Jiang)
Date Sat, 10 Dec 2016 23:09:23 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1.3 8e0b8052e -> c43d759d9


HBASE-17023 Region left unassigned due to AM and SSH each thinking others would do the assignment
work (Stephen Yuan Jiang)


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/c43d759d
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/c43d759d
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/c43d759d

Branch: refs/heads/branch-1.3
Commit: c43d759d94990775be7ecd71b6f50e3f21516b4d
Parents: 8e0b805
Author: Stephen Yuan Jiang <syuanjiangdev@gmail.com>
Authored: Sat Dec 10 15:05:00 2016 -0800
Committer: Stephen Yuan Jiang <syuanjiangdev@gmail.com>
Committed: Sat Dec 10 15:07:21 2016 -0800

----------------------------------------------------------------------
 .../hadoop/hbase/master/AssignmentManager.java  |  3 +--
 .../hadoop/hbase/master/RegionStates.java       | 25 ++++++++++++++++++++
 .../master/handler/ClosedRegionHandler.java     |  3 +--
 3 files changed, 27 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/c43d759d/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
index ba3e427..1af826e 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
@@ -838,8 +838,7 @@ public class AssignmentManager extends ZooKeeperListener {
       case RS_ZK_REGION_CLOSED:
       case RS_ZK_REGION_FAILED_OPEN:
         // Region is closed, insert into RIT and handle it
-        regionStates.setLastRegionServerOfRegion(sn, encodedName);
-        regionStates.updateRegionState(regionInfo, State.CLOSED, sn);
+        regionStates.setRegionStateTOCLOSED(regionInfo, sn);
         if (!replicasToClose.contains(regionInfo)) {
           invokeAssign(regionInfo);
         } else {

http://git-wip-us.apache.org/repos/asf/hbase/blob/c43d759d/hbase-server/src/main/java/org/apache/hadoop/hbase/master/RegionStates.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/RegionStates.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/RegionStates.java
index 7289047..9d68a85 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/RegionStates.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/RegionStates.java
@@ -387,6 +387,31 @@ public class RegionStates {
   }
 
   /**
+   * Set the region state to CLOSED
+   */
+  public RegionState setRegionStateTOCLOSED(
+      final HRegionInfo regionInfo,
+      final ServerName serverName) {
+    ServerName sn = serverName;
+    if (sn == null) {
+      RegionState regionState = getRegionState(regionInfo.getEncodedName());
+      if (regionState != null) {
+        sn = regionState.getServerName();
+      }
+      // TODO: if sn is null, should we dig into
+      // lastAssignments.get(regionInfo.getEncodedName() to get the server name?
+      // For now, I just keep the same logic that works in the past
+    }
+    // We have to make sure that the last region server is set to be the same as the
+    // current RS.  If we don't do that, we could run into situation that both AM and SSH
+    // think other would do the assignment work; at the end, neither does the work and
+    // region remains RIT.
+    // See HBASE-13330 and HBASE-17023
+    setLastRegionServerOfRegion(sn, regionInfo.getEncodedName());
+    return updateRegionState(regionInfo, State.CLOSED, sn);
+  }
+
+  /**
    * Update a region state. It will be put in transition if not already there.
    */
   public RegionState updateRegionState(

http://git-wip-us.apache.org/repos/asf/hbase/blob/c43d759d/hbase-server/src/main/java/org/apache/hadoop/hbase/master/handler/ClosedRegionHandler.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/handler/ClosedRegionHandler.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/handler/ClosedRegionHandler.java
index e0e4ee4..74b45bc 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/handler/ClosedRegionHandler.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/handler/ClosedRegionHandler.java
@@ -99,8 +99,7 @@ public class ClosedRegionHandler extends EventHandler implements TotesHRegionInf
       return;
     }
     // ZK Node is in CLOSED state, assign it.
-    assignmentManager.getRegionStates().updateRegionState(
-      regionInfo, RegionState.State.CLOSED);
+    assignmentManager.getRegionStates().setRegionStateTOCLOSED(regionInfo, null);
     // This below has to do w/ online enable/disable of a table
     assignmentManager.removeClosedRegion(regionInfo);
     assignmentManager.assign(regionInfo, true);


Mime
View raw message