Repository navigation
HBASE-30471 Remove LruBlockCache dependencies from test and production code - #8844
VladRodionov wants to merge 1 commit into
Conversation
|
Ran PR through GPT Astra. No actionable findings in PR #8844 at commit 897814a. |
There was a problem hiding this comment.
🟡 Changes recommended
The test inspects a cache the region never uses, so its zero-count assertions pass even if scanner selection reads excluded files.
1 open issue
What changed in this PR
This PR continues HBase’s pluggable block cache migration by replacing direct LruBlockCache dependencies with LruCacheEngine and cache-service abstractions, while retaining legacy compatibility adapters. No user-visible behavior change is intended.
Changes:
- Moves LRU-specific coverage into
TestLruCacheEngine. - Migrates HFile tests and cache inspection to
CacheAccessService. - Extends test helpers and updates production API documentation and compatibility handling.
| File | Description |
|---|---|
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/EncodedSeekPerformanceTest.java |
Clears cached blocks through the service API. |
hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestScannerSelectionUsingKeyRange.java |
Uses service-based cached-file inspection. |
hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestLruBlockCache.java |
Removes the migrated legacy test suite. |
hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestLazyDataBlockDecompression.java |
Tests compression with native LRU engines. |
hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFileScannerImplReferenceCount.java |
Migrates LRU scanner coverage to the service API. |
hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFileDataBlockEncoder.java |
Uses a service-backed LRU test instance. |
hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFileBlockIndex.java |
Creates caches through service test helpers. |
hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestCombinedBlockCache.java |
Uses the extracted concurrency test helper. |
hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestCacheOnWrite.java |
Uses service-based configuration and cache clearing. |
hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/CacheTestUtils.java |
Adds engine overloads for shared assertions. |
hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/cache/TestLruCacheEngine.java |
Receives migrated LRU behavior coverage. |
hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/cache/TestCacheAccessServiceTestFactory.java |
Verifies native LRU factory instances. |
hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/cache/CacheAccessServiceTestInstance.java |
Supports native engines and legacy caches. |
hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/cache/CacheAccessServiceTestFactory.java |
Creates native LRU services and single-tier wrappers. |
hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/BlockCacheTestUtils.java |
Extracts concurrent cache-operation helpers. |
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruCachedBlock.java |
Updates the documented owning cache implementation. |
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderImpl.java |
Generalizes heap-allocation comments. |
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileBlock.java |
Generalizes heap-allocation parameter documentation. |
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/cache/TopologyBackedCacheAccessServices.java |
Returns null when no legacy cache backs an engine. |
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/cache/TopologyBackedCacheAccessService.java |
Updates cache-size documentation to reference native LRU. |
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/cache/LruCacheEngine.java |
Exposes configuration and eviction-thread access for tests. |
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/cache/CacheEngine.java |
Documents native engines and compatibility adapters. |
hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/cache/CacheAccessService.java |
Updates documentation to reference LruCacheEngine. |
Review effort: Balanced
|
|
||
| Scan scan = new Scan().withStartRow(Bytes.toBytes("aaa")).withStopRow(Bytes.toBytes("aaz")); | ||
| BlockCache cache = BlockCacheFactory.createBlockCache(conf); | ||
| CacheAccessService cache = CacheAccessServices.fromConfiguration(conf); |
897814a to
c6d4b7f
Compare

HBASE-30471 Remove LruBlockCache dependencies from test and production code
Summary
This PR continues the pluggable block cache migration by removing direct dependencies on
LruBlockCachefrom production and test code where the newCacheEngine/CacheAccessServiceAPIs can be used instead.The main goal is to move LRU-specific behavior and tests to
LruCacheEnginewhile keeping legacyBlockCacheimplementations supported through the existing compatibility adapters.This PR is based on
HBASE-30018and assumes theHBASE-30383RegionServerCacheAccessServicemigration is already present in that branch.Changes
TestLruBlockCachecoverage toTestLruCacheEngine.TestLruBlockCache.LruCacheEnginewith the functionality needed by the migrated unit tests.CacheEngine/CacheAccessServiceabstractionsinstead of depending directly on
LruBlockCache.BlockCacheTestUtilsfor test cases that still need to exercise legacyBlockCacheimplementations during the transition.
CacheTestUtils,CacheAccessServiceTestFactory, andCacheAccessServiceTestInstanceto support both legacyBlockCacheand newCacheEnginebased tests.
TopologyBackedCacheAccessServiceand related helpers where needed to expose thefunctionality required by migrated callers and tests.
than introducing new direct
LruBlockCachedependencies.Scope
This PR does not attempt to remove every remaining
BlockCachereference from HBase.BlockCacheis still required for legacy cache implementations and compatibility adapters that havenot yet been migrated. Those references will be removed incrementally as the remaining cache
implementations are converted.
The purpose of this change is specifically to eliminate unnecessary
LruBlockCachedependenciesfrom code that can now use the pluggable cache APIs.
Behavior
No user-visible cache behavior change is intended.
The changes are primarily an internal API and test migration from the concrete
LruBlockCacheimplementation toLruCacheEngine,CacheEngine, andCacheAccessService.Validation
The affected cache and HFile unit tests are exercised as part of this change, including the migrated
TestLruCacheEnginecoverage and tests for cache access, cache-on-write, HFile block handling,scanner behavior, and block encoding.
git diff --checkis clean.AI-assisted development
This change was developed in collaboration with ChatGPT 5.6 Sol. ChatGPT was used as a
development and review assistant for code migration, test adaptation, API design discussion, and
review feedback. All resulting code and design decisions were reviewed and validated by the author.