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 String
static final String
static final DataTieringType
static final long
static final boolean
static final String
private static DataTieringManager
private 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.Configuration
getConfiguration
(org.apache.hadoop.fs.Path hFilePath) private long
private long
getDataTieringHotDataAge
(org.apache.hadoop.conf.Configuration conf) private DataTieringType
getDataTieringType
(org.apache.hadoop.conf.Configuration conf) private HRegion
getHRegion
(org.apache.hadoop.fs.Path hFilePath) private HStore
getHStore
(org.apache.hadoop.fs.Path hFilePath) private HStoreFile
getHStoreFile
(org.apache.hadoop.fs.Path hFilePath) static DataTieringManager
Retrieves the instance of DataTieringManager.private boolean
hotDataValidator
(long maxTimestamp, long hotDataAge) 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.boolean
isDataTieringEnabled
(org.apache.hadoop.fs.Path hFilePath) Determines whether data tiering is enabled for the given HFile path.boolean
Determines whether data tiering is enabled for the given block cache key.private static boolean
isDataTieringFeatureEnabled
(org.apache.hadoop.conf.Configuration conf) boolean
isHotData
(long maxTimestamp, org.apache.hadoop.conf.Configuration conf) Determines whether the data associated with the given time range tracker is considered hot.boolean
isHotData
(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.boolean
isHotData
(BlockCacheKey key) Determines whether the data associated with the given block cache key is considered hot.boolean
Determines 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:
true
if data tiering is enabled for the HFile associated with the key,false
otherwise- 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:
true
if data tiering is enabled,false
otherwise- 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_RANGE
and maximum timestamp is not present, it considersLong.MAX_VALUE
as the maximum timestamp, making the data hot by default.- Parameters:
key
- the block cache key- Returns:
true
if the data is hot,false
otherwise- 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:
true
if the data is hot,false
otherwise
-
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_RANGE
and maximum timestamp is not present, it considersLong.MAX_VALUE
as the maximum timestamp, making the data hot by default.- Parameters:
hFilePath
- the path to the HFile- Returns:
true
if the data is hot,false
otherwise- 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_RANGE
and maximum timestamp is not present, it considersLong.MAX_VALUE
as 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:
true
if the data is hot,false
otherwise
-
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
-