hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jxi...@apache.org
Subject svn commit: r1532633 - in /hbase/trunk/hbase-server/src: main/java/org/apache/hadoop/hbase/master/AssignmentManager.java test/java/org/apache/hadoop/hbase/master/TestAssignmentManagerOnCluster.java
Date Wed, 16 Oct 2013 02:44:59 GMT
Author: jxiang
Date: Wed Oct 16 02:44:59 2013
New Revision: 1532633

URL: http://svn.apache.org/r1532633
Log:
HBASE-9773 Master aborted when hbck asked the master to assign a region that was already online

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/master/TestAssignmentManagerOnCluster.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=1532633&r1=1532632&r2=1532633&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
Wed Oct 16 02:44:59 2013
@@ -1684,6 +1684,9 @@ public class AssignmentManager extends Z
           versionOfClosingNode, dest, transitionInZK)) {
           LOG.debug("Sent CLOSE to " + server + " for region " +
             region.getRegionNameAsString());
+          if (!transitionInZK && state != null) {
+            regionOffline(region);
+          }
           return;
         }
         // This never happens. Currently regionserver close always return true.

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestAssignmentManagerOnCluster.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestAssignmentManagerOnCluster.java?rev=1532633&r1=1532632&r2=1532633&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestAssignmentManagerOnCluster.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestAssignmentManagerOnCluster.java
Wed Oct 16 02:44:59 2013
@@ -112,11 +112,21 @@ public class TestAssignmentManagerOnClus
 
       HMaster master = TEST_UTIL.getHBaseCluster().getMaster();
       master.assignRegion(hri);
-      master.getAssignmentManager().waitForAssignment(hri);
+      AssignmentManager am = master.getAssignmentManager();
+      am.waitForAssignment(hri);
 
-      ServerName serverName = master.getAssignmentManager().
-        getRegionStates().getRegionServerOfRegion(hri);
+      RegionStates regionStates = am.getRegionStates();
+      ServerName serverName = regionStates.getRegionServerOfRegion(hri);
       TEST_UTIL.assertRegionOnServer(hri, serverName, 200);
+
+      // Region is assigned now. Let's assign it again.
+      // Master should not abort, and region should be assigned.
+      RegionState oldState = regionStates.getRegionState(hri);
+      TEST_UTIL.getHBaseAdmin().assign(hri.getRegionName());
+      master.getAssignmentManager().waitForAssignment(hri);
+      RegionState newState = regionStates.getRegionState(hri);
+      assertTrue(newState.isOpened()
+        && newState.getStamp() != oldState.getStamp());
     } finally {
       TEST_UTIL.deleteTable(Bytes.toBytes(table));
     }



Mime
View raw message