YutSean commented on a change in pull request #3875:
URL: https://github.com/apache/hbase/pull/3875#discussion_r757528621



##########
File path: 
hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMaster.java
##########
@@ -188,5 +192,48 @@ public void testMoveThrowsPleaseHoldException() throws 
IOException {
       TEST_UTIL.deleteTable(tableName);
     }
   }
+
+  @Test (timeout = 300000)
+  public void testMoveRegionWhenMetaRegionInTransition()
+    throws IOException, InterruptedException, KeeperException {
+    TableName tableName = 
TableName.valueOf("testMoveRegionWhenMetaRegionInTransition");
+    HMaster master = TEST_UTIL.getMiniHBaseCluster().getMaster();
+    HTableDescriptor htd = new HTableDescriptor(tableName);
+    HColumnDescriptor hcd = new HColumnDescriptor("value");
+    RegionStates regionStates = 
master.getAssignmentManager().getRegionStates();
+    htd.addFamily(hcd);
+
+    admin.createTable(htd, null);
+    try {
+      HRegionInfo hri = admin.getTableRegions(tableName).get(0);
+
+      HRegionInfo metaRegion = 
admin.getTableRegions(TableName.META_TABLE_NAME).get(0);
+
+      ServerName rs0 = 
TEST_UTIL.getHBaseCluster().getRegionServer(0).getServerName();
+      ServerName rs1 = 
TEST_UTIL.getHBaseCluster().getRegionServer(1).getServerName();
+
+      admin.move(hri.getEncodedNameAsBytes(), rs0.getServerName().getBytes());
+      while (regionStates.isRegionInTransition(hri)) {
+        // Make sure the region is not in transition
+        Thread.sleep(1000);
+      }
+      // Meta region should be in transition
+      master.assignmentManager.unassign(metaRegion);
+      //    master.assignmentManager.regionOffline(metaRegion);
+      // Then move the region to a new region server.
+      admin.move(hri.getEncodedNameAsBytes(), rs1.getServerName().getBytes());
+
+      // The region should be still on rs0.
+      TEST_UTIL.assertRegionOnServer(hri, rs0, 5000);
+
+      // Wait until the meta region is reassigned.
+      admin.assign(metaRegion.getEncodedNameAsBytes());
+      while (regionStates.isMetaRegionInTransition()) {
+        Thread.sleep(1000);
+      }

Review comment:
       Agreed, this makes the test logic complete. Fixed in the latest commit.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@hbase.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to