taklwu commented on code in PR #8128:
URL: https://github.com/apache/hbase/pull/8128#discussion_r3150380890
##########
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketCache.java:
##########
@@ -2490,7 +2490,16 @@ public Optional<Boolean> shouldCacheFile(HFileInfo
hFileInfo, Configuration conf
String fileName = hFileInfo.getHFileContext().getHFileName();
DataTieringManager dataTieringManager = DataTieringManager.getInstance();
if (dataTieringManager != null && !dataTieringManager.isHotData(hFileInfo,
conf)) {
- LOG.debug("Data tiering is enabled for file: '{}' and it is not hot
data", fileName);
+ LOG.debug("Custom tiering is enabled for file: '{}' and it is not hot
data", fileName);
+ // If custom tiering has been just enabled for a file that was cached,
we now need
+ // to evict it.
+ Set<BlockCacheKey> keySet =
+ getAllCacheKeysForFile(hFileInfo.getHFileContext().getHFileName(), 0,
Long.MAX_VALUE);
+ int evictedBlocks = evictBlockSet(keySet);
+ if (evictedBlocks > 0) {
+ LOG.info("Evicted {} blocks for file {} as it is now considered cold
by DataTieringManager",
Review Comment:
nit: should we have it as debug level? I'm wondered if we see a lot of these
message.
##########
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java:
##########
@@ -1613,6 +1600,16 @@ RegionLoad createRegionLoad(final HRegion r,
RegionLoad.Builder regionLoadBldr,
}
});
});
+ final MutableFloat currentRegionColdDataRatio = new MutableFloat(0.0f);
+ if (DataTieringManager.getInstance() != null) {
+ Pair<List<String>, Long> coldEntry =
+
DataTieringManager.getInstance().getRegionColdDataSize().get(regionEncodedName);
+ if (coldEntry != null) {
+ int coldSizeMB = roundSize(coldEntry.getSecond(), unitMB);
+ currentRegionColdDataRatio
+ .setValue(regionSizeMB == 0 ? 0.0f : (float) coldSizeMB /
regionSizeMB);
+ }
+ }
Review Comment:
nit: the code logic is right, just wondered if we should align the same
lambda expression style like the lines above between 1594 and 1602 ?
##########
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketProtoUtils.java:
##########
@@ -100,9 +100,16 @@ private static void
addEntryToBuilder(Map.Entry<BlockCacheKey, BucketEntry> entr
}
private static BucketCacheProtos.BlockCacheKey toPB(BlockCacheKey key) {
- return
BucketCacheProtos.BlockCacheKey.newBuilder().setHfilename(key.getHfileName())
- .setOffset(key.getOffset()).setPrimaryReplicaBlock(key.isPrimary())
- .setBlockType(toPB(key.getBlockType())).build();
+ BucketCacheProtos.BlockCacheKey.Builder builder =
BucketCacheProtos.BlockCacheKey.newBuilder()
+ .setHfilename(key.getHfileName()).setOffset(key.getOffset())
+
.setPrimaryReplicaBlock(key.isPrimary()).setBlockType(toPB(key.getBlockType()));
+ if (key.getCfName() != null) {
+ builder.setFamilyName(key.getCfName());
+ }
+ if (key.getRegionName() != null) {
+ builder.setRegionName(key.getRegionName());
+ }
Review Comment:
why weren't the cf and regionname filled before ?
--
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]