Repository navigation
HBASE-30383 Migrate RegionServer block cache ownership to CacheAccessService - #8801
Conversation
0925dc4 to
44b6842
Compare
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
3 open issues
This changes behavior from the previous guarded logic (only disablingevictOnClosewhen L2 was a… · New This JSP is used as a JSON endpoint; returning early without writing a JSON payload produces an… · New The message 'BlockCache is null' is no longer accurate when the cache is represented by… · New
What changed in this PR
Migrates remaining RegionServer-side cache usage away from the legacy BlockCache API to the newer CacheAccessService / CacheEngine abstractions, including tests and RegionServer web UI/metrics integration.
Changes:
- Replaced RegionServer and test callers from
BlockCachetoCacheAccessService, usingCacheEnginewhere tier-specific behavior is required. - Updated RegionServer diagnostics/metrics and JSP UI pages to operate on
CacheAccessService/CacheEnginerather thanBlockCache. - Adapted heap memory tuning and cache-related tests/utilities to inject
CacheAccessServiceand to re-query snapshot APIs where needed.
| File | Description |
|---|---|
| hbase-testing-util/src/main/java/org/apache/hadoop/hbase/HBaseTestingUtility.java | Updates testing utility APIs to accept/inject CacheAccessService instead of BlockCache. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRecoveredEdits.java | Migrates recovered edits test setup to create cache via CacheAccessServices. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMultiColumnScanner.java | Switches test region creation from BlockCacheFactory to CacheAccessServices. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHeapMemoryManager.java | Refactors heap memory manager tests to use ResizableCacheEngine + CAS topology. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestDataTieringManager.java | Uses CAS APIs for fully-cached-file checks and cache stats in data tiering tests. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCustomCellDataTieringManager.java | Migrates custom cell tiering tests from BlockCache to CAS. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestClearRegionBlockCache.java | Updates cache clearing tests to reference getCacheAccessService() instead of getBlockCache(). |
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCacheOnWriteInSchema.java | Creates CAS from configuration for cache-on-write tests. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestBytesReadServerSideScanMetrics.java | Uses CacheEngine (LRU) via CAS for assertions and removes direct BlockCache access. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestBlocksScanned.java | Migrates per-test cache setup/metrics from BlockCache to CAS. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestBlocksRead.java | Switches cache wiring and cache-enabled checks to CAS/NoOp CAS. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/master/MockRegionServer.java | Implements new RegionServerServices cache accessor with NoOpCacheAccessService. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestScannerSelectionUsingTTL.java | Updates cache creation/clearing to use CAS and LRU engine. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestScannerFromBucketCache.java | Uses CAS from config when creating regions for bucket cache scanning tests. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestForceCacheImportantBlocks.java | Uses CAS end-to-end for region creation and cache stats in force-cache tests. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestCacheOnWrite.java | Simplifies passing cache into test regions to use CAS directly. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestCacheConfig.java | Removes ConfigurationManager child-registration tests after CacheConfig observer changes. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestBlockEvictionOnRegionMovement.java | Switches tier-specific eviction assertions to per-tier CacheEngine. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestClientSideRegionScanner.java | Updates client-side region scanner tests to retrieve BlockCache via CAS test factory. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestBlockEvictionFromClient.java | Migrates client eviction tests to CAS and cached-block iterable adapters. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAvoidCellReferencesIntoShippedBlocks.java | Uses cache engines and engine adapters for safe tier/L2-specific eviction logic. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/TestCacheEviction.java | Updates cached-file checks to read from CAS aggregated snapshot API. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtil.java | Adjusts in-server testing util entry points to accept CAS instead of BlockCache. |
| hbase-server/src/main/resources/hbase-webapps/regionserver/regionserver.jsp | Passes CAS into block cache view rendering instead of optional BlockCache. |
| hbase-server/src/main/resources/hbase-webapps/regionserver/blockCacheView.jsp | Reworks JSON view to operate on cache topology tiers/engines rather than BlockCache arrays. |
| hbase-server/src/main/resources/hbase-webapps/regionserver/blockCacheStats.jsp | Displays cache stats based on CAS (and treats NoOp as disabled). |
| hbase-server/src/main/resources/hbase-webapps/regionserver/blockCacheLevel.jsp | Updates tier-level UI rendering to use CacheEngine and block-cache-backed adapters. |
| hbase-server/src/main/resources/hbase-webapps/regionserver/blockCacheHits.jsp | Reads stats from either CacheEngine or CAS for hit-ratio rendering. |
| hbase-server/src/main/resources/hbase-webapps/regionserver/blockCacheEvictions.jsp | Reads eviction stats from either CacheEngine or CAS. |
| hbase-server/src/main/resources/hbase-webapps/regionserver/blockCacheBaseInfo.jsp | Updates base info UI to treat the “bc” attribute as CAS. |
| hbase-server/src/main/resources/hbase-webapps/regionserver/blockCache.jsp | Refactors block cache tab wiring to pull L1/L2 engines from CAS topology. |
| hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionServerServices.java | Introduces getCacheAccessService() on RS services interface replacing getBlockCache(). |
| hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java | Switches RPC endpoints to use CAS for cache size/cached-files reporting. |
| hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionWrapperImpl.java | Migrates region cached-size metrics to use CAS getRegionCachedInfo(). |
| hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsRegionServerWrapperImpl.java | Refactors RS cache metrics to initialize engines from CAS/topologies and derive tier stats. |
| hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HeapMemoryManager.java | Updates heap memory manager to resize a ResizableCacheEngine extracted from CAS. |
| hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java | Creates CacheConfig using region’s CAS instead of BlockCache. |
| hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java | Makes CAS the RS-owned cache component; wiring for shutdown, observers, and heap tuning. |
| hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java | Replaces per-region BlockCache storage with CAS and updates graceful-stop close behavior. |
| hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/cache/TopologyBackedCacheAccessService.java | Implements CAS getRegionCachedInfo() by delegating to the tier that tracks it. |
| hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/cache/LruCacheEngine.java | Exposes existing “for test” helpers as public for test/diagnostic access. |
| hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/cache/CacheEngine.java | Adds getRegionCachedInfo() optional API to cache engines. |
| hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/cache/CacheAccessService.java | Adds CAS getRegionCachedInfo() optional API. |
| hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/cache/BlockCacheBackedCacheEngine.java | Delegates region cached info to wrapped BlockCache when available. |
| hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CacheConfig.java | Switches CacheConfig to ConfigurationObserver and removes child observer registration hooks. |
| hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/BlockCacheUtil.java | Adds JSON helpers and cached-block-by-file aggregation for CAS/engine-based views. |
| hbase-server/src/main/java/org/apache/hadoop/hbase/client/ClientSideRegionScanner.java | Uses CAS for client-side scanning cache ownership and shutdown. |
| hbase-server/src/main/java/org/apache/hadoop/hbase/MockRegionServerServices.java | Implements new getCacheAccessService() to return a no-op CAS. |
| hbase-diagnostics/src/test/java/org/apache/hadoop/hbase/io/encoding/TestEncodedSeekers.java | Migrates diagnostics test to access LRU engine via CAS test factory. |
Review effort: Lite
|
Waiting for the rest of a review. |
|
Initial review feedback from Claude. I haven't verified its claims yet. Review by Claude (AI), on behalf of @anmolnar . Based on reading 44b6842 against its parent; I didn't build or run the tests. Thanks for pushing this forward. Moving RS ownership to Blocking
Non-blocking, but worth doing
Nits
|
|
No. 1 has been addressed already in the previous review, will work on the rest issues. Thanks, @anmolnar |
|
On the last one nit: I agree that this is a public API signature change and should be called out in the release notes. I don't think retaining BlockCache overloads is desirable here, though, since the goal of this migration is to remove BlockCache references entirely. I'll keep the CacheAccessService signatures and add the appropriate release note for the master merge. |
44b6842 to
5eaad37
Compare
|
Addressed review comments:
Almost all nits.
|
|
Second-round review by Claude (AI), on behalf of @. Based on 5eaad37 vs the previous 44b6842; not built or run locally. Thanks for the quick turnaround. The blocking items are fixed: the persistent-L2 check is back in A few remaining items:
Nits: LGTM once 1 and 2 are addressed. |
|
This failures are not PR - related. |
5eaad37 to
48c880d
Compare
48c880d to
39faf70
Compare
|
Third-round review by Claude (AI), on behalf of @anmolnar Based on 39faf70 vs the previous 5eaad37; not built or run locally. Thanks, this looks good to me. Final newlines are restored, Correction to my previous round: the Optional cleanups, here or in a follow-up:
+1 from me. |


Summary
This PR continues the BlockCache pluggable architecture work by migrating the remaining HBase callers from the legacy
BlockCacheAPI to the newCacheAccessService/CacheEngineabstractions.The goal is to remove direct dependencies on
BlockCachefrom HBase-facing code while preserving the existing cache behavior and compatibility.Changes
CacheAccessService.CacheEnginewhere required.CacheAccessServiceandCacheEngine.HBaseTestingUtilandHBaseTestingUtilitytest infrastructure to injectCacheAccessServiceinstead ofBlockCache.HeapMemoryManagerintegration to work with the appropriate resizable cache engine.BlockCache#getBlockCaches().CacheAccessService#getFullyCachedFiles()API.testPrefetchWhenDataTieringEnabledto re-read the current fully-cached-files state while waiting for asynchronous prefetch completion.TopologyBackedCacheAccessService#getFullyCachedFiles()returns an aggregate snapshot rather than a live backing map.This change intentionally keeps direct
CacheEngineaccess limited to tests, diagnostics, topology-specific code, and places where per-tier behavior is required. Normal HBase read/write paths useCacheAccessService.Compatibility
Legacy cache implementations can still participate through the existing
BlockCache-to-CacheEngineadapters. This allows the migration to proceed incrementally without requiring all cache implementations to be converted at once.Compatibility / release notes
This change is intended to preserve cache behavior, but it includes two externally visible compatibility changes that should be called out when the work is merged to master:
HBaseTestingUtilitytest helper methods that previously acceptedBlockCache, includingcreateRegionAndWAL(...)andcreateTestRegion(...), now acceptCacheAccessService.HBaseTestingUtilityis deprecated but is still@InterfaceAudience.Public, so this is a sourcecompatibility change for downstream test code using these methods. I intentionally did not retain
BlockCachecompatibility overloads because the goal of the cache migration is to removeBlockCachedependencies completely.blockCacheView.jspnow returnsContent-Type: application/json;charset=UTF-8instead oftext/html;charset=UTF-8. The endpoint already returns JSON, so the new content type reflects theactual response format. This does not change the JSON payload, but clients that inspect the HTTP
content type will observe the change.
Except for the compatibility points above, the changes in this PR are intended to preserve existing
user-visible cache behavior while migrating implementation and call sites to the pluggable cache
APIs.
Testing
mvn package -DskipTestshbase-servertestPrefetchWhenDataTieringEnabled