-
Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-30169 Split completed parent region added to RIT list on host RS and master crash #8264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
3127569
b373004
503d6b9
3e0328c
2a8e6e4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,7 @@ | |
|
|
||
| import static org.apache.hadoop.hbase.master.assignment.AssignmentTestingUtil.insertData; | ||
| import static org.junit.jupiter.api.Assertions.assertEquals; | ||
| import static org.junit.jupiter.api.Assertions.assertFalse; | ||
| import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
| import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
|
||
|
|
@@ -117,8 +118,8 @@ public void testSplitTableRegion() throws Exception { | |
| int splitRowNum = startRowNum + rowCount / 2; | ||
| byte[] splitKey = Bytes.toBytes("" + splitRowNum); | ||
|
|
||
| assertTrue(regions != null, "not able to find a splittable region"); | ||
| assertTrue(regions.length == 1, "not able to find a splittable region"); | ||
| assertNotNull(regions, "not able to find a splittable region"); | ||
| assertEquals(1, regions.length, "not able to find a splittable region"); | ||
|
|
||
| // Split region of the table | ||
| long procId = procExec.submitProcedure( | ||
|
|
@@ -127,7 +128,7 @@ public void testSplitTableRegion() throws Exception { | |
| ProcedureTestingUtility.waitProcedure(procExec, procId); | ||
| ProcedureTestingUtility.assertProcNotFailed(procExec, procId); | ||
|
|
||
| assertTrue(UTIL.getHBaseCluster().getRegions(tableName).size() == 2, "not able to split table"); | ||
| assertEquals(2, UTIL.getHBaseCluster().getRegions(tableName).size(), "not able to split table"); | ||
|
|
||
| // disable table | ||
| UTIL.getAdmin().disableTable(tableName); | ||
|
|
@@ -155,6 +156,63 @@ 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(); | ||
| // Disable CatalogJanitor to keep the split region in hbase:meta throughout the test | ||
| UTIL.getHBaseCluster().getMaster().getCatalogJanitor().setEnabled(false); | ||
|
|
||
| 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())); | ||
|
Comment on lines
+187
to
+188
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After this, can we also check for region[0] to be split?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. instead of this I am using getOrCreateRegionStateNode(regions[0]).isSplit() as it do both the necessary check for split |
||
| assertTrue(UTIL.getHBaseCluster().getMaster().getAssignmentManager().getRegionStates() | ||
| .getOrCreateRegionStateNode(regions[0]).isSplit()); | ||
| // 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())); | ||
|
Comment on lines
+210
to
+211
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here after this? check for region[0] being split and offline?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added |
||
| assertTrue(UTIL.getHBaseCluster().getMaster().getAssignmentManager().getRegionStates() | ||
| .getOrCreateRegionStateNode(regions[0]).isSplit()); | ||
| } | ||
|
|
||
| @Test | ||
| public void testSplitStoreFiles() throws Exception { | ||
| final TableName tableName = TableName.valueOf(testMethodName); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.