HBASE-30024 Add BlockCache-backed CacheEngine adapter for TieredExclusiveTopology#8476
Merged
taklwu merged 1 commit intoJul 17, 2026
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a transitional compatibility layer in hbase-server to let existing BlockCache implementations participate in the newer CacheEngine/CacheTopology wiring (specifically TieredExclusiveTopology + TopologyBackedCacheAccessService) without changing current production cache configuration.
Changes:
- Introduces
BlockCacheBackedCacheEngine, aCacheEngineadapter that delegates storage operations to an underlying legacyBlockCache. - Adds
CacheEnginesfactory helpers to wrap aBlockCacheas aCacheEnginewith null validation. - Adds unit tests for adapter delegation/validation and integration-style tests exercising
TopologyBackedCacheAccessServicethrough a tiered topology using block-cache-backed engines.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/cache/BlockCacheBackedCacheEngine.java | Adds a CacheEngine adapter delegating to a wrapped BlockCache. |
| hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/cache/CacheEngines.java | Adds a small factory utility to create CacheEngine instances from BlockCache. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/cache/TestBlockCacheBackedCacheEngine.java | Adds delegation and argument-validation tests for the adapter. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/cache/TestCacheEngines.java | Adds tests for the CacheEngines.fromBlockCache factory helper. |
| hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/cache/TestTopologyBackedCacheAccessServiceWithBlockCacheBackedEngines.java | Adds tests proving topology-backed cache access works using BlockCache-backed engines across tiers. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| @Tag(IOTests.TAG) | ||
| @Tag(SmallTests.TAG) | ||
| class TestCacheEngines { |
Comment on lines
+174
to
+182
| @Test | ||
| void testFactoryCreatesBlockCacheBackedEngine() { | ||
| BlockCache blockCache = mock(BlockCache.class); | ||
| CacheEngine engine = CacheEngines.fromBlockCache(blockCache); | ||
|
|
||
| assertTrue(engine instanceof BlockCacheBackedCacheEngine); | ||
| assertSame(blockCache, ((BlockCacheBackedCacheEngine) engine).getBlockCache()); | ||
| } | ||
|
|
Comment on lines
+183
to
+187
| @Test | ||
| void testFactoryRejectsNullBlockCache() { | ||
| assertThrows(NullPointerException.class, () -> CacheEngines.fromBlockCache(null)); | ||
| } | ||
|
|
taklwu
approved these changes
Jul 17, 2026
Comment on lines
+138
to
+139
| verify(l1).cacheBlock(key, block, false, false); | ||
| verify(l2).cacheBlock(key, block, false, false); |
Contributor
There was a problem hiding this comment.
not a blocker: this is a interesting show case, basically we I don't think we have this forked cache today.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a compatibility bridge from the existing
BlockCacheAPI to the newCacheEngineabstraction.TieredExclusiveTopologyandTopologyBackedCacheAccessServiceoperate onCacheEngineinstances, but the existing production cache implementations such asLruBlockCache,BucketCache,TinyLfuBlockCache, andLruAdaptiveBlockCachestill implementBlockCache.BlockCacheBackedCacheEngineallows these legacy cache implementations to participate in topology-backed cache wiring before they are migrated to implementCacheEnginedirectly.This is an incremental migration step. It does not change production cache wiring and does not remove or replace
CombinedBlockCache.Changes
BlockCacheBackedCacheEngine, aCacheEngineadapter backed by an existingBlockCache.CacheEngineshelper factory for creatingCacheEngineinstances from legacyBlockCacheinstances.TopologyBackedCacheAccessServicecan operate throughTieredExclusiveTopologyusingBlockCache-backed engines.Migration path
The new cache architecture is moving toward:
AI assistance disclosure
This PR was prepared with assistance from ChatGPT. All changes were reviewed, tested, and submitted by the author.