jhungund commented on code in PR #5908:
URL: https://github.com/apache/hbase/pull/5908#discussion_r1603223519
##########
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileWriterImpl.java:
##########
@@ -553,16 +565,26 @@ private void writeInlineBlocks(boolean closing) throws
IOException {
* @param offset the offset of the block we want to cache. Used to determine
the cache key.
*/
private void doCacheOnWrite(long offset) {
- cacheConf.getBlockCache().ifPresent(cache -> {
- HFileBlock cacheFormatBlock = blockWriter.getBlockForCaching(cacheConf);
- try {
- cache.cacheBlock(new BlockCacheKey(name, offset, true,
cacheFormatBlock.getBlockType()),
- cacheFormatBlock, cacheConf.isInMemory(), true);
- } finally {
- // refCnt will auto increase when block add to Cache, see
RAMCache#putIfAbsent
- cacheFormatBlock.release();
- }
- });
+ if (shouldCacheBlock()) {
+ cacheConf.getBlockCache().ifPresent(cache -> {
+ HFileBlock cacheFormatBlock =
blockWriter.getBlockForCaching(cacheConf);
+ try {
+ cache.cacheBlock(new BlockCacheKey(name, offset, true,
cacheFormatBlock.getBlockType()),
+ cacheFormatBlock, cacheConf.isInMemory(), true);
+ } finally {
+ // refCnt will auto increase when block add to Cache, see
RAMCache#putIfAbsent
+ cacheFormatBlock.release();
+ }
+ });
+ }
+ }
+
+ private boolean shouldCacheBlock() {
+ DataTieringManager dataTieringManager = DataTieringManager.getInstance();
+ if (dataTieringManager != null) {
+ return dataTieringManager.isHotData(timeRangeTracker, conf);
Review Comment:
If we do not want to expose the isHotData call taking an argument of
timeRangeTracker, we could wrap this metadata into some data holder (eg: define
a new class DataTieringMetadata) so that we can abstract the time-range
specific information. We will need to set the time-range in that metadata
object and pass it to isHotData(), which will internally check the
dataTieringType and perform the required checks
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]