VladRodionov opened a new pull request, #8359:
URL: https://github.com/apache/hbase/pull/8359

   ### Summary
   
   This PR adds test-only factory helpers for creating CacheAccessService 
instances backed by existing legacy BlockCache implementations.
   
   The goal is to make test migration to CacheAccessService less verbose. Many 
existing tests directly instantiate concrete BlockCache implementations such as 
LruBlockCache, LruAdaptiveBlockCache, TinyLfuBlockCache, and BucketCache. For 
integration-style tests that only need a cache facade, replacing a one-line 
constructor with several lines of BlockCache construction plus 
CacheAccessService wrapping adds noise.
   
   This PR provides constructor-shaped test helpers that keep those tests 
concise while preserving the current legacy-backed implementation path.
   
   ### Changes
   
   * Adds CacheAccessServices.fromConfiguration(Configuration), which creates a 
CacheAccessService through the existing BlockCacheFactory path.
   * Adds CacheAccessServiceTestFactory with helpers that mirror constructors 
for:
     * LruBlockCache
     * LruAdaptiveBlockCache
     * TinyLfuBlockCache
     * BucketCache
   * Adds CacheAccessServiceTestInstance for tests that need both:
     * the concrete BlockCache instance for implementation-specific assertions, 
and
     * the CacheAccessService facade for exercising the new access path.
   * Adds unit coverage for the new test factory helpers.
   
   ### Compatibility notes
   
   The factory helpers are test-only bridge utilities. They currently create 
legacy BlockCache implementations and wrap them with 
BlockCacheBackedCacheAccessService.
   
   This does not change production cache construction. It also does not migrate 
existing cache implementations to CacheEngine. Later, when CacheEngine and 
topology-backed services are available, these factory internals can be updated 
without rewriting all integration-style tests again.
   
   ### Out of scope
   
   * No production BlockCacheFactory refactoring.
   * No CacheEngine adapter migration.
   * No migration of LruBlockCache, LruAdaptiveBlockCache, TinyLfuBlockCache, 
or BucketCache to CacheEngine.
   * No broad migration of existing tests.
   * No cache behavior or cache semantics changes.
   
   ### Testing
   
   Ran:
   
   ```bash
   mvn -pl hbase-server -Dtest=TestCacheAccessServiceTestFactory 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]

Reply via email to