Class DataTieringManager
java.lang.Object
org.apache.hadoop.hbase.regionserver.DataTieringManager
The DataTieringManager class categorizes data into hot data and cold data based on the specified
DataTieringType when DataTiering is enabled. DataTiering is disabled by default with
DataTieringType set to DataTieringType.NONE. The DataTieringType
determines the logic for distinguishing data into hot or cold. By default, all data is considered
as hot.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final DataTieringTypestatic final longstatic final booleanstatic final Stringprivate static DataTieringManagerprivate static final org.slf4j.Logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetColdDataFiles(Set<BlockCacheKey> allCachedBlocks) Returns a set of cold data filenames from the given set of cached blocks.private org.apache.hadoop.conf.ConfigurationgetConfiguration(org.apache.hadoop.fs.Path hFilePath) private longprivate longgetDataTieringHotDataAge(org.apache.hadoop.conf.Configuration conf) private DataTieringTypegetDataTieringType(org.apache.hadoop.conf.Configuration conf) private HRegiongetHRegion(org.apache.hadoop.fs.Path hFilePath) private HStoregetHStore(org.apache.hadoop.fs.Path hFilePath) private HStoreFilegetHStoreFile(org.apache.hadoop.fs.Path hFilePath) static DataTieringManagerRetrieves the instance of DataTieringManager.private booleanhotDataValidator(long maxTimestamp, long hotDataAge) static booleaninstantiate(org.apache.hadoop.conf.Configuration conf, Map<String, HRegion> onlineRegions) Initializes the DataTieringManager instance with the provided map of online regions, only if the configuration "hbase.regionserver.datatiering.enable" is enabled.booleanisDataTieringEnabled(org.apache.hadoop.fs.Path hFilePath) Determines whether data tiering is enabled for the given HFile path.booleanDetermines whether data tiering is enabled for the given block cache key.private static booleanisDataTieringFeatureEnabled(org.apache.hadoop.conf.Configuration conf) booleanisHotData(long maxTimestamp, org.apache.hadoop.conf.Configuration conf) Determines whether the data associated with the given time range tracker is considered hot.booleanisHotData(org.apache.hadoop.fs.Path hFilePath) Determines whether the data in the HFile at the given path is considered hot based on the configured data tiering type and hot data age.booleanisHotData(BlockCacheKey key) Determines whether the data associated with the given block cache key is considered hot.booleanDetermines whether the data in the HFile being read is considered hot based on the configured data tiering type and hot data age.static void
-
Field Details
-
LOG
-
GLOBAL_DATA_TIERING_ENABLED_KEY
- See Also:
-
DEFAULT_GLOBAL_DATA_TIERING_ENABLED
- See Also:
-
DATATIERING_KEY
- See Also:
-
DATATIERING_HOT_DATA_AGE_KEY
- See Also:
-
DEFAULT_DATATIERING
-
DEFAULT_DATATIERING_HOT_DATA_AGE
- See Also:
-
instance
-
onlineRegions
-
-
Constructor Details
-
DataTieringManager
-
-
Method Details
-
instantiate
public static boolean instantiate(org.apache.hadoop.conf.Configuration conf, Map<String, HRegion> onlineRegions) Initializes the DataTieringManager instance with the provided map of online regions, only if the configuration "hbase.regionserver.datatiering.enable" is enabled.- Parameters:
conf- Configuration object.onlineRegions- A map containing online regions.- Returns:
- True if the instance is instantiated successfully, false otherwise.
-
getInstance
Retrieves the instance of DataTieringManager.- Returns:
- The instance of DataTieringManager, if instantiated, null otherwise.
-
isDataTieringEnabled
Determines whether data tiering is enabled for the given block cache key.- Parameters:
key- the block cache key- Returns:
trueif data tiering is enabled for the HFile associated with the key,falseotherwise- Throws:
DataTieringException- if there is an error retrieving the HFile path or configuration
-
isDataTieringEnabled
public boolean isDataTieringEnabled(org.apache.hadoop.fs.Path hFilePath) throws DataTieringException Determines whether data tiering is enabled for the given HFile path.- Parameters:
hFilePath- the path to the HFile- Returns:
trueif data tiering is enabled,falseotherwise- Throws:
DataTieringException- if there is an error retrieving the configuration
-
isHotData
Determines whether the data associated with the given block cache key is considered hot. If the data tiering type is set toDataTieringType.TIME_RANGEand maximum timestamp is not present, it considersLong.MAX_VALUEas the maximum timestamp, making the data hot by default.- Parameters:
key- the block cache key- Returns:
trueif the data is hot,falseotherwise- Throws:
DataTieringException- if there is an error retrieving data tiering information
-
isHotData
Determines whether the data associated with the given time range tracker is considered hot. If the data tiering type is set toDataTieringType.TIME_RANGE, it uses the maximum timestamp from the time range tracker to determine if the data is hot. Otherwise, it considers the data as hot by default.- Parameters:
maxTimestamp- the maximum timestamp associated with the data.conf- The configuration object to use for determining hot data criteria.- Returns:
trueif the data is hot,falseotherwise
-
isHotData
Determines whether the data in the HFile at the given path is considered hot based on the configured data tiering type and hot data age. If the data tiering type is set toDataTieringType.TIME_RANGEand maximum timestamp is not present, it considersLong.MAX_VALUEas the maximum timestamp, making the data hot by default.- Parameters:
hFilePath- the path to the HFile- Returns:
trueif the data is hot,falseotherwise- Throws:
DataTieringException- if there is an error retrieving data tiering information
-
isHotData
Determines whether the data in the HFile being read is considered hot based on the configured data tiering type and hot data age. If the data tiering type is set toDataTieringType.TIME_RANGEand maximum timestamp is not present, it considersLong.MAX_VALUEas the maximum timestamp, making the data hot by default.- Parameters:
hFileInfo- Information about the HFile to determine if its data is hot.configuration- The configuration object to use for determining hot data criteria.- Returns:
trueif the data is hot,falseotherwise
-
hotDataValidator
-
getCurrentTimestamp
-
getColdDataFiles
Returns a set of cold data filenames from the given set of cached blocks. Cold data is determined by the configured data tiering type and hot data age.- Parameters:
allCachedBlocks- a set of all cached block cache keys- Returns:
- a set of cold data filenames
- Throws:
DataTieringException- if there is an error determining whether a block is hot
-
getHRegion
- Throws:
DataTieringException
-
getHStore
- Throws:
DataTieringException
-
getHStoreFile
- Throws:
DataTieringException
-
getConfiguration
private org.apache.hadoop.conf.Configuration getConfiguration(org.apache.hadoop.fs.Path hFilePath) throws DataTieringException - Throws:
DataTieringException
-
getDataTieringType
-
getDataTieringHotDataAge
-
getColdFilesList
-
isDataTieringFeatureEnabled
-
resetForTestingOnly
-