hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject [1/5] hbase git commit: HBASE-17044 Fix merge failed before creating merged region leaves meta inconsistent
Date Tue, 15 Nov 2016 01:22:37 GMT
Repository: hbase
Updated Branches:
  refs/heads/0.98 ef9116336 -> 1ed735458
  refs/heads/branch-1 e01ee2fd1 -> e54826434
  refs/heads/branch-1.1 8012383d3 -> a268d4cf5
  refs/heads/branch-1.2 d6626eb6f -> c1701571d
  refs/heads/branch-1.3 66fbe9945 -> ca11c5870


HBASE-17044 Fix merge failed before creating merged region leaves meta inconsistent


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

Branch: refs/heads/0.98
Commit: 1ed735458e5e951cf62067c008219c1fdc784f0a
Parents: ef91163
Author: Andrew Purtell <apurtell@apache.org>
Authored: Mon Nov 14 12:28:19 2016 -0800
Committer: Andrew Purtell <apurtell@apache.org>
Committed: Mon Nov 14 17:14:24 2016 -0800

----------------------------------------------------------------------
 .../hadoop/hbase/master/AssignmentManager.java  | 36 +++++++++++++++-----
 1 file changed, 27 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/1ed73545/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 475d9ae..6100eda 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
@@ -3861,17 +3861,31 @@ public class AssignmentManager extends ZooKeeperListener {
         LOG.info("Failed to record merged region " + p.getShortNameToLog());
         return "Failed to record the merging in meta";
       }
-    } else {
-      mergingRegions.remove(encodedName);
-      regionOnline(a, sn);
-      regionOnline(b, sn);
+    }
+    return null;
+  }
+
+  private String onRegionMergeReverted(ServerName sn, TransitionCode code,
+	      final HRegionInfo p, final HRegionInfo a, final HRegionInfo b) {
+    RegionState rs_p = regionStates.getRegionState(p);
+    String encodedName = p.getEncodedName();
+    mergingRegions.remove(encodedName);
+
+    // Always bring the children back online. Even if they are not offline
+    // there's no harm in making them online again.
+    regionOnline(a, sn);
+    regionOnline(b, sn);
+
+    // Only offline the merging region if it is known to exist.
+    if (rs_p != null) {
       regionOffline(p);
+    }
 
-      if (isTableDisabledOrDisabling(p.getTable())) {
-        invokeUnAssign(a);
-        invokeUnAssign(b);
-      }
+    if (isTableDisabledOrDisabling(p.getTable())) {
+      invokeUnAssign(a);
+      invokeUnAssign(b);
     }
+
     return null;
   }
 
@@ -4249,11 +4263,15 @@ public class AssignmentManager extends ZooKeeperListener {
     case READY_TO_MERGE:
     case MERGE_PONR:
     case MERGED:
-    case MERGE_REVERTED:
       errorMsg = onRegionMerge(serverName, code, hri,
         HRegionInfo.convert(transition.getRegionInfo(1)),
         HRegionInfo.convert(transition.getRegionInfo(2)));
       break;
+    case MERGE_REVERTED:
+        errorMsg = onRegionMergeReverted(serverName, code, hri,
+                HRegionInfo.convert(transition.getRegionInfo(1)),
+                HRegionInfo.convert(transition.getRegionInfo(2)));
+      break;
 
     default:
       errorMsg = "Unexpected transition code " + code;


Mime
View raw message