Vladimir Rodionov created HBASE-30471:
-----------------------------------------

             Summary: Migrate LruBlockCache unit tests to LruCacheEngine
                 Key: HBASE-30471
                 URL: https://issues.apache.org/jira/browse/HBASE-30471
             Project: HBase
          Issue Type: New Feature
          Components: BlockCache
    Affects Versions: 4.0.0-alpha-1
            Reporter: Vladimir Rodionov
            Assignee: Vladimir Rodionov


h2. Description

{{LruBlockCache}} was migrated to the new pluggable cache architecture as
{{LruCacheEngine}} in HBASE-30104.

The implementation migration intentionally preserved most of the existing LRU 
cache behavior and
algorithm, but the legacy {{LruBlockCache}} unit-test suite was not migrated at 
the same time.
As a result, a significant part of the behavioral coverage still exercises the 
legacy
{{BlockCache}} implementation rather than the native {{CacheEngine}} 
implementation.

This change should migrate the relevant {{LruBlockCache}} unit tests to 
{{LruCacheEngine}} and
reassign tests whose behavior now belongs to higher-level cache abstractions.

The goal is to preserve behavioral coverage, not to mechanically copy every 
legacy test.

h2. Scope

* Identify existing {{LruBlockCache}} tests that verify behavior now owned by
  {{LruCacheEngine}}.
* Migrate those tests to exercise {{LruCacheEngine}} directly.
* Preserve coverage for:
** cache insertion;
** cache lookup and hit/miss behavior;
** explicit eviction;
** capacity-driven eviction;
** LRU ordering;
** SINGLE/MULTI/MEMORY priority behavior;
** cache size and element accounting;
** block-type accounting;
** reference-count handling;
** runtime resizing;
** configuration change handling;
** eviction listener notification;
** shutdown behavior;
** cache statistics.
* Reuse existing test data and helpers where practical.
* Remove or consolidate duplicate tests where equivalent {{LruCacheEngine}} 
coverage already
  exists.

h2. Responsibility Changes

Not all legacy {{LruBlockCache}} tests should be moved directly to 
{{LruCacheEngine}}.

The new architecture separates local cache-engine behavior from topology and 
orchestration.

Tests for behavior such as:

* victim-cache relationships;
* {{setVictimCache()}};
* promotion or demotion between cache tiers;
* {{CombinedBlockCache}} assumptions;
* cross-cache orchestration;

do not belong to {{LruCacheEngine}} and should instead remain temporarily as 
legacy compatibility
tests or be migrated to the appropriate {{CacheTopology}} / 
{{CacheAccessService}} test suite.

The intended mapping is:

{code}
Legacy LruBlockCache test                New test owner

local LRU storage behavior          ->   LruCacheEngine
capacity and local eviction         ->   LruCacheEngine
reference counting                  ->   LruCacheEngine
size/accounting/statistics          ->   LruCacheEngine
dynamic resizing                    ->   LruCacheEngine
configuration updates               ->   LruCacheEngine
eviction notifications              ->   LruCacheEngine

victim-cache behavior               ->   CacheTopology / CacheAccessService
combined-cache behavior             ->   CacheTopology / CacheAccessService
cross-tier promotion/demotion       ->   CacheTopology / CacheAccessService
legacy BlockCache compatibility     ->   legacy compatibility tests
{code}

h2. Motivation

{{LruCacheEngine}} is becoming the reusable native LRU engine for the pluggable 
cache architecture
and may also be used as the storage engine for higher-level cache variants such 
as IndexOnlyLRU
and AdaptiveLRU.

Keeping most behavioral coverage attached only to {{LruBlockCache}} makes 
future cache-engine
changes less safe and leaves the native implementation under-tested.

Migrating the relevant tests establishes {{LruCacheEngine}} as the primary 
implementation under
test while keeping topology and compatibility concerns in their appropriate 
architectural layers.

h2. Acceptance Criteria

* Core LRU cache behavior is tested directly through {{LruCacheEngine}}.
* Existing behavioral coverage is preserved unless a test is obsolete or 
duplicated.
* Tests for topology/orchestration behavior are not incorrectly moved into the 
engine test suite.
* Legacy compatibility tests remain only where they still validate supported 
legacy behavior.
* The migrated tests pass without depending on {{LruBlockCache}}-specific APIs 
that are not part
  of {{CacheEngine}} behavior.
* No production behavior changes are introduced by this ticket.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to