hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject hbase git commit: HBASE-15058 AssignmentManager should account for unsuccessful split correctly which initially passes quota check
Date Tue, 05 Jan 2016 14:24:45 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1 2797adf45 -> 407cda4a0


HBASE-15058 AssignmentManager should account for unsuccessful split correctly which initially
passes quota check


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

Branch: refs/heads/branch-1
Commit: 407cda4a0c4bc1338af175299372a4b1976bb44a
Parents: 2797adf
Author: tedyu <yuzhihong@gmail.com>
Authored: Tue Jan 5 06:24:42 2016 -0800
Committer: tedyu <yuzhihong@gmail.com>
Committed: Tue Jan 5 06:24:42 2016 -0800

----------------------------------------------------------------------
 .../hadoop/hbase/master/AssignmentManager.java  | 46 +++++++++++++++-----
 1 file changed, 35 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/407cda4a/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 fd5d192..83f9d72 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
@@ -3720,7 +3720,7 @@ public class AssignmentManager extends ZooKeeperListener {
     invokeAssign(hri, false);
   }
 
-  private String onRegionSplit(ServerName sn, TransitionCode code,
+  private String checkInStateForSplit(ServerName sn,
       final HRegionInfo p, final HRegionInfo a, final HRegionInfo b) {
     final RegionState rs_p = regionStates.getRegionState(p);
     RegionState rs_a = regionStates.getRegionState(a);
@@ -3730,6 +3730,32 @@ public class AssignmentManager extends ZooKeeperListener {
         && (rs_b == null || rs_b.isOpenOrSplittingNewOnServer(sn)))) {
       return "Not in state good for split";
     }
+    return "";
+  }
+
+  private String onRegionSplitReverted(ServerName sn,
+      final HRegionInfo p, final HRegionInfo a, final HRegionInfo b) {
+    String s = checkInStateForSplit(sn, p, a, b);
+    if (!org.apache.commons.lang.StringUtils.isEmpty(s)) {
+      return s;
+    }
+    regionOnline(p, sn);
+    regionOffline(a);
+    regionOffline(b);
+
+    if (getTableStateManager().isTableState(p.getTable(),
+        ZooKeeperProtos.Table.State.DISABLED, ZooKeeperProtos.Table.State.DISABLING)) {
+      invokeUnAssign(p);
+    }
+    return null;
+  }
+
+  private String onRegionSplit(ServerName sn, TransitionCode code,
+      final HRegionInfo p, final HRegionInfo a, final HRegionInfo b) {
+    String s = checkInStateForSplit(sn, p, a, b);
+    if (!org.apache.commons.lang.StringUtils.isEmpty(s)) {
+      return s;
+    }
 
     regionStates.updateRegionState(a, State.SPLITTING_NEW, sn);
     regionStates.updateRegionState(b, State.SPLITTING_NEW, sn);
@@ -3765,15 +3791,6 @@ public class AssignmentManager extends ZooKeeperListener {
         LOG.info("Failed to record split region " + p.getShortNameToLog());
         return "Failed to record the splitting in meta";
       }
-    } else if (code == TransitionCode.SPLIT_REVERTED) {
-      regionOnline(p, sn);
-      regionOffline(a);
-      regionOffline(b);
-
-      if (getTableStateManager().isTableState(p.getTable(),
-          ZooKeeperProtos.Table.State.DISABLED, ZooKeeperProtos.Table.State.DISABLING)) {
-        invokeUnAssign(p);
-      }
     }
     return null;
   }
@@ -4338,11 +4355,18 @@ public class AssignmentManager extends ZooKeeperListener {
       } catch (IOException exp) {
         errorMsg = StringUtils.stringifyException(exp);
       }
+      break;
     case SPLIT_PONR:
     case SPLIT:
+      errorMsg =
+      onRegionSplit(serverName, code, hri, HRegionInfo.convert(transition.getRegionInfo(1)),
+        HRegionInfo.convert(transition.getRegionInfo(2)));
+      break;
+
     case SPLIT_REVERTED:
       errorMsg =
-          onRegionSplit(serverName, code, hri, HRegionInfo.convert(transition.getRegionInfo(1)),
+          onRegionSplitReverted(serverName, hri,
+            HRegionInfo.convert(transition.getRegionInfo(1)),
             HRegionInfo.convert(transition.getRegionInfo(2)));
       if (org.apache.commons.lang.StringUtils.isEmpty(errorMsg)) {
         try {


Mime
View raw message