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



##########
File path: 
hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMaster.java
##########
@@ -188,5 +193,59 @@ 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);
+      // Then move the region to a new region server.
+      try{
+        master.move(hri.getEncodedNameAsBytes(), 
rs1.getServerName().getBytes());

Review comment:
       OK. Let me add this.




-- 
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