HBASE-25339 Method parameter and member variable are duplicated in checkSplittable() of SplitTableRegionProcedure

Closes #2717

Signed-off-by: Viraj Jasani <vjasani@apache.org>
This commit is contained in:
GeorryHuang 2020-11-30 17:55:49 +05:30 committed by Viraj Jasani
parent b75b772bc6
commit 861c5509ad
No known key found for this signature in database
GPG Key ID: B3D6C0B41C8ADFD5
1 changed files with 4 additions and 5 deletions

View File

@ -110,7 +110,7 @@ public class SplitTableRegionProcedure
// we fail-fast on construction. There it skips the split with just a warning. // we fail-fast on construction. There it skips the split with just a warning.
checkOnline(env, regionToSplit); checkOnline(env, regionToSplit);
this.bestSplitRow = splitRow; this.bestSplitRow = splitRow;
checkSplittable(env, regionToSplit, bestSplitRow); checkSplittable(env, regionToSplit);
final TableName table = regionToSplit.getTable(); final TableName table = regionToSplit.getTable();
final long rid = getDaughterRegionIdTimestamp(regionToSplit); final long rid = getDaughterRegionIdTimestamp(regionToSplit);
this.daughterOneRI = RegionInfoBuilder.newBuilder(table) this.daughterOneRI = RegionInfoBuilder.newBuilder(table)
@ -173,10 +173,9 @@ public class SplitTableRegionProcedure
* Check whether the region is splittable * Check whether the region is splittable
* @param env MasterProcedureEnv * @param env MasterProcedureEnv
* @param regionToSplit parent Region to be split * @param regionToSplit parent Region to be split
* @param splitRow if splitRow is not specified, will first try to get bestSplitRow from RS
*/ */
private void checkSplittable(final MasterProcedureEnv env, private void checkSplittable(final MasterProcedureEnv env,
final RegionInfo regionToSplit, final byte[] splitRow) throws IOException { final RegionInfo regionToSplit) throws IOException {
// Ask the remote RS if this region is splittable. // Ask the remote RS if this region is splittable.
// If we get an IOE, report it along w/ the failure so can see why we are not splittable at // If we get an IOE, report it along w/ the failure so can see why we are not splittable at
// this time. // this time.
@ -227,12 +226,12 @@ public class SplitTableRegionProcedure
if (Bytes.equals(regionToSplit.getStartKey(), bestSplitRow)) { if (Bytes.equals(regionToSplit.getStartKey(), bestSplitRow)) {
throw new DoNotRetryIOException( throw new DoNotRetryIOException(
"Split row is equal to startkey: " + Bytes.toStringBinary(splitRow)); "Split row is equal to startkey: " + Bytes.toStringBinary(bestSplitRow));
} }
if (!regionToSplit.containsRow(bestSplitRow)) { if (!regionToSplit.containsRow(bestSplitRow)) {
throw new DoNotRetryIOException("Split row is not inside region key range splitKey:" + throw new DoNotRetryIOException("Split row is not inside region key range splitKey:" +
Bytes.toStringBinary(splitRow) + " region: " + regionToSplit); Bytes.toStringBinary(bestSplitRow) + " region: " + regionToSplit);
} }
} }