@InterfaceAudience.LimitedPrivate(value="Configuration") class SimpleRegionNormalizer extends Object implements RegionNormalizer, ConfigurationObserver
Modifier and Type | Class and Description |
---|---|
private class |
SimpleRegionNormalizer.NormalizeContext
Inner class caries the state necessary to perform a single invocation of
computePlansForTable(TableDescriptor) . |
private static class |
SimpleRegionNormalizer.NormalizerConfiguration
Holds the configuration values read from
Configuration . |
Modifier and Type | Field and Description |
---|---|
(package private) static boolean |
DEFAULT_MERGE_ENABLED |
(package private) static int |
DEFAULT_MERGE_MIN_REGION_AGE_DAYS |
(package private) static int |
DEFAULT_MERGE_MIN_REGION_COUNT |
(package private) static int |
DEFAULT_MERGE_MIN_REGION_SIZE_MB |
(package private) static boolean |
DEFAULT_SPLIT_ENABLED |
private static org.slf4j.Logger |
LOG |
private MasterServices |
masterServices |
(package private) static String |
MERGE_ENABLED_KEY |
(package private) static String |
MERGE_MIN_REGION_AGE_DAYS_KEY |
(package private) static String |
MERGE_MIN_REGION_COUNT_KEY |
(package private) static String |
MERGE_MIN_REGION_SIZE_MB_KEY |
(package private) static String |
MIN_REGION_COUNT_KEY
Deprecated.
since 2.5.0 and will be removed in 4.0.0. Use
MERGE_MIN_REGION_COUNT_KEY instead. |
private SimpleRegionNormalizer.NormalizerConfiguration |
normalizerConfiguration |
(package private) static String |
SPLIT_ENABLED_KEY |
Constructor and Description |
---|
SimpleRegionNormalizer() |
Modifier and Type | Method and Description |
---|---|
private List<NormalizationPlan> |
computeMergeNormalizationPlans(SimpleRegionNormalizer.NormalizeContext ctx)
Computes the merge plans that should be executed for this table to converge average region
towards target average or target region count.
|
List<NormalizationPlan> |
computePlansForTable(TableDescriptor tableDescriptor)
Computes a list of normalizer actions to perform on the target table.
|
private List<NormalizationPlan> |
computeSplitNormalizationPlans(SimpleRegionNormalizer.NormalizeContext ctx)
Computes the split plans that should be executed for this table to converge average region size
towards target average or target region count.
|
private double |
getAverageRegionSizeMb(List<RegionInfo> tableRegions,
TableDescriptor tableDescriptor)
Also make sure tableRegions contains regions of the same table
|
org.apache.hadoop.conf.Configuration |
getConf() |
Period |
getMergeMinRegionAge()
Return this instance's configured value for "hbase.normalizer.merge.min_region_age.days".
|
int |
getMergeMinRegionCount()
Return this instance's configured value for "hbase.normalizer.merge.min.region.count".
|
long |
getMergeMinRegionSizeMb()
Return this instance's configured value for "hbase.normalizer.merge.min_region_size.mb".
|
private long |
getRegionSizeMB(RegionInfo hri)
Returns size of region in MB and if region is not found than -1
|
private boolean |
isLargeEnoughForMerge(SimpleRegionNormalizer.NormalizerConfiguration normalizerConfiguration,
SimpleRegionNormalizer.NormalizeContext ctx,
RegionInfo regionInfo)
Return
true when regionInfo has a size that is sufficient to be considered for
a merge operation, false otherwise. |
private boolean |
isMasterSwitchEnabled(MasterSwitchType masterSwitchType) |
boolean |
isMergeEnabled()
Return this instance's configured value for "hbase.normalizer.merge.enabled".
|
private static boolean |
isOldEnoughForMerge(SimpleRegionNormalizer.NormalizerConfiguration normalizerConfiguration,
SimpleRegionNormalizer.NormalizeContext ctx,
RegionInfo regionInfo)
Return
true when regionInfo has a creation date that is old enough to be
considered for a merge operation, false otherwise. |
boolean |
isSplitEnabled()
Return this instance's configured value for "hbase.normalizer.split.enabled".
|
private static <T> void |
logConfigurationUpdated(String key,
T oldValue,
T newValue) |
private static boolean |
logTraceReason(BooleanSupplier predicate,
String fmtWhenTrue,
Object... args) |
void |
onConfigurationChange(org.apache.hadoop.conf.Configuration conf)
This method would be called by the
ConfigurationManager object when the
Configuration object is reloaded from disk. |
private static Period |
parseMergeMinRegionAge(org.apache.hadoop.conf.Configuration conf) |
private static int |
parseMergeMinRegionCount(org.apache.hadoop.conf.Configuration conf) |
private static long |
parseMergeMinRegionSizeMb(org.apache.hadoop.conf.Configuration conf) |
private boolean |
proceedWithMergePlanning(TableDescriptor tableDescriptor) |
private boolean |
proceedWithSplitPlanning(TableDescriptor tableDescriptor) |
void |
setConf(org.apache.hadoop.conf.Configuration conf) |
void |
setMasterServices(MasterServices masterServices)
Set the master service.
|
private boolean |
skipForMerge(SimpleRegionNormalizer.NormalizerConfiguration normalizerConfiguration,
SimpleRegionNormalizer.NormalizeContext ctx,
RegionInfo regionInfo)
Determine if a
RegionInfo should be considered for a merge operation. |
private static boolean |
skipForSplit(RegionState state,
RegionInfo regionInfo)
Determine if a region in
RegionState should be considered for a split operation. |
private static <T> void |
warnInvalidValue(String key,
T parsedValue,
T settledValue) |
private static final org.slf4j.Logger LOG
static final String SPLIT_ENABLED_KEY
static final boolean DEFAULT_SPLIT_ENABLED
static final String MERGE_ENABLED_KEY
static final boolean DEFAULT_MERGE_ENABLED
@Deprecated static final String MIN_REGION_COUNT_KEY
MERGE_MIN_REGION_COUNT_KEY
instead.static final String MERGE_MIN_REGION_COUNT_KEY
static final int DEFAULT_MERGE_MIN_REGION_COUNT
static final String MERGE_MIN_REGION_AGE_DAYS_KEY
static final int DEFAULT_MERGE_MIN_REGION_AGE_DAYS
static final String MERGE_MIN_REGION_SIZE_MB_KEY
static final int DEFAULT_MERGE_MIN_REGION_SIZE_MB
private MasterServices masterServices
private SimpleRegionNormalizer.NormalizerConfiguration normalizerConfiguration
public SimpleRegionNormalizer()
public org.apache.hadoop.conf.Configuration getConf()
getConf
in interface org.apache.hadoop.conf.Configurable
public void setConf(org.apache.hadoop.conf.Configuration conf)
setConf
in interface org.apache.hadoop.conf.Configurable
public void onConfigurationChange(org.apache.hadoop.conf.Configuration conf)
ConfigurationObserver
ConfigurationManager
object when the
Configuration
object is reloaded from disk.onConfigurationChange
in interface ConfigurationObserver
private static int parseMergeMinRegionCount(org.apache.hadoop.conf.Configuration conf)
private static Period parseMergeMinRegionAge(org.apache.hadoop.conf.Configuration conf)
private static long parseMergeMinRegionSizeMb(org.apache.hadoop.conf.Configuration conf)
private static <T> void warnInvalidValue(String key, T parsedValue, T settledValue)
private static <T> void logConfigurationUpdated(String key, T oldValue, T newValue)
public boolean isSplitEnabled()
public boolean isMergeEnabled()
public int getMergeMinRegionCount()
public Period getMergeMinRegionAge()
public long getMergeMinRegionSizeMb()
public void setMasterServices(MasterServices masterServices)
RegionNormalizer
RegionNormalizer.computePlansForTable(TableDescriptor)
.setMasterServices
in interface RegionNormalizer
masterServices
- master services to usepublic List<NormalizationPlan> computePlansForTable(TableDescriptor tableDescriptor)
RegionNormalizer
computePlansForTable
in interface RegionNormalizer
tableDescriptor
- table descriptor for table which needs normalizeprivate long getRegionSizeMB(RegionInfo hri)
private boolean isMasterSwitchEnabled(MasterSwitchType masterSwitchType)
private boolean proceedWithSplitPlanning(TableDescriptor tableDescriptor)
private boolean proceedWithMergePlanning(TableDescriptor tableDescriptor)
private double getAverageRegionSizeMb(List<RegionInfo> tableRegions, TableDescriptor tableDescriptor)
tableRegions
- regions of table to normalizetableDescriptor
- the TableDescriptorTableDescriptor.getNormalizerTargetRegionCount()
private boolean skipForMerge(SimpleRegionNormalizer.NormalizerConfiguration normalizerConfiguration, SimpleRegionNormalizer.NormalizeContext ctx, RegionInfo regionInfo)
RegionInfo
should be considered for a merge operation.
Callers beware: for safe concurrency, be sure to pass in the local instance of
SimpleRegionNormalizer.NormalizerConfiguration
, don't use this
's instance.private List<NormalizationPlan> computeMergeNormalizationPlans(SimpleRegionNormalizer.NormalizeContext ctx)
private static boolean skipForSplit(RegionState state, RegionInfo regionInfo)
RegionState
should be considered for a split operation.private List<NormalizationPlan> computeSplitNormalizationPlans(SimpleRegionNormalizer.NormalizeContext ctx)
private static boolean isOldEnoughForMerge(SimpleRegionNormalizer.NormalizerConfiguration normalizerConfiguration, SimpleRegionNormalizer.NormalizeContext ctx, RegionInfo regionInfo)
true
when regionInfo
has a creation date that is old enough to be
considered for a merge operation, false
otherwise.private boolean isLargeEnoughForMerge(SimpleRegionNormalizer.NormalizerConfiguration normalizerConfiguration, SimpleRegionNormalizer.NormalizeContext ctx, RegionInfo regionInfo)
true
when regionInfo
has a size that is sufficient to be considered for
a merge operation, false
otherwise.
Callers beware: for safe concurrency, be sure to pass in the local instance of
SimpleRegionNormalizer.NormalizerConfiguration
, don't use this
's instance.private static boolean logTraceReason(BooleanSupplier predicate, String fmtWhenTrue, Object... args)
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.