- 
                Notifications
    You must be signed in to change notification settings 
- Fork 3.4k
HBASE-25745 Deprecate/Rename config `hbase.normalizer.min.region.coun… #3139
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
          
     Merged
      
      
    
  
     Merged
                    Changes from all commits
      Commits
    
    
  File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -65,10 +65,15 @@ class SimpleRegionNormalizer implements RegionNormalizer, ConfigurationObserver | |
| static final boolean DEFAULT_SPLIT_ENABLED = true; | ||
| static final String MERGE_ENABLED_KEY = "hbase.normalizer.merge.enabled"; | ||
| static final boolean DEFAULT_MERGE_ENABLED = true; | ||
| // TODO: after HBASE-24416, `min.region.count` only applies to merge plans; should | ||
| // deprecate/rename the configuration key. | ||
| /** | ||
| * @deprecated since 2.5.0 and will be removed in 4.0.0. | ||
| * Use {@link SimpleRegionNormalizer#MERGE_MIN_REGION_COUNT_KEY} instead. | ||
| * @see <a href="https://issues.apache.org/jira/browse/HBASE-25745">HBASE-25745</a> | ||
| */ | ||
| @Deprecated | ||
| static final String MIN_REGION_COUNT_KEY = "hbase.normalizer.min.region.count"; | ||
| static final int DEFAULT_MIN_REGION_COUNT = 3; | ||
| static final String MERGE_MIN_REGION_COUNT_KEY = "hbase.normalizer.merge.min.region.count"; | ||
| static final int DEFAULT_MERGE_MIN_REGION_COUNT = 3; | ||
| static final String MERGE_MIN_REGION_AGE_DAYS_KEY = "hbase.normalizer.merge.min_region_age.days"; | ||
| 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"; | ||
|  | @@ -101,11 +106,12 @@ public void onConfigurationChange(Configuration conf) { | |
| setConf(conf); | ||
| } | ||
|  | ||
| private static int parseMinRegionCount(final Configuration conf) { | ||
| final int parsedValue = conf.getInt(MIN_REGION_COUNT_KEY, DEFAULT_MIN_REGION_COUNT); | ||
| private static int parseMergeMinRegionCount(final Configuration conf) { | ||
| final int parsedValue = conf.getInt(MERGE_MIN_REGION_COUNT_KEY, | ||
| DEFAULT_MERGE_MIN_REGION_COUNT); | ||
| final int settledValue = Math.max(1, parsedValue); | ||
| if (parsedValue != settledValue) { | ||
| warnInvalidValue(MIN_REGION_COUNT_KEY, parsedValue, settledValue); | ||
| warnInvalidValue(MERGE_MIN_REGION_COUNT_KEY, parsedValue, settledValue); | ||
| } | ||
| return settledValue; | ||
| } | ||
|  | @@ -158,10 +164,10 @@ public boolean isMergeEnabled() { | |
| } | ||
|  | ||
| /** | ||
| * Return this instance's configured value for {@value #MIN_REGION_COUNT_KEY}. | ||
| * Return this instance's configured value for {@value #MERGE_MIN_REGION_COUNT_KEY}. | ||
| */ | ||
| public int getMinRegionCount() { | ||
| return normalizerConfiguration.getMinRegionCount(); | ||
| public int getMergeMinRegionCount() { | ||
| return normalizerConfiguration.getMergeMinRegionCount(); | ||
| } | ||
|  | ||
| /** | ||
|  | @@ -340,10 +346,10 @@ private boolean skipForMerge( | |
| */ | ||
| private List<NormalizationPlan> computeMergeNormalizationPlans(final NormalizeContext ctx) { | ||
| final NormalizerConfiguration configuration = normalizerConfiguration; | ||
| if (ctx.getTableRegions().size() < configuration.getMinRegionCount(ctx)) { | ||
| if (ctx.getTableRegions().size() < configuration.getMergeMinRegionCount(ctx)) { | ||
| LOG.debug("Table {} has {} regions, required min number of regions for normalizer to run" | ||
| + " is {}, not computing merge plans.", ctx.getTableName(), | ||
| ctx.getTableRegions().size(), configuration.getMinRegionCount()); | ||
| ctx.getTableRegions().size(), configuration.getMergeMinRegionCount()); | ||
| return Collections.emptyList(); | ||
| } | ||
|  | ||
|  | @@ -493,15 +499,15 @@ private static final class NormalizerConfiguration { | |
| private final Configuration conf; | ||
| private final boolean splitEnabled; | ||
| private final boolean mergeEnabled; | ||
| private final int minRegionCount; | ||
| private final int mergeMinRegionCount; | ||
| private final Period mergeMinRegionAge; | ||
| private final long mergeMinRegionSizeMb; | ||
|  | ||
| private NormalizerConfiguration() { | ||
| conf = null; | ||
| splitEnabled = DEFAULT_SPLIT_ENABLED; | ||
| mergeEnabled = DEFAULT_MERGE_ENABLED; | ||
| minRegionCount = DEFAULT_MIN_REGION_COUNT; | ||
| mergeMinRegionCount = DEFAULT_MERGE_MIN_REGION_COUNT; | ||
| mergeMinRegionAge = Period.ofDays(DEFAULT_MERGE_MIN_REGION_AGE_DAYS); | ||
| mergeMinRegionSizeMb = DEFAULT_MERGE_MIN_REGION_SIZE_MB; | ||
| } | ||
|  | @@ -513,15 +519,15 @@ private NormalizerConfiguration( | |
| this.conf = conf; | ||
| splitEnabled = conf.getBoolean(SPLIT_ENABLED_KEY, DEFAULT_SPLIT_ENABLED); | ||
| mergeEnabled = conf.getBoolean(MERGE_ENABLED_KEY, DEFAULT_MERGE_ENABLED); | ||
| minRegionCount = parseMinRegionCount(conf); | ||
| mergeMinRegionCount = parseMergeMinRegionCount(conf); | ||
| mergeMinRegionAge = parseMergeMinRegionAge(conf); | ||
| mergeMinRegionSizeMb = parseMergeMinRegionSizeMb(conf); | ||
| logConfigurationUpdated(SPLIT_ENABLED_KEY, currentConfiguration.isSplitEnabled(), | ||
| splitEnabled); | ||
| logConfigurationUpdated(MERGE_ENABLED_KEY, currentConfiguration.isMergeEnabled(), | ||
| mergeEnabled); | ||
| logConfigurationUpdated(MIN_REGION_COUNT_KEY, currentConfiguration.getMinRegionCount(), | ||
| minRegionCount); | ||
| logConfigurationUpdated(MERGE_MIN_REGION_COUNT_KEY, | ||
| currentConfiguration.getMergeMinRegionCount(), mergeMinRegionCount); | ||
| logConfigurationUpdated(MERGE_MIN_REGION_AGE_DAYS_KEY, | ||
| currentConfiguration.getMergeMinRegionAge(), mergeMinRegionAge); | ||
| logConfigurationUpdated(MERGE_MIN_REGION_SIZE_MB_KEY, | ||
|  | @@ -540,24 +546,34 @@ public boolean isMergeEnabled() { | |
| return mergeEnabled; | ||
| } | ||
|  | ||
| public int getMinRegionCount() { | ||
| return minRegionCount; | ||
| public int getMergeMinRegionCount() { | ||
| return mergeMinRegionCount; | ||
| } | ||
|  | ||
| public int getMinRegionCount(NormalizeContext context) { | ||
| int minRegionCount = context.getOrDefault(MIN_REGION_COUNT_KEY, Integer::parseInt, 0); | ||
| if (minRegionCount <= 0) { | ||
| minRegionCount = getMinRegionCount(); | ||
| public int getMergeMinRegionCount(NormalizeContext context) { | ||
| String stringValue = context.getOrDefault(MERGE_MIN_REGION_COUNT_KEY, | ||
| Function.identity(), null); | ||
| if (stringValue == null) { | ||
| stringValue = context.getOrDefault(MIN_REGION_COUNT_KEY, Function.identity(), null); | ||
| if (stringValue != null) { | ||
| LOG.debug("The config key {} in table descriptor is deprecated. Instead please use {}. " | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. huh. maybe  | ||
| + "In future release we will remove the deprecated config.", MIN_REGION_COUNT_KEY, | ||
| MERGE_MIN_REGION_COUNT_KEY); | ||
| } | ||
| } | ||
| final int mergeMinRegionCount = stringValue == null ? 0 : Integer.parseInt(stringValue); | ||
| if (mergeMinRegionCount <= 0) { | ||
| return getMergeMinRegionCount(); | ||
| } | ||
| return minRegionCount; | ||
| return mergeMinRegionCount; | ||
| } | ||
|  | ||
| public Period getMergeMinRegionAge() { | ||
| return mergeMinRegionAge; | ||
| } | ||
|  | ||
| public Period getMergeMinRegionAge(NormalizeContext context) { | ||
| int mergeMinRegionAge = context.getOrDefault(MERGE_MIN_REGION_AGE_DAYS_KEY, | ||
| final int mergeMinRegionAge = context.getOrDefault(MERGE_MIN_REGION_AGE_DAYS_KEY, | ||
| Integer::parseInt, -1); | ||
| if (mergeMinRegionAge < 0) { | ||
| return getMergeMinRegionAge(); | ||
|  | @@ -570,10 +586,10 @@ public long getMergeMinRegionSizeMb() { | |
| } | ||
|  | ||
| public long getMergeMinRegionSizeMb(NormalizeContext context) { | ||
| long mergeMinRegionSizeMb = context.getOrDefault(MERGE_MIN_REGION_SIZE_MB_KEY, | ||
| final long mergeMinRegionSizeMb = context.getOrDefault(MERGE_MIN_REGION_SIZE_MB_KEY, | ||
| Long::parseLong, (long)-1); | ||
| if (mergeMinRegionSizeMb < 0) { | ||
| mergeMinRegionSizeMb = getMergeMinRegionSizeMb(); | ||
| return getMergeMinRegionSizeMb(); | ||
| } | ||
| return mergeMinRegionSizeMb; | ||
| } | ||
|  | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.