virajjasani commented on code in PR #8264:
URL: https://github.com/apache/hbase/pull/8264#discussion_r3385301550
##########
hbase-server/src/test/java/org/apache/hadoop/hbase/master/assignment/TestRegionSplit.java:
##########
@@ -155,6 +156,57 @@ public void testSplitTableRegion() throws Exception {
regionInfoMap.get(tableRegions.get(1).getRegionInfo()));
}
+ @Test
+ public void testRITWithSplitTableRegion() throws Exception {
+ final TableName tableName = TableName.valueOf(testMethodName);
+ final ProcedureExecutor<MasterProcedureEnv> procExec =
getMasterProcedureExecutor();
+
+ RegionInfo[] regions =
+ MasterProcedureTestingUtility.createTable(procExec, tableName, null,
columnFamilyName);
+ insertData(UTIL, tableName, rowCount, startRowNum, columnFamilyName);
+ int splitRowNum = startRowNum + rowCount / 2;
+ byte[] splitKey = Bytes.toBytes("" + splitRowNum);
+
+ assertNotNull(regions, "not able to find a splittable region");
+ assertEquals(1, regions.length, "not able to find a splittable region");
+ assertFalse(AssignmentTestingUtil.isRegionInTransition(regions[0],
+ UTIL.getHBaseCluster().getMaster().getAssignmentManager()));
+
+ ServerName targetRS =
UTIL.getHBaseCluster().getMaster().getAssignmentManager()
+ .getRegionStates().getRegionServerOfRegion(regions[0]);
+ // Split region of the table
+ long procId = procExec.submitProcedure(
+ new SplitTableRegionProcedure(procExec.getEnvironment(), regions[0],
splitKey));
+ // Wait the completion
+ ProcedureTestingUtility.waitProcedure(procExec, procId);
+ ProcedureTestingUtility.assertProcNotFailed(procExec, procId);
+
+ assertEquals(2, UTIL.getHBaseCluster().getRegions(tableName).size(), "not
able to split table");
+ assertFalse(AssignmentTestingUtil.isRegionInTransition(regions[0],
+ UTIL.getHBaseCluster().getMaster().getAssignmentManager()));
+ // As there are only 3 RS, start one more RS before expiring one
+ UTIL.getHBaseCluster().startRegionServer();
+
+ // We don't want SCP to complete so kill PR it after store update
+ ProcedureTestingUtility
+
.toggleKillAfterStoreUpdate(UTIL.getHBaseCluster().getMaster().getMasterProcedureExecutor());
+ // stop RS holding split parent to create SCP and add RS into
deadServerList
+
UTIL.getHBaseCluster().getMaster().getServerManager().expireServer(targetRS);
+
+ // stop master
+ UTIL.getHBaseCluster().stopMaster(0);
+ UTIL.getHBaseCluster().waitOnMaster(0);
+
+ // restart master
+ UTIL.getHBaseCluster().startMaster();
+ assertTrue(UTIL.getHBaseCluster().waitForActiveAndReadyMaster(30000),
+ "Master failed to initialize in in 30 seconds");
+ UTIL.invalidateConnection();
+
+ assertFalse(AssignmentTestingUtil.isRegionInTransition(regions[0],
+ UTIL.getHBaseCluster().getMaster().getAssignmentManager()));
Review Comment:
same here after this? check for region[0] being split and offline?
##########
hbase-server/src/test/java/org/apache/hadoop/hbase/master/assignment/TestRegionSplit.java:
##########
@@ -155,6 +156,57 @@ public void testSplitTableRegion() throws Exception {
regionInfoMap.get(tableRegions.get(1).getRegionInfo()));
}
+ @Test
+ public void testRITWithSplitTableRegion() throws Exception {
+ final TableName tableName = TableName.valueOf(testMethodName);
+ final ProcedureExecutor<MasterProcedureEnv> procExec =
getMasterProcedureExecutor();
+
+ RegionInfo[] regions =
+ MasterProcedureTestingUtility.createTable(procExec, tableName, null,
columnFamilyName);
+ insertData(UTIL, tableName, rowCount, startRowNum, columnFamilyName);
+ int splitRowNum = startRowNum + rowCount / 2;
+ byte[] splitKey = Bytes.toBytes("" + splitRowNum);
+
+ assertNotNull(regions, "not able to find a splittable region");
+ assertEquals(1, regions.length, "not able to find a splittable region");
+ assertFalse(AssignmentTestingUtil.isRegionInTransition(regions[0],
+ UTIL.getHBaseCluster().getMaster().getAssignmentManager()));
+
+ ServerName targetRS =
UTIL.getHBaseCluster().getMaster().getAssignmentManager()
+ .getRegionStates().getRegionServerOfRegion(regions[0]);
+ // Split region of the table
+ long procId = procExec.submitProcedure(
+ new SplitTableRegionProcedure(procExec.getEnvironment(), regions[0],
splitKey));
+ // Wait the completion
+ ProcedureTestingUtility.waitProcedure(procExec, procId);
+ ProcedureTestingUtility.assertProcNotFailed(procExec, procId);
+
+ assertEquals(2, UTIL.getHBaseCluster().getRegions(tableName).size(), "not
able to split table");
+ assertFalse(AssignmentTestingUtil.isRegionInTransition(regions[0],
+ UTIL.getHBaseCluster().getMaster().getAssignmentManager()));
Review Comment:
After this, can we also check for region[0] to be split?
e.g.
```
assertTrue(UTIL.getHBaseCluster().getMaster()
.getAssignmentManager().getRegionStates().getRegionState(regions[0]).isSplit());
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]