hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject svn commit: r1556708 - /hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestAssignmentManagerOnCluster.java
Date Thu, 09 Jan 2014 03:19:31 GMT
Author: tedyu
Date: Thu Jan  9 03:19:31 2014
New Revision: 1556708

URL: http://svn.apache.org/r1556708
Log:
HBASE-10301 TestAssignmentManagerOnCluster#testOpenCloseRacing fails intermittently


Modified:
    hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestAssignmentManagerOnCluster.java

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=1556708&r1=1556707&r2=1556708&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
Thu Jan  9 03:19:31 2014
@@ -25,6 +25,7 @@ import static org.junit.Assert.assertTru
 import static org.junit.Assert.fail;
 
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Set;
 import java.util.concurrent.atomic.AtomicBoolean;
@@ -593,6 +594,7 @@ public class TestAssignmentManagerOnClus
       HRegionInfo hri = new HRegionInfo(
         desc.getTableName(), Bytes.toBytes("A"), Bytes.toBytes("Z"));
       MetaEditor.addRegionToMeta(meta, hri);
+      meta.close();
 
       MyRegionObserver.postOpenEnabled.set(true);
       MyRegionObserver.postOpenCalled = false;
@@ -619,7 +621,21 @@ public class TestAssignmentManagerOnClus
       // racing. This test is to make sure this scenario
       // is handled properly.
       MyRegionObserver.postOpenEnabled.set(false);
-      am.assign(hri, true, true);
+      ServerName destServerName = null;
+      int numRS = TEST_UTIL.getHBaseCluster().getLiveRegionServerThreads().size();
+      for (int i = 0; i < numRS; i++) {
+        HRegionServer destServer = TEST_UTIL.getHBaseCluster().getRegionServer(i);
+        if (!destServer.getServerName().equals(oldServerName)) {
+          destServerName = destServer.getServerName();
+          break;
+        }
+      }
+      assertNotNull(destServerName);
+      assertFalse("Region should be assigned on a new region server",
+        oldServerName.equals(destServerName));
+      List<HRegionInfo> regions = new ArrayList<HRegionInfo>();
+      regions.add(hri);
+      am.assign(destServerName, regions);
 
       // let's check if it's assigned after it's out of transition
       am.waitOnRegionToClearRegionsInTransition(hri);
@@ -628,7 +644,7 @@ public class TestAssignmentManagerOnClus
       ServerName serverName = master.getAssignmentManager().
         getRegionStates().getRegionServerOfRegion(hri);
       TEST_UTIL.assertRegionOnlyOnServer(hri, serverName, 200);
-      assertFalse("Region should assigned on a new region server",
+      assertFalse("Region should be assigned on a new region server",
         oldServerName.equals(serverName));
     } finally {
       MyRegionObserver.postOpenEnabled.set(false);



Mime
View raw message