taklwu commented on code in PR #8279:
URL: https://github.com/apache/hbase/pull/8279#discussion_r3314547343
##########
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/cache/CacheTopology.java:
##########
@@ -198,4 +198,50 @@ default boolean demote(BlockCacheKey cacheKey, Cacheable
block, CacheEngine sour
* @return read-only topology view
*/
CacheTopologyView getView();
+
+ /**
+ * Returns the resizable cache engine for the specified tier, if that tier
exists and its engine
+ * supports runtime resizing.
+ * <p>
+ * Resizing is an optional per-engine capability. A topology may contain a
mix of resizable and
+ * non-resizable engines, for example a resizable on-heap L1 and a
fixed-size off-heap L2. This
+ * helper allows admin/control code to discover resize support without
exposing resizing on the
+ * read/write path facade.
+ * </p>
+ * @param tier cache tier to inspect
+ * @return resizable engine for the tier, or empty if the tier does not
exist or is not resizable
+ */
+ default Optional<ResizableCacheEngine> getResizableEngine(CacheTier tier) {
Review Comment:
what is this about ? I cannot find usage in this PR
##########
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/cache/CacheTopology.java:
##########
@@ -198,4 +198,50 @@ default boolean demote(BlockCacheKey cacheKey, Cacheable
block, CacheEngine sour
* @return read-only topology view
*/
CacheTopologyView getView();
+
+ /**
+ * Returns the resizable cache engine for the specified tier, if that tier
exists and its engine
+ * supports runtime resizing.
+ * <p>
+ * Resizing is an optional per-engine capability. A topology may contain a
mix of resizable and
+ * non-resizable engines, for example a resizable on-heap L1 and a
fixed-size off-heap L2. This
+ * helper allows admin/control code to discover resize support without
exposing resizing on the
+ * read/write path facade.
+ * </p>
+ * @param tier cache tier to inspect
+ * @return resizable engine for the tier, or empty if the tier does not
exist or is not resizable
+ */
+ default Optional<ResizableCacheEngine> getResizableEngine(CacheTier tier) {
+ Optional<CacheEngine> engine = getEngine(tier);
+ if (engine.isPresent() && engine.get() instanceof ResizableCacheEngine) {
+ return Optional.of((ResizableCacheEngine) engine.get());
+ }
+ return Optional.empty();
+ }
+
+ /**
+ * Returns the file-tracking cache engine for the specified tier, if that
tier exists and its
+ * engine supports file/region cache tracking diagnostics.
+ * <p>
+ * File and region cache tracking is an optional per-engine capability. A
topology may contain a
+ * mix of engines where only one tier supports this information. For
example, an L2 engine may
+ * track fully cached files while an L1 engine only stores recently used
blocks and does not
+ * maintain file-level progress state.
+ * </p>
+ * <p>
+ * This helper is intended for diagnostics, metrics, and admin/control code.
Normal HFile read and
+ * write path callers should use {@link CacheAccessService} and should not
depend on this optional
+ * capability.
+ * </p>
+ * @param tier cache tier to inspect
+ * @return file-tracking engine for the tier, or empty if the tier does not
exist or does not
+ * support file/region cache tracking
+ */
+ default Optional<CacheFileTrackingEngine> getFileTrackingEngine(CacheTier
tier) {
Review Comment:
ditto, if we don't have any usage at the moment, can you remove it?
##########
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderImpl.java:
##########
@@ -1104,14 +1105,14 @@ public HFileBlock getCachedBlock(BlockCacheKey
cacheKey, boolean cacheBlock, boo
boolean updateCacheMetrics, BlockType expectedBlockType,
DataBlockEncoding expectedDataBlockEncoding) throws IOException {
// Check cache for block. If found return.
- BlockCache cache = cacheConf.getBlockCache().orElse(null);
+ CacheAccessService cacheAccessService = cacheConf.getCacheAccessService();
long cachedBlockBytesRead = 0;
- if (cache != null) {
+ if (cacheAccessService != null) {
HFileBlock cachedBlock = null;
Review Comment:
nit: can you check what we should do here? I agreed that it's non null and
default to `NoOpCacheAccessService` and null check does not make any difference.
--
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]