You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2021/12/03 07:51:39 UTC
[GitHub] [hbase] virajjasani commented on a change in pull request #3875: HBASE-26459 HMaster should move non-meta region only if meta is ONLINE
virajjasani commented on a change in pull request #3875:
URL: https://github.com/apache/hbase/pull/3875#discussion_r761711794
##########
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:
@YutSean sorry for this miss. Can you add assert fail after this line?
e.g. `Assert.fail("admin move should not be successful here")`
So that we will be certain that Exception is thrown all the time and also catch block takes care of asserting the Error message from the Exception.
--
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-unsubscribe@hbase.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org