HBASE-25621 Balancer should check region plan source to avoid misplace region groups (#3002)

Signed-off-by: stack <stack@duboce.net>
This commit is contained in:
haxiaolin 2021-03-16 05:47:27 +08:00 committed by GitHub
parent 625bea3ecc
commit 0ef892b68a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -1767,7 +1767,7 @@ public class HMaster extends HRegionServer implements MasterServices {
LOG.info("balance " + plan);
//TODO: bulk assign
try {
this.assignmentManager.moveAsync(plan);
this.assignmentManager.balance(plan);
} catch (HBaseIOException hioe) {
//should ignore failed plans here, avoiding the whole balance plans be aborted
//later calls of balance() can fetch up the failed and skipped plans

View File

@ -732,6 +732,17 @@ public class AssignmentManager {
return ProcedureSyncWait.submitProcedure(master.getMasterProcedureExecutor(), proc);
}
public Future<byte[]> balance(RegionPlan regionPlan) throws HBaseIOException {
ServerName current =
this.getRegionStates().getRegionAssignments().get(regionPlan.getRegionInfo());
if (!current.equals(regionPlan.getSource())) {
LOG.debug("Skip region plan {}, source server not match, current region location is {}",
regionPlan, current);
return null;
}
return moveAsync(regionPlan);
}
// ============================================================================================
// RegionTransition procedures helpers
// ============================================================================================