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 Nick Dimiduk
parent 46a106014e
commit 35520a72fb
1 changed files with 12 additions and 9 deletions

View File

@ -282,8 +282,8 @@ class SimpleRegionNormalizer implements RegionNormalizer, ConfigurationObserver
if (tableDescriptor != null) {
targetRegionCount = tableDescriptor.getNormalizerTargetRegionCount();
targetRegionSize = tableDescriptor.getNormalizerTargetRegionSize();
LOG.debug("Table {} configured with target region count {}, target region size {}", table,
targetRegionCount, targetRegionSize);
LOG.debug("Table {} configured with target region count {}, target region size {} MB",
table, targetRegionCount, targetRegionSize);
}
} catch (IOException e) {
LOG.warn("TableDescriptor for {} unavailable, table-level target region count and size"
@ -301,8 +301,8 @@ class SimpleRegionNormalizer implements RegionNormalizer, ConfigurationObserver
} else {
avgRegionSize = totalSizeMb / (double) regionCount;
}
LOG.debug("Table {}, total aggregated regions size: {} and average region size {}", table,
totalSizeMb, avgRegionSize);
LOG.debug("Table {}, total aggregated regions size: {} MB and average region size {} MB",
table, totalSizeMb, String.format("%.3f", avgRegionSize));
}
return avgRegionSize;
@ -353,8 +353,9 @@ class SimpleRegionNormalizer implements RegionNormalizer, ConfigurationObserver
if (avgRegionSizeMb < configuration.getMergeMinRegionSizeMb()) {
return Collections.emptyList();
}
LOG.debug("Computing normalization plan for table {}. average region size: {}, number of"
+ " regions: {}.", ctx.getTableName(), avgRegionSizeMb, ctx.getTableRegions().size());
LOG.debug("Computing normalization plan for table {}. average region size: {} MB, number of"
+ " regions: {}.", ctx.getTableName(), avgRegionSizeMb,
ctx.getTableRegions().size());
// 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
@ -424,7 +425,8 @@ class SimpleRegionNormalizer implements RegionNormalizer, ConfigurationObserver
*/
private List<NormalizationPlan> computeSplitNormalizationPlans(final NormalizeContext ctx) {
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<>();
for (final RegionInfo hri : ctx.getTableRegions()) {
@ -433,8 +435,9 @@ class SimpleRegionNormalizer implements RegionNormalizer, ConfigurationObserver
}
final long regionSizeMb = getRegionSizeMB(hri);
if (regionSizeMb > 2 * avgRegionSize) {
LOG.info("Table {}, large region {} has size {}, more than twice avg size {}, splitting",
ctx.getTableName(), hri.getRegionNameAsString(), regionSizeMb, avgRegionSize);
LOG.info("Table {}, large region {} has size {} MB, more than twice avg size {} MB, "
+ "splitting", ctx.getTableName(), hri.getRegionNameAsString(), regionSizeMb,
String.format("%.3f", avgRegionSize));
plans.add(new SplitNormalizationPlan(hri, regionSizeMb));
}
}