HBASE-30329 Add topology-backed cache diagnostics - #8575
Conversation
There was a problem hiding this comment.
Pull request overview
Routes legacy block caches and diagnostics through the topology-backed cache framework.
Changes:
- Adds single-tier and inclusive topology-backed cache support.
- Adds aggregated cached-block iteration diagnostics.
- Migrates compatibility helpers and tests to topology-backed services.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
TestCacheOnWrite.java |
Uses topology-aware cache unwrapping. |
TestCacheConfig.java |
Verifies topology-backed configuration. |
TestSingleTierTopologyBackedCacheAccessService.java |
Tests single-tier behavior. |
TestInclusiveCombinedBlockCacheCompatibleTopologyBackedCacheAccessService.java |
Tests inclusive topology semantics. |
TestCacheAccessServices.java |
Updates factory expectations. |
TestBlockCacheBackedCacheAccessService.java |
Removes legacy adapter tests. |
CacheAccessServiceTestFactory.java |
Unwraps topology-backed caches. |
CacheConfig.java |
Preserves single-tier legacy cache access. |
TopologyBackedCacheAccessServices.java |
Adds single-tier and inclusive factories. |
TopologyBackedCacheAccessService.java |
Adds single-tier writes and block iteration. |
SingleTierTopology.java |
Defines the single-tier topology. |
SingleEngineTopology.java |
Renames its topology type. |
DefaultHBaseCachePlacementAdmissionPolicy.java |
Updates single-tier policy handling. |
CacheTopologyType.java |
Introduces SINGLE_TIER. |
CacheAccessServices.java |
Routes all cache variants by topology. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| return TopologyBackedCacheAccessServices.fromSingleBlockCache("single", blockCache, | ||
| DefaultHBaseCachePlacementAdmissionPolicy.INSTANCE); |
| BlockCache[] blockCaches = combinedBlockCache.getBlockCaches(); | ||
| if (blockCaches.length != 2) { | ||
| throw new IllegalArgumentException( | ||
| "InclusiveCombinedBlockCache must expose exactly two block caches"); | ||
| } | ||
|
|
||
| return fromTieredInclusiveBlockCaches("inclusive-combined", blockCaches[0], blockCaches[1], | ||
| DefaultHBaseCachePlacementAdmissionPolicy.INSTANCE); |
| Optional<CacheEngine> engine = topology.getEngine(CacheTier.L1); | ||
| if (!engine.isPresent()) { | ||
| return; | ||
| } |
taklwu
left a comment
There was a problem hiding this comment.
actually we get more than just topology-backed cache diagnostics , the single-tier caches refactoring. maybe call the title as Add topology-backed cache diagnostics and migrate single tier cache
| * </p> | ||
| */ | ||
| @InterfaceAudience.Private | ||
| public class SingleEngineTopology implements CacheTopology { |
There was a problem hiding this comment.
will this SingleEngineTopology use with SingleTierTopology ? or how does it work in the upcoming/next JIRA?
mainly I found no usage about this SingleEngineTopology
| * assertions, cached-block iteration, metrics inspection, or other diagnostic checks. | ||
| * </p> | ||
| * <p> | ||
| * Only {@link BlockCacheBackedCacheAccessService} is supported. Services backed by future |
There was a problem hiding this comment.
it seems this line of comment is no longer valid that we're using TopologyBackedCacheAccessServices, can you update the comment of blockCache?
| */ | ||
| if (topologyView.getType() == CacheTopologyType.SINGLE) { | ||
| if (topologyView.getType() == CacheTopologyType.SINGLE_TIER) { | ||
| return TierDecision.single(CacheTier.SINGLE); |
There was a problem hiding this comment.
I'm wondered if CacheTier.SINGLE should be removed and only keep L1 and L2? but let me know if my understanding is incorrect.
Summary
This PR extends the topology-backed cache access framework so that cache diagnostics and cache
access are consistently routed through
TopologyBackedCacheAccessService.The main change is that plain single-tier
BlockCacheimplementations now use the sametopology-backed access path as combined caches. Single-tier caches are represented by
SingleTierTopology, while existing two-tier cache variants continue to use topology-specificrepresentations:
BlockCache->SingleTierTopologyCombinedBlockCache->TieredExclusiveTopologyInclusiveCombinedBlockCache->TieredInclusiveTopologyThis keeps the legacy cache implementations underneath through
BlockCacheBackedCacheEngine, butmoves the access-service boundary to the topology/cache-engine model.
Motivation
After HBASE-30305, exclusive combined-cache orchestration was moved behind
TopologyBackedCacheAccessService. Follow-up testing showed that diagnostic and compatibility pathsstill had assumptions about
BlockCacheBackedCacheAccessServiceand concreteBlockCacheimplementations.
This PR removes those assumptions from the main factory path by making topology-backed access the
normal path for both single-tier and combined caches.
Changes
SingleTierTopology.CacheTopologyType.SINGLE_TIER.BlockCacheinstances.InclusiveCombinedBlockCache.cacheBlock(key, block)behavior for single-tier caches.BlockCacheinstances from topology-backed serviceswhere tests still need direct compatibility checks.
Compatibility notes
BlockCacheBackedCacheAccessServiceis no longer the default factory result for plain block caches.Instead, the main factory now returns a
TopologyBackedCacheAccessServicebacked bySingleTierTopology.The underlying legacy
BlockCacheimplementations are still preserved throughBlockCacheBackedCacheEngine. This PR does not migrateLruBlockCache,BucketCache, or otherconcrete cache implementations to native
CacheEngineimplementations yet. That remains a follow-upmigration step.
Testing
Focused tests: