HBASE-22061 SplitTableRegionProcedure should hold the lock of its daughter regions

This commit is contained in:
Jingyun Tian 2019-03-19 14:25:04 +08:00 committed by Jingyun Tian
parent b4b4854371
commit c52dd9efa0
1 changed files with 20 additions and 0 deletions

View File

@ -137,6 +137,26 @@ public class SplitTableRegionProcedure
}
}
@Override
protected LockState acquireLock(final MasterProcedureEnv env) {
if (env.getProcedureScheduler().waitRegions(this, getTableName(), getParentRegion(),
daughter_1_RI, daughter_2_RI)) {
try {
LOG.debug(LockState.LOCK_EVENT_WAIT + " " + env.getProcedureScheduler().dumpLocks());
} catch (IOException e) {
// Ignore, just for logging
}
return LockState.LOCK_EVENT_WAIT;
}
return LockState.LOCK_ACQUIRED;
}
@Override
protected void releaseLock(final MasterProcedureEnv env) {
env.getProcedureScheduler().wakeRegions(this, getTableName(), getParentRegion(), daughter_1_RI,
daughter_2_RI);
}
/**
* Check whether the region is splittable
* @param env MasterProcedureEnv