Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-28469: Integration of time-based priority caching into compaction paths#5866
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
740f8f5f648081e17df62d7d15ebd757ecc3da7b439ea998dFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -116,5 +116,4 @@ public void setBlockType(BlockType blockType) { | ||
| public Path getFilePath() { | ||
| return filePath; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -78,6 +78,7 @@ | ||
| import org.apache.hadoop.hbase.nio.RefCnt; | ||
| import org.apache.hadoop.hbase.protobuf.ProtobufMagic; | ||
| import org.apache.hadoop.hbase.regionserver.DataTieringManager; | ||
| import org.apache.hadoop.hbase.regionserver.TimeRangeTracker; | ||
| import org.apache.hadoop.hbase.util.Bytes; | ||
| import org.apache.hadoop.hbase.util.EnvironmentEdgeManager; | ||
| import org.apache.hadoop.hbase.util.IdReadWriteLock; | ||
| @@ -2203,6 +2204,18 @@ public Optional<Boolean> shouldCacheFile(HFileInfo hFileInfo, Configuration conf | ||
| return Optional.of(!fullyCachedFiles.containsKey(fileName)); | ||
| } | ||
| @Override | ||
| public Optional<Boolean> shouldCacheBlock(BlockCacheKey key, TimeRangeTracker timeRangeTracker, | ||
| Configuration conf) { | ||
| DataTieringManager dataTieringManager = DataTieringManager.getInstance(); | ||
| if (dataTieringManager != null && !dataTieringManager.isHotData(timeRangeTracker, conf)) { | ||
| LOG.debug("Data tiering is enabled for file: '{}' and it is not hot data", | ||
| key.getHfileName()); | ||
| ||
| return Optional.of(false); | ||
| } | ||
| return Optional.of(true); | ||
| } | ||
| @Override | ||
| public Optional<Boolean> isAlreadyCached(BlockCacheKey key) { | ||
| return Optional.of(getBackingMap().containsKey(key)); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -131,6 +131,27 @@ public boolean isHotData(BlockCacheKey key) throws DataTieringException { | ||
| return isHotData(hFilePath); | ||
| } | ||
| /** | ||
| * Determines whether the data associated with the given time range tracker is considered hot. If | ||
| * the data tiering type is set to {@link DataTieringType#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. | ||
| * @param timeRangeTracker the time range tracker containing the timestamps | ||
| * @param conf The configuration object to use for determining hot data criteria. | ||
| * @return {@code true} if the data is hot, {@code false} otherwise | ||
| */ | ||
| public boolean isHotData(TimeRangeTracker timeRangeTracker, Configuration conf) { | ||
| DataTieringType dataTieringType = getDataTieringType(conf); | ||
| if ( | ||
| dataTieringType.equals(DataTieringType.TIME_RANGE) | ||
| && timeRangeTracker.getMax() != TimeRangeTracker.INITIAL_MAX_TIMESTAMP | ||
| ) { | ||
| return hotDataValidator(timeRangeTracker.getMax(), getDataTieringHotDataAge(conf)); | ||
| } | ||
| // DataTieringType.NONE or other types are considered hot by default | ||
| return true; | ||
| } | ||
| /** | ||
| * 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 to | ||
| @@ -151,6 +172,27 @@ public boolean isHotData(Path hFilePath) throws DataTieringException { | ||
| return true; | ||
| } | ||
| /** | ||
| * 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 to | ||
| * {@link DataTieringType#TIME_RANGE}, it validates the data against the provided maximum | ||
| * timestamp. | ||
| * @param hFilePath the path to the HFile | ||
| * @param maxTimestamp the maximum timestamp to validate against | ||
| * @return {@code true} if the data is hot, {@code false} otherwise | ||
| * @throws DataTieringException if there is an error retrieving data tiering information | ||
| */ | ||
| public boolean isHotData(Path hFilePath, long maxTimestamp) throws DataTieringException { | ||
| Configuration configuration = getConfiguration(hFilePath); | ||
| DataTieringType dataTieringType = getDataTieringType(configuration); | ||
| if (dataTieringType.equals(DataTieringType.TIME_RANGE)) { | ||
| return hotDataValidator(maxTimestamp, getDataTieringHotDataAge(configuration)); | ||
| } | ||
| // DataTieringType.NONE or other types are considered hot by default | ||
| return true; | ||
| } | ||
| /** | ||
| * 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 to | ||
| @@ -231,10 +273,12 @@ public Set<String> getColdDataFiles(Set<BlockCacheKey> allCachedBlocks) | ||
| } | ||
| private HRegion getHRegion(Path hFilePath) throws DataTieringException { | ||
| if (hFilePath.getParent() == null || hFilePath.getParent().getParent() == null) { | ||
| throw new DataTieringException("Incorrect HFile Path: " + hFilePath); | ||
| String regionId; | ||
| try { | ||
| regionId = HRegionFileSystem.getRegionId(hFilePath); | ||
| } catch (IOException e) { | ||
| throw new DataTieringException(e.getMessage()); | ||
| } | ||
wchevreuil marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| String regionId = hFilePath.getParent().getParent().getName(); | ||
| HRegion hRegion = this.onlineRegions.get(regionId); | ||
| if (hRegion == null) { | ||
| throw new DataTieringException("HRegion corresponding to " + hFilePath + " doesn't exist"); | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.