Revert "HBASE-23864 No need to submit SplitTableRegionProcedure/MergeTableRegionsProcedure when split/merge is disabled (#1182)"

Causes TestSplitOrMergeStatus to fail. Reverting.

This reverts commit 5e06a2ee7f2d73a81c01ee5e66c056b0f42c378f.
This commit is contained in:
stack 2020-02-19 21:12:34 -08:00
parent 4509b214eb
commit 553eb97b7b
4 changed files with 3 additions and 37 deletions

View File

@ -1899,12 +1899,6 @@ public class HMaster extends HRegionServer implements MasterServices {
final long nonce) throws IOException {
checkInitialized();
if (!isSplitOrMergeEnabled(MasterSwitchType.MERGE)) {
String regionsStr = Arrays.deepToString(regionsToMerge);
LOG.warn("Merge switch is off! skip merge of " + regionsStr);
throw new IOException("Merge of " + regionsStr + " failed because merge switch is off");
}
final String mergeRegionsStr = Arrays.stream(regionsToMerge).
map(r -> RegionInfo.getShortNameToLog(r)).collect(Collectors.joining(", "));
return MasterProcedureUtil.submitProcedure(new NonceProcedureRunnable(this, ng, nonce) {
@ -1930,13 +1924,6 @@ public class HMaster extends HRegionServer implements MasterServices {
final long nonceGroup, final long nonce)
throws IOException {
checkInitialized();
if (!isSplitOrMergeEnabled(MasterSwitchType.SPLIT)) {
LOG.warn("Split switch is off! skip split of " + regionInfo);
throw new IOException("Split region " + regionInfo.getRegionNameAsString() +
" failed due to split switch off");
}
return MasterProcedureUtil.submitProcedure(
new MasterProcedureUtil.NonceProcedureRunnable(this, nonceGroup, nonce) {
@Override

View File

@ -32,7 +32,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.ReentrantLock;
import java.util.stream.Collectors;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.DoNotRetryIOException;
import org.apache.hadoop.hbase.HBaseIOException;
@ -43,7 +42,6 @@ import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.UnknownRegionException;
import org.apache.hadoop.hbase.client.DoNotRetryRegionException;
import org.apache.hadoop.hbase.client.MasterSwitchType;
import org.apache.hadoop.hbase.client.RegionInfo;
import org.apache.hadoop.hbase.client.RegionInfoBuilder;
import org.apache.hadoop.hbase.client.RegionStatesCount;
@ -1009,12 +1007,6 @@ public class AssignmentManager {
" hriA=" + hriA + " hriB=" + hriB);
}
if (!master.isSplitOrMergeEnabled(MasterSwitchType.SPLIT)) {
LOG.warn("Split switch is off! skip split of " + parent);
throw new IOException("Split region " + parent.getRegionNameAsString() +
" failed due to split switch off");
}
// Submit the Split procedure
final byte[] splitKey = hriB.getStartKey();
if (LOG.isDebugEnabled()) {
@ -1040,12 +1032,6 @@ public class AssignmentManager {
" maybe an old RS (< 2.0) had the operation in progress");
}
if (!master.isSplitOrMergeEnabled(MasterSwitchType.MERGE)) {
LOG.warn("Merge switch is off! skip merge of regionA=" + hriA + " regionB=" + hriB);
throw new IOException("Merge of regionA=" + hriA + " regionB=" + hriB +
" failed because merge switch is off");
}
// Submit the Merge procedure
if (LOG.isDebugEnabled()) {
LOG.debug("Handling merge request from RS=" + merged + ", merged=" + merged);

View File

@ -453,10 +453,6 @@ public class MergeTableRegionsProcedure
throw new MergeRegionException("Skip merging regions " +
RegionInfo.getShortNameToLog(regionsToMerge) + ", because we are snapshotting " + tn);
}
// Mostly this check is not used because we already check the switch before submit a merge
// procedure. Just for safe, check the switch again. This procedure can be rollbacked if
// the switch was set to false after submit.
if (!env.getMasterServices().isSplitOrMergeEnabled(MasterSwitchType.MERGE)) {
String regionsStr = Arrays.deepToString(this.regionsToMerge);
LOG.warn("Merge switch is off! skip merge of " + regionsStr);
@ -757,4 +753,4 @@ public class MergeTableRegionsProcedure
// range of steps; what do we do for these should an operator want to cancel them? HBASE-20022.
return isRollbackSupported(getCurrentState()) && super.abort(env);
}
}
}

View File

@ -523,9 +523,8 @@ public class SplitTableRegionProcedure
return false;
}
// Mostly this check is not used because we already check the switch before submit a split
// procedure. Just for safe, check the switch again. This procedure can be rollbacked if
// the switch was set to false after submit.
// Since we have the lock and the master is coordinating the operation
// we are always able to split the region
if (!env.getMasterServices().isSplitOrMergeEnabled(MasterSwitchType.SPLIT)) {
LOG.warn("pid=" + getProcId() + " split switch is off! skip split of " + parentHRI);
setFailure(new IOException("Split region " + parentHRI.getRegionNameAsString() +
@ -544,8 +543,6 @@ public class SplitTableRegionProcedure
// set node state as SPLITTING
node.setState(State.SPLITTING);
// Since we have the lock and the master is coordinating the operation
// we are always able to split the region
return true;
}