HBASE-22922 Lock all regions to be merged in case of multi region merge (#542)

* HBASE-22922 Lock all regions to be merged in case of multi region merge

* HBASE-22922 Lock all regions to be merged in case of multi region merge
 (addendum)

fix off-by-one error in patch
Signed-off-by: stack <stack@apache.org>
This commit is contained in:
Istvan Toth 2019-08-27 06:09:18 +02:00 committed by stack
parent 06ae766809
commit b0e84723d2
1 changed files with 8 additions and 4 deletions

View File

@ -402,8 +402,10 @@ public class MergeTableRegionsProcedure
@Override @Override
protected LockState acquireLock(final MasterProcedureEnv env) { protected LockState acquireLock(final MasterProcedureEnv env) {
if (env.getProcedureScheduler().waitRegions(this, getTableName(), RegionInfo[] lockRegions = Arrays.copyOf(regionsToMerge, regionsToMerge.length + 1);
mergedRegion, regionsToMerge[0], regionsToMerge[1])) { lockRegions[lockRegions.length - 1] = mergedRegion;
if (env.getProcedureScheduler().waitRegions(this, getTableName(), lockRegions)) {
try { try {
LOG.debug(LockState.LOCK_EVENT_WAIT + " " + env.getProcedureScheduler().dumpLocks()); LOG.debug(LockState.LOCK_EVENT_WAIT + " " + env.getProcedureScheduler().dumpLocks());
} catch (IOException e) { } catch (IOException e) {
@ -416,8 +418,10 @@ public class MergeTableRegionsProcedure
@Override @Override
protected void releaseLock(final MasterProcedureEnv env) { protected void releaseLock(final MasterProcedureEnv env) {
env.getProcedureScheduler().wakeRegions(this, getTableName(), RegionInfo[] lockRegions = Arrays.copyOf(regionsToMerge, regionsToMerge.length + 1);
mergedRegion, regionsToMerge[0], regionsToMerge[1]); lockRegions[lockRegions.length - 1] = mergedRegion;
env.getProcedureScheduler().wakeRegions(this, getTableName(), lockRegions);
} }
@Override @Override