virajjasani commented on a change in pull request #931: HBASE-22285 A
normalizer which merges small size regions with adjacen…
URL: https://github.com/apache/hbase/pull/931#discussion_r362069084
##########
File path:
hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/SimpleRegionNormalizer.java
##########
@@ -107,103 +76,42 @@ public void setMasterRpcServices(MasterRpcServices
masterRpcServices) {
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 merge is enabled", se);
- }
+ boolean splitEnabled = isSplitEnabled();
+ boolean mergeEnabled = isMergeEnabled();
if (!splitEnabled && !mergeEnabled) {
LOG.debug("Both split and merge are disabled for table: " + table);
return null;
}
+ List<HRegionInfo> tableRegions =
+
masterServices.getAssignmentManager().getRegionStates().getRegionsOfTable(table);
- List<NormalizationPlan> plans = new ArrayList<NormalizationPlan>();
- List<HRegionInfo> tableRegions =
masterServices.getAssignmentManager().getRegionStates().
- getRegionsOfTable(table);
-
- //TODO: should we make min number of regions a config param?
+ // TODO: should we make min number of regions a config param?
if (tableRegions == null || tableRegions.size() < MIN_REGION_COUNT) {
int nrRegions = tableRegions == null ? 0 : tableRegions.size();
LOG.debug("Table " + table + " has " + nrRegions + " regions, required
min number"
- + " of regions for normalizer to run is " + MIN_REGION_COUNT + ", not
running normalizer");
+ + " of regions for normalizer to run is " + MIN_REGION_COUNT
+ + ", not running normalizer");
return null;
}
-
- LOG.debug("Computing normalization plan for table: " + table +
- ", number of regions: " + tableRegions.size());
-
- long totalSizeMb = 0;
- int acutalRegionCnt = 0;
-
- for (int i = 0; i < tableRegions.size(); i++) {
- HRegionInfo hri = tableRegions.get(i);
- long regionSize = getRegionSize(hri);
- if (regionSize > 0) {
- acutalRegionCnt++;
- totalSizeMb += regionSize;
+ List<NormalizationPlan> plans = new ArrayList<>();
+ if (splitEnabled) {
+ List<NormalizationPlan> splitNormalizationPlan =
getSplitNormalizationPlan(table);
+ if (splitNormalizationPlan != null) {
+ plans = splitNormalizationPlan;
Review comment:
To keep it aligned with mergeNormalization, here also, it's good to add all:
`plans.addAll(splitNormalizationPlan)`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services