VladRodionov opened a new pull request, #8383:
URL: https://github.com/apache/hbase/pull/8383
### Summary
This PR adds a diagnostic/test bridge for cached-block iteration while the
block cache architecture is migrating from direct BlockCache usage toward
CacheAccessService.
The existing BlockCache interface extends Iterable<CachedBlock>, and a
number of tests and diagnostic paths rely on that capability.
CacheAccessService should remain the normal read/write-path facade and should
not become a full replacement for every BlockCache method. However, tests and
diagnostics still need a way to access the legacy cached-block iterator during
the transition.
### Changes
* Allows BlockCacheBackedCacheAccessService to expose the cached-block
iteration capability by delegating to the backing BlockCache.
* Adds helper support for discovering or unwrapping diagnostic cache views
from CacheAccessService in test code.
* Adds/updates test factory support for compatibility tests that need both
CacheAccessService and the underlying legacy BlockCache.
* Updates affected tests to work through CacheAccessService while preserving
existing diagnostic/cache-inspection behavior.
### Compatibility notes
This is a transition/diagnostic capability. It does not change cache
read/write semantics.
The main runtime path still uses CacheAccessService for cache access.
Cached-block iteration remains intended for tests, diagnostics, and admin-style
inspection only. Future CacheEngine/topology-backed implementations can expose
equivalent diagnostic iteration when available.
### Out of scope
* No BlockCacheFactory refactoring.
* No CacheEngine runtime wiring.
* No migration of LruBlockCache, LruAdaptiveBlockCache, TinyLfuBlockCache,
or BucketCache to CacheEngine.
* No broad test migration.
* No cache eviction/admission behavior changes.
### Testing
Ran:
```bash
mvn -pl hbase-server test
mvn -pl hbase-server -DskipTests compile
mvn -pl hbase-server spotless:check
mvn -pl hbase-server checkstyle:check
```
### Disclosure
Use this checklist.
Final local checks
git status
git diff --check
mvn -pl hbase-server -Dtest=TestCacheAccessServiceTestFactory test
mvn -pl hbase-server -Dtest=TestHFile#testWriterCacheOnWriteSkipDoesNotLeak
test
mvn -pl hbase-server -DskipTests compile
mvn -pl hbase-server spotless:apply
mvn -pl hbase-server spotless:check
mvn -pl hbase-server checkstyle:check
Review the actual patch:
git diff --stat
git diff
Commit
Adjust file list based on git status, but likely:
git add \
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/cache/BlockCacheBackedCacheAccessService.java
\
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/cache/CacheAccessServices.java
\
hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/cache/CacheAccessServiceTestFactory.java
\
hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/cache/TestCacheAccessServiceTestFactory.java
\
hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFile.java
git commit -m "HBASE-30196 Add diagnostic cache iteration support"
Push:
git push -u origin HBASE-30196-cache-diagnostic-iteration
PR title
HBASE-30196 Add diagnostic cached-block iteration support for
CacheAccessService
PR description
### Summary
This PR adds a diagnostic/test bridge for cached-block iteration while the
block cache architecture is migrating from direct BlockCache usage toward
CacheAccessService.
The existing BlockCache interface extends Iterable<CachedBlock>, and a
number of tests and diagnostic paths rely on that capability.
CacheAccessService should remain the normal read/write-path facade and should
not become a full replacement for every BlockCache method. However, tests and
diagnostics still need a way to access the legacy cached-block iterator during
the transition.
### Changes
* Allows BlockCacheBackedCacheAccessService to expose the cached-block
iteration capability by delegating to the backing BlockCache.
* Adds helper support for discovering or unwrapping diagnostic cache views
from CacheAccessService in test code.
* Adds/updates test factory support for compatibility tests that need both
CacheAccessService and the underlying legacy BlockCache.
* Updates affected tests to work through CacheAccessService while preserving
existing diagnostic/cache-inspection behavior.
### Compatibility notes
This is a transition/diagnostic capability. It does not change cache
read/write semantics.
The main runtime path still uses CacheAccessService for cache access.
Cached-block iteration remains intended for tests, diagnostics, and admin-style
inspection only. Future CacheEngine/topology-backed implementations can expose
equivalent diagnostic iteration when available.
### Out of scope
* No BlockCacheFactory refactoring.
* No CacheEngine runtime wiring.
* No migration of LruBlockCache, LruAdaptiveBlockCache, TinyLfuBlockCache,
or BucketCache to CacheEngine.
* No broad test migration.
* No cache eviction/admission behavior changes.
### Testing
Ran:
```bash
mvn -pl hbase-server -Dtest=TestCacheAccessServiceTestFactory test
mvn -pl hbase-server -Dtest=TestHFile#testWriterCacheOnWriteSkipDoesNotLeak
test
mvn -pl hbase-server -DskipTests compile
mvn -pl hbase-server spotless:check
mvn -pl hbase-server checkstyle:check
```
### Disclosure
Parts of this PR, including helper code structure and PR description text,
were prepared with assistance from ChatGPT 5.5 and reviewed by the author.
--
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]