wchevreuil commented on code in PR #5908:
URL: https://github.com/apache/hbase/pull/5908#discussion_r1603543226
##########
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileWriterImpl.java:
##########
@@ -57,6 +61,7 @@
import org.apache.yetus.audience.InterfaceAudience;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import javax.xml.crypto.Data;
Review Comment:
Unnecessary import?
##########
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:
We should move this shouldCacheBlock to the CacheConfig class.
--
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]