hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject [4/5] hbase git commit: HBASE-17044 Fix merge failed before creating merged region leaves meta inconsistent
Date Tue, 15 Nov 2016 01:22:40 GMT
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/c1701571
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/c1701571
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/c1701571

Branch: refs/heads/branch-1.2
Commit: c1701571d89b9f74413e6a397cfa0da4cf5edf76
Parents: d6626eb
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:51 2016 -0800

----------------------------------------------------------------------
 .../hadoop/hbase/master/AssignmentManager.java  | 38 ++++++++++++++------
 1 file changed, 28 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/c1701571/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 4a04962..dc9c585 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
@@ -3869,18 +3869,32 @@ 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 (getTableStateManager().isTableState(p.getTable(),
-          ZooKeeperProtos.Table.State.DISABLED, ZooKeeperProtos.Table.State.DISABLING)) {
-        invokeUnAssign(a);
-        invokeUnAssign(b);
-      }
+    if (getTableStateManager().isTableState(p.getTable(),
+        ZooKeeperProtos.Table.State.DISABLED, ZooKeeperProtos.Table.State.DISABLING)) {
+      invokeUnAssign(a);
+      invokeUnAssign(b);
     }
+
     return null;
   }
 
@@ -4408,7 +4422,6 @@ 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)));
@@ -4420,6 +4433,11 @@ public class AssignmentManager extends ZooKeeperListener {
         }
       }
       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