@InterfaceAudience.LimitedPrivate(value="Configuration") public class SimpleRegionNormalizer extends Object implements RegionNormalizer
The following parameters are configurable:
To see detailed logging of the application of these configuration values, set the log level for this class to `TRACE`.
Modifier and Type | Class and Description |
---|---|
private class |
SimpleRegionNormalizer.NormalizeContext
Inner class caries the state necessary to perform a single invocation of
computePlansForTable(TableName) . |
Modifier and Type | Field and Description |
---|---|
private org.apache.hadoop.conf.Configuration |
conf |
(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_SIZE_MB |
(package private) static int |
DEFAULT_MIN_REGION_COUNT |
(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_SIZE_MB_KEY |
private boolean |
mergeEnabled |
private Period |
mergeMinRegionAge |
private int |
mergeMinRegionSizeMb |
(package private) static String |
MIN_REGION_COUNT_KEY |
private int |
minRegionCount |
private long[] |
skippedCount |
(package private) static String |
SPLIT_ENABLED_KEY |
private boolean |
splitEnabled |
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(TableName table)
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) |
org.apache.hadoop.conf.Configuration |
getConf() |
Period |
getMergeMinRegionAge()
Return this instance's configured value for "hbase.normalizer.merge.min_region_age.days".
|
int |
getMergeMinRegionSizeMb()
Return this instance's configured value for "hbase.normalizer.merge.min_region_size.mb".
|
int |
getMinRegionCount()
Return this instance's configured value for "hbase.normalizer.min.region.count".
|
private long |
getRegionSizeMB(RegionInfo hri) |
long |
getSkippedCount(NormalizationPlan.PlanType type) |
private boolean |
isLargeEnoughForMerge(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 boolean |
isOldEnoughForMerge(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 boolean |
logTraceReason(BooleanSupplier predicate,
String fmtWhenTrue,
Object... args) |
private static Period |
parseMergeMinRegionAge(org.apache.hadoop.conf.Configuration conf) |
private static int |
parseMergeMinRegionSizeMb(org.apache.hadoop.conf.Configuration conf) |
private static int |
parseMinRegionCount(org.apache.hadoop.conf.Configuration conf) |
void |
planSkipped(RegionInfo hri,
NormalizationPlan.PlanType type)
Notification for the case where plan couldn't be executed due to constraint violation, such as
namespace quota
|
private boolean |
proceedWithMergePlanning() |
private boolean |
proceedWithSplitPlanning() |
void |
setConf(org.apache.hadoop.conf.Configuration conf) |
void |
setMasterServices(MasterServices masterServices)
Set the master service.
|
private boolean |
skipForMerge(RegionStates regionStates,
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
static final String MIN_REGION_COUNT_KEY
static final int DEFAULT_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 final long[] skippedCount
private org.apache.hadoop.conf.Configuration conf
private MasterServices masterServices
private boolean splitEnabled
private boolean mergeEnabled
private int minRegionCount
private Period mergeMinRegionAge
private int mergeMinRegionSizeMb
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
private static int parseMinRegionCount(org.apache.hadoop.conf.Configuration conf)
private static Period parseMergeMinRegionAge(org.apache.hadoop.conf.Configuration conf)
private static int parseMergeMinRegionSizeMb(org.apache.hadoop.conf.Configuration conf)
private static <T> void warnInvalidValue(String key, T parsedValue, T settledValue)
public boolean isSplitEnabled()
public boolean isMergeEnabled()
public int getMinRegionCount()
public Period getMergeMinRegionAge()
public int getMergeMinRegionSizeMb()
public void setMasterServices(MasterServices masterServices)
RegionNormalizer
RegionNormalizer.computePlansForTable(TableName)
.setMasterServices
in interface RegionNormalizer
masterServices
- master services to usepublic void planSkipped(RegionInfo hri, NormalizationPlan.PlanType type)
RegionNormalizer
planSkipped
in interface RegionNormalizer
hri
- the region which is involved in the plantype
- type of planpublic long getSkippedCount(NormalizationPlan.PlanType type)
getSkippedCount
in interface RegionNormalizer
type
- type of plan for which skipped count is to be returnedpublic List<NormalizationPlan> computePlansForTable(TableName table)
RegionNormalizer
computePlansForTable
in interface RegionNormalizer
table
- table to normalizeprivate long getRegionSizeMB(RegionInfo hri)
private boolean isMasterSwitchEnabled(MasterSwitchType masterSwitchType)
private boolean proceedWithSplitPlanning()
private boolean proceedWithMergePlanning()
private double getAverageRegionSizeMb(List<RegionInfo> tableRegions)
tableRegions
- regions of table to normalizeAlso make sure tableRegions contains regions of the same table
private boolean skipForMerge(RegionStates regionStates, RegionInfo regionInfo)
RegionInfo
should be considered for a merge operation.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 boolean isOldEnoughForMerge(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(RegionInfo regionInfo)
true
when regionInfo
has a size that is sufficient
to be considered for a merge operation, false
otherwise.private static boolean logTraceReason(BooleanSupplier predicate, String fmtWhenTrue, Object... args)
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.