hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jxi...@apache.org
Subject svn commit: r1523832 - in /hbase/trunk/hbase-server/src: main/java/org/apache/hadoop/hbase/master/ test/java/org/apache/hadoop/hbase/regionserver/
Date Mon, 16 Sep 2013 23:05:30 GMT
Author: jxiang
Date: Mon Sep 16 23:05:30 2013
New Revision: 1523832

URL: http://svn.apache.org/r1523832
Log:
HBASE-9525 "Move" region right after a region split is dangerous

Modified:
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
    hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionMergeTransactionOnCluster.java
    hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java?rev=1523832&r1=1523831&r2=1523832&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
Mon Sep 16 23:05:30 2013
@@ -2295,6 +2295,13 @@ public class AssignmentManager extends Z
     RegionState state = regionStates.getRegionTransitionState(encodedName);
     try {
       if (state == null) {
+        // Region is not in transition.
+        // We can unassign it only if it's not SPLIT/MERGED.
+        state = regionStates.getRegionState(encodedName);
+        if (state.isMerged() || state.isSplit()) {
+          LOG.info("Attempting to unassign " + state + ", ignored");
+          return;
+        }
         // Create the znode in CLOSING state
         try {
           state = regionStates.getRegionState(region);
@@ -2307,7 +2314,7 @@ public class AssignmentManager extends Z
           versionOfClosingNode = ZKAssign.createNodeClosing(
             watcher, region, state.getServerName());
           if (versionOfClosingNode == -1) {
-            LOG.debug("Attempting to unassign " +
+            LOG.info("Attempting to unassign " +
                 region.getRegionNameAsString() + " but ZK closing node "
                 + "can't be created.");
             return;

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionMergeTransactionOnCluster.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionMergeTransactionOnCluster.java?rev=1523832&r1=1523831&r2=1523832&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionMergeTransactionOnCluster.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionMergeTransactionOnCluster.java
Mon Sep 16 23:05:30 2013
@@ -140,9 +140,15 @@ public class TestRegionMergeTransactionO
 
     // We should not be able to assign it again
     am.assign(hri, true, true);
-    assertFalse("Merged region should not be in transition again",
-      regionStates.isRegionInTransition(hri)
-        && regionStates.isRegionInState(hri, State.MERGED));
+    assertFalse("Merged region can't be assigned",
+      regionStates.isRegionInTransition(hri));
+    assertTrue(regionStates.isRegionInState(hri, State.MERGED));
+
+    // We should not be able to unassign it either
+    am.unassign(hri, true, null);
+    assertFalse("Merged region can't be unassigned",
+      regionStates.isRegionInTransition(hri));
+    assertTrue(regionStates.isRegionInState(hri, State.MERGED));
 
     table.close();
   }

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java?rev=1523832&r1=1523831&r2=1523832&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java
Mon Sep 16 23:05:30 2013
@@ -850,9 +850,15 @@ public class TestSplitTransactionOnClust
 
       // We should not be able to assign it again
       am.assign(hri, true, true);
-      assertFalse("Split region should not be in transition again",
-        regionStates.isRegionInTransition(hri)
-          && regionStates.isRegionInState(hri, State.SPLIT));
+      assertFalse("Split region can't be assigned",
+        regionStates.isRegionInTransition(hri));
+      assertTrue(regionStates.isRegionInState(hri, State.SPLIT));
+
+      // We should not be able to unassign it either
+      am.unassign(hri, true, null);
+      assertFalse("Split region can't be unassigned",
+        regionStates.isRegionInTransition(hri));
+      assertTrue(regionStates.isRegionInState(hri, State.SPLIT));
     } finally {
       admin.setBalancerRunning(true, false);
       cluster.getMaster().setCatalogJanitorEnabled(true);



Mime
View raw message