-
Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-28068 : Add hbase.normalizer.merge.merge_request_max_number_of_regions property … #5403
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
0ff60fa
ba28032
22dcf3b
c2d1065
4e6abec
ebeebdd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -81,6 +81,8 @@ class SimpleRegionNormalizer implements RegionNormalizer, ConfigurationObserver | |
| static final int DEFAULT_MERGE_MIN_REGION_AGE_DAYS = 3; | ||
| static final String MERGE_MIN_REGION_SIZE_MB_KEY = "hbase.normalizer.merge.min_region_size.mb"; | ||
| static final int DEFAULT_MERGE_MIN_REGION_SIZE_MB = 0; | ||
| static final String MERGE_MAX_REGION_COUNT_KEY = "hbase.normalizer.merge.max.region.count"; | ||
|
||
| static final long DEFAULT_MERGE_MAX_REGION_COUNT = Long.MAX_VALUE; | ||
|
||
|
|
||
| private MasterServices masterServices; | ||
| private NormalizerConfiguration normalizerConfiguration; | ||
|
|
@@ -138,6 +140,16 @@ private static long parseMergeMinRegionSizeMb(final Configuration conf) { | |
| return settledValue; | ||
| } | ||
|
|
||
| private static long parseMergeMaxRegionCount(final Configuration conf) { | ||
| final long parsedValue = | ||
| conf.getLong(MERGE_MAX_REGION_COUNT_KEY, DEFAULT_MERGE_MAX_REGION_COUNT); | ||
| final long settledValue = Math.max(1, parsedValue); | ||
|
||
| if (parsedValue != settledValue) { | ||
| warnInvalidValue(MERGE_MAX_REGION_COUNT_KEY, parsedValue, settledValue); | ||
| } | ||
| return settledValue; | ||
| } | ||
|
|
||
| private static <T> void warnInvalidValue(final String key, final T parsedValue, | ||
| final T settledValue) { | ||
| LOG.warn("Configured value {}={} is invalid. Setting value to {}.", key, parsedValue, | ||
|
|
@@ -186,6 +198,10 @@ public long getMergeMinRegionSizeMb() { | |
| return normalizerConfiguration.getMergeMinRegionSizeMb(); | ||
| } | ||
|
|
||
| public long getMergeMaxRegionCount() { | ||
| return normalizerConfiguration.getMergeMaxRegionCount(); | ||
| } | ||
|
|
||
| @Override | ||
| public void setMasterServices(final MasterServices masterServices) { | ||
| this.masterServices = masterServices; | ||
|
|
@@ -382,15 +398,16 @@ private List<NormalizationPlan> computeMergeNormalizationPlans(final NormalizeCo | |
| break; | ||
| } | ||
| if ( | ||
| rangeMembers.isEmpty() // when there are no range members, seed the range with whatever | ||
| // we have. this way we're prepared in case the next region is | ||
| // 0-size. | ||
| (rangeMembers.isEmpty() // when there are no range members, seed the range with whatever | ||
|
||
| // we have. this way we're prepared in case the next region is | ||
| // 0-size. | ||
| || (rangeMembers.size() == 1 && sumRangeMembersSizeMb == 0) // when there is only one | ||
| // region and the size is 0, | ||
| // seed the range with | ||
| // whatever we have. | ||
| || regionSizeMb == 0 // always add an empty region to the current range. | ||
| || (regionSizeMb + sumRangeMembersSizeMb <= avgRegionSizeMb) | ||
| || (regionSizeMb + sumRangeMembersSizeMb <= avgRegionSizeMb)) | ||
| && (rangeMembers.size() < getMergeMaxRegionCount()) | ||
|
||
| ) { // add the current region | ||
| // to the range when | ||
| // there's capacity | ||
|
|
@@ -502,6 +519,7 @@ private static final class NormalizerConfiguration { | |
| private final int mergeMinRegionCount; | ||
| private final Period mergeMinRegionAge; | ||
| private final long mergeMinRegionSizeMb; | ||
| private final long mergeMaxRegionCount; | ||
| private final long cumulativePlansSizeLimitMb; | ||
|
|
||
| private NormalizerConfiguration() { | ||
|
|
@@ -511,6 +529,7 @@ private NormalizerConfiguration() { | |
| mergeMinRegionCount = DEFAULT_MERGE_MIN_REGION_COUNT; | ||
| mergeMinRegionAge = Period.ofDays(DEFAULT_MERGE_MIN_REGION_AGE_DAYS); | ||
| mergeMinRegionSizeMb = DEFAULT_MERGE_MIN_REGION_SIZE_MB; | ||
| mergeMaxRegionCount = DEFAULT_MERGE_MAX_REGION_COUNT; | ||
| cumulativePlansSizeLimitMb = DEFAULT_CUMULATIVE_SIZE_LIMIT_MB; | ||
| } | ||
|
|
||
|
|
@@ -522,6 +541,7 @@ private NormalizerConfiguration(final Configuration conf, | |
| mergeMinRegionCount = parseMergeMinRegionCount(conf); | ||
| mergeMinRegionAge = parseMergeMinRegionAge(conf); | ||
| mergeMinRegionSizeMb = parseMergeMinRegionSizeMb(conf); | ||
| mergeMaxRegionCount = parseMergeMaxRegionCount(conf); | ||
| cumulativePlansSizeLimitMb = | ||
| conf.getLong(CUMULATIVE_SIZE_LIMIT_MB_KEY, DEFAULT_CUMULATIVE_SIZE_LIMIT_MB); | ||
| logConfigurationUpdated(SPLIT_ENABLED_KEY, currentConfiguration.isSplitEnabled(), | ||
|
|
@@ -534,6 +554,8 @@ private NormalizerConfiguration(final Configuration conf, | |
| currentConfiguration.getMergeMinRegionAge(), mergeMinRegionAge); | ||
| logConfigurationUpdated(MERGE_MIN_REGION_SIZE_MB_KEY, | ||
| currentConfiguration.getMergeMinRegionSizeMb(), mergeMinRegionSizeMb); | ||
| logConfigurationUpdated(MERGE_MAX_REGION_COUNT_KEY, | ||
| currentConfiguration.getMergeMaxRegionCount(), mergeMaxRegionCount); | ||
| } | ||
|
|
||
| public Configuration getConf() { | ||
|
|
@@ -597,6 +619,10 @@ public long getMergeMinRegionSizeMb(NormalizeContext context) { | |
| return mergeMinRegionSizeMb; | ||
| } | ||
|
|
||
| public long getMergeMaxRegionCount() { | ||
| return mergeMaxRegionCount; | ||
| } | ||
|
|
||
| private long getCumulativePlansSizeLimitMb() { | ||
| return cumulativePlansSizeLimitMb; | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Careful here. This config name looks like a counter-point to
hbase.normalizer.merge.min.region.countbut in fact it's not. Theminconfig is placing a guard-rail on the minimum number of regions a table contain in order to be considered for merge normalization. This new guard-rail is limiting the number of regions that can be merged together in a single operation.I instead suggest a config named something like
hbase.normalizer.merge.merge_request_max_number_of_regions. Also, the description text should be updated accordingly -- this is just a copy-paste of the other config's description.