HBASE-22872 Don't try to create normalization plan unnecesarily when split and merge both are disabled
Signed-off-by: Reid Chan <reidchan@apache.org>
This commit is contained in:
parent
9ae12f5d4b
commit
f240ca0e63
|
@ -107,6 +107,23 @@ public class SimpleRegionNormalizer implements RegionNormalizer {
|
|||
LOG.debug("Normalization of system table " + table + " isn't allowed");
|
||||
return null;
|
||||
}
|
||||
boolean splitEnabled = true, mergeEnabled = true;
|
||||
try {
|
||||
splitEnabled = masterRpcServices.isSplitOrMergeEnabled(null,
|
||||
RequestConverter.buildIsSplitOrMergeEnabledRequest(MasterSwitchType.SPLIT)).getEnabled();
|
||||
} catch (ServiceException se) {
|
||||
LOG.debug("Unable to determine whether split is enabled", se);
|
||||
}
|
||||
try {
|
||||
mergeEnabled = masterRpcServices.isSplitOrMergeEnabled(null,
|
||||
RequestConverter.buildIsSplitOrMergeEnabledRequest(MasterSwitchType.MERGE)).getEnabled();
|
||||
} catch (ServiceException se) {
|
||||
LOG.debug("Unable to determine whether split is enabled", se);
|
||||
}
|
||||
if (!splitEnabled && !mergeEnabled) {
|
||||
LOG.debug("Both split and merge are disabled for table: " + table);
|
||||
return null;
|
||||
}
|
||||
|
||||
List<NormalizationPlan> plans = new ArrayList<NormalizationPlan>();
|
||||
List<HRegionInfo> tableRegions = masterServices.getAssignmentManager().getRegionStates().
|
||||
|
@ -141,19 +158,6 @@ public class SimpleRegionNormalizer implements RegionNormalizer {
|
|||
LOG.debug("Table " + table + ", average region size: " + avgRegionSize);
|
||||
|
||||
int candidateIdx = 0;
|
||||
boolean splitEnabled = true, mergeEnabled = true;
|
||||
try {
|
||||
splitEnabled = masterRpcServices.isSplitOrMergeEnabled(null,
|
||||
RequestConverter.buildIsSplitOrMergeEnabledRequest(MasterSwitchType.SPLIT)).getEnabled();
|
||||
} catch (ServiceException se) {
|
||||
LOG.debug("Unable to determine whether split is enabled", se);
|
||||
}
|
||||
try {
|
||||
mergeEnabled = masterRpcServices.isSplitOrMergeEnabled(null,
|
||||
RequestConverter.buildIsSplitOrMergeEnabledRequest(MasterSwitchType.MERGE)).getEnabled();
|
||||
} catch (ServiceException se) {
|
||||
LOG.debug("Unable to determine whether split is enabled", se);
|
||||
}
|
||||
while (candidateIdx < tableRegions.size()) {
|
||||
HRegionInfo hri = tableRegions.get(candidateIdx);
|
||||
long regionSize = getRegionSize(hri);
|
||||
|
|
Loading…
Reference in New Issue