pankaj72981 commented on a change in pull request #2780:
URL: https://github.com/apache/hbase/pull/2780#discussion_r554088624
##########
File path:
hbase-server/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsAdmin1.java
##########
@@ -621,4 +622,38 @@ public void testTableConstraint() throws Exception {
TEST_UTIL.deleteTable(tableName);
ADMIN.deleteNamespace(ns);
}
+
+ @Test
+ public void testHBASE25301() throws IOException, InterruptedException {
Review comment:
Please change the test method name.
##########
File path:
hbase-server/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsAdmin1.java
##########
@@ -621,4 +622,38 @@ public void testTableConstraint() throws Exception {
TEST_UTIL.deleteTable(tableName);
ADMIN.deleteNamespace(ns);
}
+
+ @Test
+ public void testHBASE25301() throws IOException, InterruptedException {
+ String pgroup = "pgroup";
+ ADMIN.addRSGroup(pgroup);
+
+ ServerName serverName0 =
TEST_UTIL.getMiniHBaseCluster().getRegionServer(0).getServerName();
+ ServerName serverName1 =
TEST_UTIL.getMiniHBaseCluster().getRegionServer(1).getServerName();
+ ADMIN.moveServersToRSGroup(Sets.newHashSet(serverName0.getAddress(),
serverName1.getAddress()),
+ pgroup);
+
+ TableName table1 = TableName.valueOf("table1");
+ TableName table2 = TableName.valueOf("table2");
+ TEST_UTIL.createTable(table1, "cf");
+ TEST_UTIL.createTable(table2, "cf");
+
+ ADMIN.setRSGroup(Sets.newHashSet(table1, table2), pgroup);
+
+ List<RegionInfo> regionInfoList = ADMIN.getRegions(table1);
+ regionInfoList.addAll(ADMIN.getRegions(table2));
+ for (RegionInfo regionInfo : regionInfoList) {
Review comment:
Please add comment in the test code for better redability, also check
before moving the region whether that is already assigned to serverName0.
##########
File path:
hbase-server/src/test/java/org/apache/hadoop/hbase/rsgroup/TestRSGroupsAdmin1.java
##########
@@ -621,4 +622,38 @@ public void testTableConstraint() throws Exception {
TEST_UTIL.deleteTable(tableName);
ADMIN.deleteNamespace(ns);
}
+
+ @Test
+ public void testHBASE25301() throws IOException, InterruptedException {
+ String pgroup = "pgroup";
+ ADMIN.addRSGroup(pgroup);
+
+ ServerName serverName0 =
TEST_UTIL.getMiniHBaseCluster().getRegionServer(0).getServerName();
+ ServerName serverName1 =
TEST_UTIL.getMiniHBaseCluster().getRegionServer(1).getServerName();
+ ADMIN.moveServersToRSGroup(Sets.newHashSet(serverName0.getAddress(),
serverName1.getAddress()),
+ pgroup);
+
+ TableName table1 = TableName.valueOf("table1");
+ TableName table2 = TableName.valueOf("table2");
+ TEST_UTIL.createTable(table1, "cf");
+ TEST_UTIL.createTable(table2, "cf");
+
+ ADMIN.setRSGroup(Sets.newHashSet(table1, table2), pgroup);
+
+ List<RegionInfo> regionInfoList = ADMIN.getRegions(table1);
+ regionInfoList.addAll(ADMIN.getRegions(table2));
+ for (RegionInfo regionInfo : regionInfoList) {
+ ADMIN.move(regionInfo.getEncodedNameAsBytes(), serverName0);
+ }
+
+ ADMIN.split(table2, "50".getBytes());
+ // Waiting briefly so that daughter regions are created but parent is not
cleaned yet.
+ Thread.sleep(2000);
Review comment:
Use Waiter.Predicate instead of thread sleep and check for region count
increase. Something like below,
https://github.com/apache/hbase/blob/5c233e9785c26f40deea32b772eaebe59401dbc8/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMultiRespectsLimits.java#L97
##########
File path:
hbase-server/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupInfoManagerImpl.java
##########
@@ -1130,6 +1130,12 @@ private boolean isTableInGroup(TableName tableName,
String groupName,
if (region.isSplitParent()) {
continue;
}
+
+ // isSplitParent() and isSplit() is not always reliable. So for those
scenarios, better to
Review comment:
Why isSplitParent() and isSplit() is not always reliable?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]