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:
parent
3c9a7e01ed
commit
df2daf9e1e
|
@ -1737,7 +1737,7 @@ public class HMaster extends HRegionServer implements MasterServices {
|
||||||
LOG.info("balance " + plan);
|
LOG.info("balance " + plan);
|
||||||
//TODO: bulk assign
|
//TODO: bulk assign
|
||||||
try {
|
try {
|
||||||
this.assignmentManager.moveAsync(plan);
|
this.assignmentManager.balance(plan);
|
||||||
} catch (HBaseIOException hioe) {
|
} catch (HBaseIOException hioe) {
|
||||||
//should ignore failed plans here, avoiding the whole balance plans be aborted
|
//should ignore failed plans here, avoiding the whole balance plans be aborted
|
||||||
//later calls of balance() can fetch up the failed and skipped plans
|
//later calls of balance() can fetch up the failed and skipped plans
|
||||||
|
|
|
@ -725,6 +725,17 @@ public class AssignmentManager {
|
||||||
return ProcedureSyncWait.submitProcedure(master.getMasterProcedureExecutor(), proc);
|
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
|
// RegionTransition procedures helpers
|
||||||
// ============================================================================================
|
// ============================================================================================
|
||||||
|
|
Loading…
Reference in New Issue