Skip to content

Add regression coverage for sharded LRU capacity eviction - #425

Merged
tvand merged 1 commit into
apache:masterfrom
tbuffagni:test/sharded-lru-eviction
Oct 1, 2026
Merged

tvand merged 1 commit into
apache:masterfrom
tbuffagni:test/sharded-lru-eviction

Conversation

@tbuffagni

Copy link
Copy Markdown
Contributor

Add a cache-level regression test for the multi-shard eviction issue fixed in f54bb2b. Previously, choosing an empty shard could stop eviction even when another shard contained entries, allowing LRUMemoryCache to exceed MaxObjects.

The test inserts 1024 distinct immutable keys with the same hash code into a cache with MaxObjects=128 and SpoolChunkSize=1. It checks occupancy after every insertion and verifies the resident keys and values after the workload. The same test runs with 1 shard as a control and with 16 shards to exercise empty-shard traversal. Expiry and background shrinking are disabled. This complements the DoubleLinkedList tests already added with the fix and adds no production changes or dependencies.

Validation on Windows with JDK 17.0.2 and Maven 3.9.9:

  • On master ef66ce7: both parameterized cases pass.
  • Against the preserved, unmodified d38be5b JAR: the same test source passes with 1 shard and fails with 16 shards at insertion 129 (expected 128 residents, found 129).
  • Full mvn clean verify: core ran 425 tests, including both new cases passing, but stopped with 1 failure and 11 errors in three existing TCP test classes. The remaining reactor modules were not reached. These involve localhost connection/write timeouts and an expected ALIVE status reported as ERROR. Running only those three existing classes outside the restricted execution environment, without running the new regression test, reproduced the same 1 failure and 11 errors. Therefore full-suite success is not claimed for this Windows environment.

Existing TCP classes affected in the full run and isolated recheck:

  • LateralTCPFilterRemoveHashCodeUnitTest
  • LateralTCPIssueRemoveOnPutUnitTest
  • TestTCPLateralUnitTest

Focused command:

mvn -B -ntp -pl commons-jcs4-core -am -Dtest=LRUMemoryCacheUnitTest -Dsurefire.failIfNoSpecifiedTests=false test

@tvand

tvand commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

The TCP test classes run fine in the Windows CI environment.

@tvand
tvand merged commit 1ce8f53 into apache:master Oct 1, 2026
12 of 13 checks passed
@tvand

tvand commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

@tbuffagni Thanks for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants