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 stack
parent 3c9a7e01ed
commit df2daf9e1e
2 changed files with 12 additions and 1 deletions

View File

@ -1737,7 +1737,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

@ -725,6 +725,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
// ============================================================================================