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 Michael Stack
parent 0438fdc0f6
commit c88267202a
1 changed files with 8 additions and 4 deletions

View File

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