HBASE-25653 Add units and round off region size to 2 digits after decimal (#3046)

Signed-off-by: stack <stack@duboce.net>
Reviewed-by: Viraj Jasani <vjasani@apache.org>
This commit is contained in:
DivyeshChandra 2021-03-17 10:02:12 +05:30 committed by GitHub
parent ebb0adf500
commit bcf503e6c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 8 deletions

View File

@ -284,7 +284,7 @@ class SimpleRegionNormalizer implements RegionNormalizer, ConfigurationObserver
double avgRegionSize; double avgRegionSize;
int targetRegionCount = tableDescriptor.getNormalizerTargetRegionCount(); int targetRegionCount = tableDescriptor.getNormalizerTargetRegionCount();
long targetRegionSize = tableDescriptor.getNormalizerTargetRegionSize(); long targetRegionSize = tableDescriptor.getNormalizerTargetRegionSize();
LOG.debug("Table {} configured with target region count {}, target region size {}", table, LOG.debug("Table {} configured with target region count {}, target region size {} MB", table,
targetRegionCount, targetRegionSize); targetRegionCount, targetRegionSize);
if (targetRegionSize > 0) { if (targetRegionSize > 0) {
@ -299,8 +299,8 @@ class SimpleRegionNormalizer implements RegionNormalizer, ConfigurationObserver
} else { } else {
avgRegionSize = totalSizeMb / (double) regionCount; avgRegionSize = totalSizeMb / (double) regionCount;
} }
LOG.debug("Table {}, total aggregated regions size: {} and average region size {}", table, LOG.debug("Table {}, total aggregated regions size: {} MB and average region size {} MB",
totalSizeMb, avgRegionSize); table, totalSizeMb, String.format("%.3f", avgRegionSize));
} }
return avgRegionSize; return avgRegionSize;
@ -351,8 +351,9 @@ class SimpleRegionNormalizer implements RegionNormalizer, ConfigurationObserver
if (avgRegionSizeMb < configuration.getMergeMinRegionSizeMb(ctx)) { if (avgRegionSizeMb < configuration.getMergeMinRegionSizeMb(ctx)) {
return Collections.emptyList(); return Collections.emptyList();
} }
LOG.debug("Computing normalization plan for table {}. average region size: {}, number of" LOG.debug("Computing normalization plan for table {}. average region size: {} MB, number of"
+ " regions: {}.", ctx.getTableName(), avgRegionSizeMb, ctx.getTableRegions().size()); + " regions: {}.", ctx.getTableName(), avgRegionSizeMb,
ctx.getTableRegions().size());
// this nested loop walks the table's region chain once, looking for contiguous sequences of // this nested loop walks the table's region chain once, looking for contiguous sequences of
// regions that meet the criteria for merge. The outer loop tracks the starting point of the // regions that meet the criteria for merge. The outer loop tracks the starting point of the
@ -426,7 +427,8 @@ class SimpleRegionNormalizer implements RegionNormalizer, ConfigurationObserver
*/ */
private List<NormalizationPlan> computeSplitNormalizationPlans(final NormalizeContext ctx) { private List<NormalizationPlan> computeSplitNormalizationPlans(final NormalizeContext ctx) {
final double avgRegionSize = ctx.getAverageRegionSizeMb(); final double avgRegionSize = ctx.getAverageRegionSizeMb();
LOG.debug("Table {}, average region size: {}", ctx.getTableName(), avgRegionSize); LOG.debug("Table {}, average region size: {} MB", ctx.getTableName(),
String.format("%.3f", avgRegionSize));
final List<NormalizationPlan> plans = new ArrayList<>(); final List<NormalizationPlan> plans = new ArrayList<>();
for (final RegionInfo hri : ctx.getTableRegions()) { for (final RegionInfo hri : ctx.getTableRegions()) {
@ -435,8 +437,9 @@ class SimpleRegionNormalizer implements RegionNormalizer, ConfigurationObserver
} }
final long regionSizeMb = getRegionSizeMB(hri); final long regionSizeMb = getRegionSizeMB(hri);
if (regionSizeMb > 2 * avgRegionSize) { if (regionSizeMb > 2 * avgRegionSize) {
LOG.info("Table {}, large region {} has size {}, more than twice avg size {}, splitting", LOG.info("Table {}, large region {} has size {} MB, more than twice avg size {} MB, "
ctx.getTableName(), hri.getRegionNameAsString(), regionSizeMb, avgRegionSize); + "splitting", ctx.getTableName(), hri.getRegionNameAsString(), regionSizeMb,
String.format("%.3f", avgRegionSize));
plans.add(new SplitNormalizationPlan(hri, regionSizeMb)); plans.add(new SplitNormalizationPlan(hri, regionSizeMb));
} }
} }