Skip to content

fix: enforce Shiro realm strategies on feature branch - #6

Merged
loong10k merged 50 commits into
mainfrom
feature/REQ-20261118-wandl-shiro-auth-strategy
Nov 19, 2026
Merged

loong10k merged 50 commits into
mainfrom
feature/REQ-20261118-wandl-shiro-auth-strategy

Conversation

@loong10k

@loong10k loong10k commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Supersedes draft PR #5 on the required feature/REQ-* branch at the identical source commit 1c04f43396d89603182d186845d6fca735e4a8be. The existing local POM and docs edits in the repository checkout were not included.

Problem and repair

The custom authenticator skipped its configured strategy when multiple realms were configured but only one supported the token. This let AtLeastTwo accept a single successful password realm. Multi-configured-realm authentication now executes the configured strategy; truly single-configured-realm behavior follows Shiro's existing contract.

OnlyOne now rejects zero-success results at the authenticator layer and counts successful realm callbacks per invocation, including same-named realms. Both custom count strategies aggregate copies of principal collections and mutable credential collections, avoiding mutation of cached realm results across attempts. DefaultCredentialsMatcher evaluates its protected comparison exactly once. The hashed matcher synchronizes lazy cache initialization and its direct cache setter for safe publication. OnlyOne also explicitly rejects non-null realm results with null/empty principals using AuthenticationException, even if another realm succeeded.

Compatibility

  • Multi-realm exceptions are now interpreted by the configured strategy; a specific realm LockedAccountException may become a general AuthenticationException. Truly single-realm exceptions are preserved.
  • OnlyOne zero-success attempts emit failure rather than false success followed by Subject's empty-principal rejection.
  • Non-idempotent credentialsMatch overrides are now invoked once.
  • Public method signatures, production dependencies, coverage thresholds and the separate upstream-report archival patch are unchanged.

Validation

  • Full offline JDK 17 and JDK 21 reactor clean verify: 40 tests, zero failures/errors/skips.
  • Real Subject/Authenticator paths cover single/multiple configured realms, 0/1/2 successes, unsupported and dynamically changing realm support, exception behavior, shared concurrent strategy instances and cached aggregate isolation. Added boundary regressions reject one successful realm claiming two realm names, exercise reused cached AuthenticationInfo across requests and after OnlyOne rejection, and verify the Set credential snapshot branch with unmodifiable source sets.
  • Credential tests cover comparison once, rejection, exception propagation, reset/principal isolation, fifth-attempt blocking (existing regression), and controlled concurrent lazy cache creation.
  • Core line coverage is approximately 10%, still far below the existing 90% warning target; this is not comprehensive coverage.

Retry-counter status

The shared provider adapters below implement atomic reservations and preserve the expiry policy for configured retry stores. Matchers that still use the legacy Shiro Cache path retain its concurrency limitations. A rollout that switches an existing deployment to the new store still needs a migration or cutover plan for active retry windows.

Shiro CI now pins JWT issuer c6edbf6a56a0c8ae6409b9fc1b0ef9639c4063d1, which contains the merged verification-key and parser-configuration isolation tests. At Shiro head 53b701e08794261e5a96d7a1d4c6c20eaecff950, JDK 17 source verification passed, including the pinned upstream build, Shiro build, and coverage data checks.

Keep this PR in draft. No ready, approval or merge operation is part of this update.

Replacement PR exact-head CI 44216060538 passed at 1c04f43396d89603182d186845d6fca735e4a8be. Old PR #5 was closed as a duplicate. This does not resolve the retry-counter or coverage limitations above.

Shared retry store integration

Commit dec5b27ef9526bb14f69568ab9748eb8c6e7751f adds the provider contract and wires both matcher implementations to it when configured. An attempt reserves a count and window identifier before credential verification. Success can clear only that window. The provider contract requires atomic reservation and conditional reset under the provider's existing expiration policy.

JDK 17 reactor clean verify passed 42 tests. New tests exercise a common store used by two matcher instances and a delayed successful comparison after a new window becomes active. The fixture exercises matcher wiring and window ownership. Provider implementations, starter wiring and real shared-cache expiry and concurrency tests remain open. Existing unconfigured Shiro cache paths retain their prior behavior.

Redis provider implementation

Commit 29d2e68e672cc42d97b2493ebfbd7241359bc75f adds a Redis-backed retry store. Each operation executes on a single principal key. The first reservation sets the configured expiry, increments retain the exact Redis expiry deadline, and reset is conditional on window identity. Counts saturate at the matcher integer limit.

Local JDK 17 reactor verification ran 45 tests, including three against an isolated Redis 8.4.0 process. The provider tests cover two concurrent callers sharing one key, an unchanged expiration deadline, reservation after expiry, stale reset, persistent configuration, and saturation. The PR workflow starts an isolated Redis container for the same tests.

The adapter takes a configured script executor and a dedicated namespace. Starter wiring and migration of legacy entries remain separate gates, along with the other shared providers and their TTL tests. A working Redis adapter does not resolve the full provider requirement.

JCache provider implementation

Commit 6ff281921232c71e35e96f0f6905ba829538c0e5 adds an atomic JCache retry store for a dedicated store-by-value cache that preserves its creation expiry on access and update. It validates the expiry contract at setup and uses a provider-side entry processor for reservation and conditional reset. All executing cache members need this module on the classpath.

Local JDK 17 reactor verification ran 48 tests with zero failures/errors/skips. The new suite runs against two loopback Hazelcast 3.12.13 members and verifies unique counts across members, expiration at the original window, reset after expiration, rejection of stale reset, counter saturation, and rejection of an expiry policy that restarts the window on update. The existing Redis tests ran against a separate isolated Redis process.

This validates the Hazelcast JCache path. Wiring the existing Hazelcast IMap, Ehcache, Redis/Redisson, J2Cache and Spring cache configurations, and migrating legacy counter entries, are still part of the confirmed shared-provider scope.

Native Ehcache 3

Commit 9ebe0ffdc1b8a52978a3e72317e6829e340ba989 adds native Ehcache 3 reservation and conditional reset using provider CAS operations. The dedicated retry cache uses either its configured fixed creation window or eternal expiry. The fixed-window policy leaves the deadline unchanged on reads and updates. Attempt equality includes both identity and count, so provider serialization does not weaken the comparison.

Local JDK 17 reactor verification passed 51 tests. Three new tests use real Ehcache 3.6.0 off-heap storage for concurrent reservations, deterministic expiry, stale reset, saturation and rejection of an expiry policy that renews the window. A separate local verification used the official Ehcache 3.6.0 clustering kit (Terracotta 5.5.0), a loopback server and two independent client cache managers configured for strong consistency. It passed concurrent unique reservations, expiry at the original deadline, and late reset protection. The general starter binding and prior counter migration remain open, as do the remaining shared-provider paths.

Native Ehcache 2

  • Added a retry store using the cache provider's key lock. Reservation preserves the original creation TTL and counts as activity for the configured idle timeout. Conditional clearing uses a quiet read.
  • Local JDK 17 verification passed 54 tests. The three provider-specific tests cover concurrent reservations, TTL, idle expiry, and stale clearing.
  • The vendor Terracotta 3.7.10 kit with Ehcache 2.6.11 passed a two-process test using JDK 8 and Shiro 1.13. Both JVMs reserved counts 1–64 in one window. The clustered window expired at its original TTL, and clearing with the old window ID preserved the new window.
  • The packaged Terracotta 3.7.10 client rejected JDK 17 during initialization. The JDK 17 Maven tests exercise the native provider in process.

Native Hazelcast 5

  • The partition owner reserves attempts through a native entry processor that retains the configured TTL and refreshes the configured idle period. Stale clears use a quiet entry view and a conditional remove.
  • Verified with Hazelcast 5.3.7 and two members. A separate owner-termination test verified that the backup retained the count, window identity and original TTL after takeover.
  • The JDK 17 reactor passed 57 tests. The JCache regression fixture also ran on Hazelcast 5.3.7. Legacy Hazelcast 3.12 native integration remains pending.

Redisson

  • Uses the existing Redisson client with a dedicated retry hash namespace. Atomic scripts route to the Redis primary owning each key. The first TTL remains the upper bound, reservations renew the configured idle period, and stale resets preserve the idle deadline.
  • Redisson 3.12.5 matched the Starter dependency. Two clients verified concurrent reservations and TTL/idle expiry, and a separate Redis Cluster probe exercised keys on all three primaries.
  • JDK 17 reactor verification ran 60 tests with zero failures, errors or skips. The integration fixture configures Redisson's StringCodec explicitly. Starter bean registration and legacy counter migration remain pending.

J2Cache with Jedis

  • The writable Jedis L2 provider handles shared retry counters directly. Generic storage uses the channel's resolved region TTL when TTL synchronization is enabled. Disabled synchronization and hash storage use persistent windows.
  • Verified two J2Cache channels on isolated single-node Redis, Sentinel, two sharded nodes and three Redis Cluster primaries. Cluster mode uses a caller-managed native JedisCluster client because the J2Cache provider's wrapper exposes only binary data commands.
  • Local JDK 17 verification ran 62 tests with zero failures, errors or skips. The other J2Cache L2 providers and automatic Starter registration remain pending.

J2Cache with Lettuce

  • Added atomic retry reservations through a caller-managed Lettuce scripting connection to the J2Cache Redis database or cluster. Generic storage retains the channel's region TTL with synchronization enabled. Hash storage is Lettuce's default and stays persistent, as does generic storage with TTL synchronization disabled.
  • Two independent J2Cache JVMs verified 30 shared windows each on standalone Redis, Sentinel and all three Cluster primaries. Each update retained the original Redis expiration timestamp.
  • Local JDK 17 verification ran 64 tests with zero failures, errors or skips. Test fixtures now close their J2Cache provider pools explicitly.

J2Cache with Memcached

  • The native xmemcached client uses add and compare-and-set for the retry state, retaining the original absolute expiry across updates. A past expiry on a matching CAS clears the active window without deleting a replacement.
  • A synchronized zero-expiry region stays persistent. The adapter reports unsupported configurations at startup when TTL synchronization is disabled, because J2Cache 2.8.5 sends a negative expiry that xmemcached rejects.
  • Real-provider tests cover contention, original TTL, and stale clearing. Two independent JVMs also reserved all 512 attempts once across two Memcached servers. Callers supply a native client connected to the same servers with matching key routing.

Spring Cache wrappers

  • The Shiro Spring cache manager resolves a named region and hands the actual Spring cache to its provider factory. Spring Data Redis 2.7 uses the configured fixed region TTL and native scripts. JCache wrappers use their underlying JCache region and atomic entry processing.
  • Verified standard and transaction-aware Redis cache managers, shared retry limits through actual Shiro matcher calls, JCache wrapping, and keys routed to all three Redis Cluster primaries.
  • JDK 17 reactor verification ran 67 core tests and four Spring tests, all passing. The Spring module now produces coverage reports. Spring Data Redis 4.x dynamic TTL and automatic Starter wiring remain pending.

Native Hazelcast 3.12

  • Added the optional shiro-extension-hazelcast3 module for the 3.12 IMap API. It reuses the native map's key lock, preserves the original TTL at Hazelcast's whole-second precision, and keeps the configured idle expiry even when a thin client cannot read it from entry metadata.
  • A two-member cluster and a real thin client passed concurrency, original TTL, idle expiry with statistics disabled, and stale reset tests. A separate owner-termination probe verified preservation of count, window identity and TTL after partition takeover.
  • The adapter accepts the existing map's max idle as-is. The module currently builds on this feature branch's JDK 17 baseline. Starter wiring and backports to the versioned branches remain pending.

Spring Data Redis 4

  • Added the optional Spring Data Redis 4.1 adapter. It uses the region's TTL function for new windows and its read TTL when time-to-idle is enabled. A zero read TTL keeps the current deadline. Concurrent creation still produces one retry window.
  • Two real Spring Data Redis 4 cache managers exercised the dynamic retry path across all three Redis Cluster primaries. The JDK 17 reactor passed 80 tests in total.
  • The same feature branch also fixes late Memcached eviction. When a provider still returns a window past its recorded deadline, the store uses CAS to replace it with a fresh window. The regression test observed the old count before the fix and count one afterward.

Spring Boot retry-store binding

  • Auto-configuration binds a CredentialRetryStore bean named shiro.credential-retry.<cacheName> to both supported matchers, including matchers created inside Spring-managed authenticating realms. Explicit assignments and legacy cache fallback retain their existing behavior.
  • Spring Boot 2.7 integration tests cover discovery, scoped binding, inline realms, explicit assignment, legacy limits and invalid bean types. A separate JDK 21 probe with Boot 4.1.2, Shiro 3.0.1 and Spring Data Redis 4.1.2 crossed the shared retry limit from two application contexts.
  • JDK 17 reactor verification passed 84 tests. Active-window migration and maintenance-line integration remain pending.

Shiro 3.0.x backport

  • Branch feature/REQ-20261118-wandl-shiro-auth-3x at b11767ce9d39e4e77f578dd81501c97ecf49ed6d carries the authentication and shared retry-store changes on Shiro 3.0.1, Spring Framework 7.0.8, and Spring Boot 4.1.2.
  • JDK 21 verification passed 128 Shiro tests with zero failures, errors, or skips. Coverage reports were generated for all four modules. Core and Spring line coverage was 35% and 4%, below the configured 90% advisory target.
  • The repair is available on the backport feature branch for integration testing. The maintenance branch and downstream Starter release are pending.

Shiro 2.0.x backport

  • Branch feature/REQ-20261118-wandl-shiro-auth-2x at 048cc8fba66d300a7ae291bea204430a073ebf05 carries the repair on Shiro 2.2.1, Spring Framework 6.2.19 and Spring Boot 3.5.16. Spring Data Redis 3.5 coverage includes per-key TTL and time-to-idle.
  • JDK 17 verification passed 127 Shiro tests with zero failures, errors, or skips. Coverage reports were generated for all three modules. Core and Spring line coverage was 35% and 3%, below the configured 90% advisory target.

Shiro 1.0.x backport

  • Branch feature/REQ-20261118-wandl-shiro-auth-1x at 40c7554ac82c7e1b3e8edbead681fde9bf82c086 carries the repair on Java 8, Shiro 1.13.0, Spring Framework 5.3.36 and Boot 2.7.18. The branch uses Spring Data Redis 2.7 and includes the native Hazelcast 3 adapter.
  • JDK 8 verification passed 123 Shiro tests with zero failures, errors, or skips. Coverage reports were generated for all three modules. Core and Spring line coverage was 35% and 3%, below the configured 90% advisory target.

Spring Boot 4.1 downstream verification

The Starter's merged Servlet compatibility repair uses Shiro 1.13.0. Its retry integration feature branch at afb35f291c1226fe2349c1be34a4aadb2ff34b63 consumes the verified Shiro Extension 1.0.x artifacts. The actual Starter passed 32 tests under JDK 21 and Boot 4.1.2, with 90.09% line coverage against the existing 90% requirement. The Servlet context test verifies Boot discovers the retry auto-configuration and a Spring-managed realm uses the named store.

The test used Shiro Extension artifacts built from 40c7554ac82c7e1b3e8edbead681fde9bf82c086 and installed in an isolated local Maven repository. Publication of that dependency, integration-branch promotion, and production migration of active retry windows are pending.

Active Ehcache 2 retry windows

The pre-cutover Ehcache 2 format stores an AtomicInteger at the original principal key. The first native retry reservation after cutover converts it under the same provider key lock, counts the current attempt, and preserves creation time, TTL deadline and idle expiry policy. Conditional clear leaves an unconverted legacy value intact. Existing old clients must be stopped before enabling the shared store on their former region because they still read the old value type. Reuse the region and key mapping. Clustered deployments still require a strongly consistent Terracotta region.

The regression produced a ClassCastException on the previous source. It now observes 3 → 4 → 5 with one converted window, unchanged TTL deadline, and the configured TTI. All four local reactor runs passed with zero failures, errors or skips.

Line Feature commit Local tests GitHub verification
PR #6 a78fa5cb56d39f45c948dbe4a7d4a7176eb317bc 85 Main source verification
1.0.x 25c2aa48a75da8554320a5fad06bc07f9da97990 124 JDK 8 CI
2.0.x 6e2399957b0126d427c695679fa64c27e018e463 128 JDK 17 CI
3.0.x 87ce6e5e586c98d4388b8e23054805de67b490ac 129 JDK 21 CI

The migration fixture used a real local Ehcache 2 region with copy-on-read and copy-on-write. Terracotta cutover and active-window migration for the other providers remain open.

Active Hazelcast retry windows

The native Hazelcast 5.2+ and 3.12 adapters now read and convert a legacy AtomicInteger on the original IMap key inside the provider's atomic reservation. Hazelcast 5 uses the expiry-preserving entry update. Hazelcast 3.12 uses the original remaining TTL at its native second precision, taking the previous update timestamp into account. Stale clears leave an unconverted legacy entry intact. The cutover uses the same IMap and principal keys after old clients stop, with the updated module on all cluster members.

Both real-cluster regressions produced a type-cast failure before the fix. They now observe 3 → 4 → 5 in the same active window with its exact observed TTL deadline. The 3.12 test uses a thin client and a legacy entry updated after creation. Four full local reactor runs passed with zero failures, errors, or skips.

Line Feature commit Local tests GitHub verification
PR #6 944ef42cd193a64e2cfa21b2a46a171c5d6023f8 87 Main source verification
1.0.x 861c6a38b12c730660ae820567ded0950039f6af 126 JDK 8 CI
2.0.x 19eedff4eb2030962e4eae617d3c36f2343b00ef 130 JDK 17 CI
3.0.x 127b35a6dd5d4e6dd46e78d2e320df9e4330e8fd 131 JDK 21 CI

Active-window migration for the other providers and actual deployment cutover remain open.

Active JCache retry windows

A JCache region that already supports both legacy and new values can be reused after its old clients stop. One provider entry processor converts the persisted AtomicInteger and reserves the current attempt. The store requires unchanged expiry on update and access. A conditional clear leaves an unconverted entry intact. Regions configured for AtomicInteger alone are rejected before use. The Spring bridge uses the same core validation and conversion.

A real two-member JCache cluster reproduced the previous type-cast failure and now confirms 3 → 4 → 5 across members, one window ID, and expiry at the original deadline. A Spring integration fixture verifies the same conversion through the native cache bridge. Full local builds had zero failures, errors or skips.

Line Feature commit Local tests GitHub verification
PR #6 b2a9e4a6a77ec8da0b67df1fa9bc0d13868aa20b 89 Main source verification
1.0.x 4f8fa2751e17f892dd1b33196c6eb7b46f31348d 128 JDK 8 CI
2.0.x a9cf1fd1b40b91fbe528a40d23cd9b72ce41dd4f 132 JDK 17 CI
3.0.x ce811b8624f374a6b7431805f6e118c93d025820 133 JDK 21 CI

Native Ehcache 3 remains separate: the installed 3.6.0 provider returned a copy of the legacy counter from off-heap storage and rejected a conditional replace using that copy. Its clustered store also lacks atomic compute. A dedicated migration path is still required for those regions and for legacy-only JCache types.

Active Spring Redis retry windows

Spring Data Redis 2.7, 3.5, and 4 now expose migrateLegacyWindow for an exclusive cutover. The source cache determines the key prefix and serializers. A one-key Redis snapshot returns the persisted counter and its deadline without updating it. A second one-key operation creates the destination only if it is absent and the source deadline remains live. The copied counter keeps the original absolute expiry or persistence. Source entries are retained. Complete the import for known string principals with all retry clients paused and reconcile the results before resuming them. Dynamic time-to-idle applies on the first regular reservation.

Real Redis tests verify exact source and destination deadlines, existing-window protection, missing and expired sources, persistent zero counters, and the post-import idle policy. Four local reactor builds passed with zero failures, errors, or skips.

Line Feature commit Local tests GitHub verification
PR #6 632c024efc946b304ed654a00cede34cd3177e46 92 Main source verification
1.0.x 07fece07ff989ebc95caa16690b42ff60eea58c3 130 JDK 8 CI
2.0.x 94e9abbab02925fc47ce166ed0eee1980afc1e76 134 JDK 17 CI
3.0.x b6ba3ec5f1e4efc5a3a97fe5e2c83c41a773f2b9 135 JDK 21 CI

These migration fixtures used standalone Redis. Cluster cutover, non-Spring provider migration, and actual deployment remain open.

Spring Redis cross-primary cutover

Five migration cases across the four feature heads passed against a three-primary Redis 8.4 Cluster. The fixture asserts different primary IDs for the original and destination keys and compares exact Redis deadlines after the move. The tests accept -Dshiro.redis.test.cluster.nodes=host1:port,host2:port,host3:port for the targeted migration cases. Cluster nodes must cover all slots.

The previous PR CI exposed an asynchronous Spring Data Redis 4 fixture write. The test now seeds the source with synchronous putIfAbsent and confirms the source has a live deadline before the import. The cutover instructions require outstanding writes to reach Redis before migration. The production migration code is identical to the previous commit.

Line Verified feature commit Local tests GitHub verification
PR #6 2dca2ca8d962362d606358cacfab7aa5e97281d6 92 full + 2 cluster Main source verification
1.0.x 89a12b742e8c2e9d93e7708c83ab7a91d912cc97 130 full + 1 cluster JDK 8 CI
2.0.x 21e50e1b93e534345bcb687d38e5d442d02ecf21 134 full + 1 cluster JDK 17 CI
3.0.x 69f0e77f6a5e849975ae31f1569bb95d4e027c64 135 full + 1 cluster JDK 21 CI

Targeted cluster selectors are SpringCredentialRetryStoreIntegrationTest#importsSpringRedisLegacyCountersWithTheOriginalDeadline and SpringDataRedis4CredentialRetryStoresIntegrationTest#copiesLegacyWindowBeforeIdlePolicyRefreshesIt. All executed local cases had zero failures, errors, or skips. The ordinary GitHub workflows still use standalone Redis. Production cutover and the other provider migration paths remain open.

Active J2Cache Redis retry windows

The J2Cache Jedis and Lettuce adapters now expose migrateLegacyWindow for an exclusive cutover. The adapter reads raw Redis L2 bytes through the original channel provider and deserializes them with the existing J2Cache serializer. An independent Redis deadline read keeps the generic key expiry or the hash region expiry. The destination import preserves that deadline and writes only to an empty destination. Source entries are retained. Pause old and new retry clients and drain writes before starting.

Real Redis tests use both generic and hash layouts for Jedis and Lettuce. They leave a stale value in L1, update the persisted count to three, and observe the next attempt at four under the original deadline. All four local full reactors passed with zero failures, errors, or skips.

Line Verified feature commit Local tests GitHub verification
PR #6 1f4ae9ac69733bd65996f5d97dbbd7ca97d6fe46 94 Main source verification
1.0.x 04aebcaaf535cf338bfef1558aef631510e4a27e 132 JDK 8 CI
2.0.x 7b31d685d5b3ec57930502bba9e15d0c3d3c968e 136 JDK 17 CI
3.0.x 1d1ec0bc714a0487e0925f1533fcaf67341a5be0 137 JDK 21 CI

The J2Cache migration tests used standalone Redis. Cluster cutover for these adapters, non-UTF-8 Jedis hash keys, the other provider migrations, and production cutover remain open.

Active J2Cache Memcached retry windows

The J2Cache Memcached adapter now imports a known principal from the explicitly selected source node during an exclusive cutover. Meta Text returns the stored value and remaining lifetime in one read. The adapter derives the original absolute deadline at server-second precision and uses the configured xmemcached destination client with add-if-absent. The legacy entry stays in place and the source node must be selected using the original key routing. Meta Text on a trusted unauthenticated source connection is required for this path.

A real Memcached 1.6.39 fixture validates the exact stored deadline, source key sanitization, count 3 → 4, source preservation, repeated/missing import handling and a persistent zero count. All local full reactors had zero failures, errors, or skips.

Line Verified feature commit Local tests GitHub verification
PR #6 5158e09fb5927df763f4bf8b994d6a83928fd4e1 95 Main source verification
1.0.x 0464f33fdfd300b1a6954e362e4e4ac974f6585d 133 JDK 8 CI
2.0.x f42d858276208a94d470b6ecf4a907483059ed94 137 JDK 17 CI
3.0.x 8ca96aef9951ff938304815fdccc4d9e938cad4e 138 JDK 21 CI

The fixture used one server. Routed production cutover, authenticated or binary-only source migration, remaining providers, and promotion are still pending.

Active Redisson map-cache retry windows

Redisson 3.12.5 RMapCache migration reads the persisted counter, fixed deadline, idle period, and current idle deadline in one read-only source script. It uses the original map codecs and leaves the source idle deadline untouched. A shorter map expiry also caps the new window. Import reserves no attempt and writes only if the destination is empty. Normal reservations subsequently refresh idle state within the old fixed deadline. Run during an exclusive cutover.

Two Redisson migration cases passed on Redis Cluster on each of the four feature branches. The fixture asserts different source and destination primary IDs and checks the exact deadline, next count, map-wide lifetime, and persistent zero state. The PR workflow now runs these cases in the existing three-primary fixture alongside both J2Cache cluster cases, with executed-test checks. All standalone full builds passed. The two J2Cache cluster-only tests skipped by the PR branch standalone build passed in the separate cluster run.

Line Feature commit Local standalone passed Local cluster passed GitHub verification
PR #6 53f1a1a9f826829ccbf920ec5f22d8d43b3c9152 97 4 Main source verification
1.0.x f160009b86112666b6d02bdbb259204e3fb858cc 135 2 JDK 8 CI
2.0.x 3cfaefefe80403d9eb5da217255d3f5c09127023 139 2 JDK 17 CI
3.0.x 8795c16bf2f3791b129423d54cfa4b54d0aff17f 140 2 JDK 21 CI

Production cutover, remaining provider limitations, and branch promotion remain open.

Active native Ehcache 3 retry windows

Native Ehcache 3.6.0 now supports in-place migrateLegacyWindow for an exclusive cutover. The original region must already accept both value formats and preserve creation expiry on update. Stop all old and new clients, drain outstanding writes, and use one migration writer per region. Then replace a still-live entry through the existing expiry policy. No retry is consumed by migration. An originally zero counter stays zero until the first actual attempt. Stale resets leave unmigrated values and migrated zero counters intact.

Off-heap tests verify the original expiration after conversion, resumed counts, stale resets, and rejection of an AtomicInteger-only region. Separate local probes against a real Terracotta 3.6.0 server used two independent strongly consistent cache managers per line and observed 3 → 4, 0 → 1, and original-window expiry on all four lines.

Line Feature commit Local standalone passed Terracotta probe GitHub verification
PR #6 f60225e7ac4acf58c511b1efd03d00b0e8bf0b1a 99 Passed Main source verification
1.0.x e9917b186289cf1f955db49526cc652102c33d64 137 Passed JDK 8 CI
2.0.x f950594af5042c821d2e3e73ac9d0b2a03b54d82 141 Passed JDK 17 CI
3.0.x 983b568b259c2960330feea9e624230156835bca 142 Passed JDK 21 CI

Standalone builds in each line excluded two J2Cache cluster-only cases. Those cases passed in preceding dedicated GitHub cluster jobs. Native Ehcache regions configured for the legacy value type only or whose policy restarts expiry on updates still require a separate cutover.

Non-UTF-8 J2Cache Redis keys

Legacy Jedis Hash keys and J2Cache Lettuce keys use the writer JVM's default charset. Migration now computes the physical key as bytes. Jedis performs the source expiry script with those bytes. Lettuce supports a separate binary scripting connection for source keys while the existing UTF-8 connection serves the destination. The cutover JVM must use the charset that wrote the source region.

The original Jedis migration failed with an ISO-8859-1 legacy key. The updated standalone test passes and the two Redis Cluster cases passed for every feature line with a verified ISO-8859-1 default charset. They exercise both storage layouts for both providers, assert source and destination placement on different primaries, and compare the original absolute deadline before and after migration. CI now runs a separate ISO-8859-1 regression and requires both tests to execute.

Line Feature commit Local standalone passed Local ISO-8859-1 cluster passed GitHub verification
PR #6 45b558c7c03afd311436c875b4118fc43e362362 99 2 Main source verification
1.0.x b21f1c2bb48c2d16d363108e64dc8e9fec351b18 137 2 JDK 8 CI
2.0.x 44a964bfe3b5ddea1506f70464a7df6950ee6b0d 141 2 JDK 17 CI
3.0.x a466981c23a092704f7ffe83a28bedc3d009636e 142 2 JDK 21 CI

The two cluster-only cases skipped by each standalone build passed in the separate Redis Cluster run.

JCache in-place rollback

With all retry clients paused and pending writes drained, restoreLegacyWindow converts an active window in place to the legacy AtomicInteger format. It keeps the current count and the original creation deadline. It skips missing, expired and already restored entries. A missing entry does not invoke a JCache read-through loader. A region that accepts only the new value type rejects restore before writing.

Two Hazelcast members verified that the old reader can read the restored count and the item expires on its original schedule. The read-through regression first failed against the preceding implementation and passed after the entry-existence check. Both maintenance-line matcher failure regressions were backported as well.

Line Verified feature head Local standalone passed GitHub CI
PR #6 b5d1aeebccf7a84a0ed34e367ca5f6a68b71d78c 105 Source verification
1.0.x 042fa3979209261ec2a0b806e7c3da78a902f5de 143 JDK 8
2.0.x 375c55a2bf979b92ab54d6a1e2384bc702620e35 147 JDK 17
3.0.x f30288f5b7ab6e1adbe3dc9837f68458e03ffd53 148 JDK 21

Each hosted Surefire report shows 9 JCache integration checks, 9 matcher checks and both dedicated Redis Cluster checks passed without skips. The standalone counts exclude the two cluster-only cases per line. Legacy-only typed JCache regions and binary-only or authenticated Memcached legacy imports remain separate cutover gates.

Memcached warm-restart verification at e75b479

The current feature head covers authenticated Meta Text import, rejection of a direct import from a binary-only listener, and Java import into a separate destination after a warm restart of a binary-only source. The Memcached 1.6.45 fixture asserts the destination server's actual expiry metadata, the restored count, persistent and expired entries, duplicate import and preservation of the original source. The warm-restart case requires an existing RAM-backed restart file and a clean stop. The source and destination run on loopback.

The exact PR head CI passed. Its Surefire XML records eight Memcached tests with zero failures, errors or skips. The same change includes the Redisson test adjustment to use the observed write interval while retaining exact comparisons against the original stored deadlines. The hosted Redis Cluster checks and the coverage gate passed.

The maintenance heads include this verification for JDK 8, JDK 17, and JDK 21. Each passed all eight Memcached tests locally with its matching JDK. For legacy-only AtomicInteger JCache regions, the subtype-based migration and rollback from d42f632 also supersede the earlier cutover note. Deployments must verify they preserve that subtype and the original creation deadline. Binary-only instances without pre-existing warm-restart support still need an authoritative expiry snapshot or a bounded drain. Production cutover and promotion remain open.

Maintenance test branches at the verified feature heads

The full hosted workflows passed on all three maintenance feature heads, including the newly required Memcached warm-restart case, the Redis Cluster tests and the coverage gates. Each matching integration branch was fast-forwarded to that verified commit.

JDK Verified commit Hosted feature CI Integration branch
8 7f8bb61d9de2eb0a819b9d891be945fe2520bada 44387564737 test/20261119-1.0.x
17 df2dbca5c0e782ff1ebfbfd480ecb614f6db21f3 44387565160 test/20261119-2.0.x
21 1df0bdc6663c8c407ba047f888a4085e507238e7 44387564967 test/20261119-3.0.x

The test branches contain the same commits as the feature CI runs above. This records the Git branch promotion. Production cutover remains pending.

Native atomic-counter Ehcache 3 regions

The native Ehcache 3 store accepts an AtomicInteger-typed region when the serializer preserves the retry-counter subtype. It converts live entries in place under the existing exclusive cutover rules. The original expiry policy must preserve creation expiry, and the source region keeps its existing deadline. Conditional updates compare the serialized counter value and window ID. Legacy-zero counters, duplicate import, concurrent increments and stale resets are covered.

Five off-heap integration tests passed locally on the PR head d8ac321 and on all three maintenance lines at 162d8e4 (JDK 8), 6196f46 (JDK 17) and 3570535 (JDK 21). Separate loopback checks on the Ehcache 3.6.0 / Terracotta kit used two independent strong-consistency clients for each line and verified the migrated count, unique concurrent reservations and expiration at the original deadline. A policy that resets expiry on writes still requires its own cutover. These checks used local fixtures.

Typed Ehcache 3 hosted verification and integration refs

All four exact feature-head workflows passed. The matching test branches are now fast-forwarded to the verified commits.

Verified head Hosted CI Test ref
d8ac321 44389332455 test/20261119
162d8e4 44389323130 test/20261119-1.0.x
6196f46 44389322279 test/20261119-2.0.x
3570535 44389322655 test/20261119-3.0.x

Memcached import from a verified expiry snapshot

migrateLegacyWindowFromSnapshot accepts the original count and deadline for the same source entry during an exclusive cutover. Zero represents a confirmed persistent entry. The destination preserves the original epoch-second deadline, skips expired entries and uses a conditional add so duplicate imports cannot replace an existing window. A loopback binary-only fixture confirmed that direct metadata reads fail, the snapshot import succeeds, and the original counter CAS stays unchanged. A destination server metadata check confirmed both the original finite deadline and persistent expiration.

The exact PR workflow and maintenance workflows for JDK 8, JDK 17 and JDK 21 each executed all nine Memcached tests without skips or errors. The matching test branches contain their verified changes. The separate Shiro 3 integration run also passed with the previously integrated Ehcache 3 module, including its three manager tests.

Production imports require a trusted record of each affected entry's original expiry. A binary-only deployment without warm restart, a trustworthy snapshot or a verified finite bound still needs a cutover decision.

Verify the live source version before copying

The new source-client overload of migrateLegacyWindowFromSnapshot rejects zero CAS values and uses a read-only binary-compatible check of the source entry's live CAS and decoded count. Missing, replaced and mismatched source entries produce no destination write. The test overwrites an entry with the same count to prove that the old snapshot is rejected. A matching snapshot preserves the original deadline and the source CAS. Duplicate destination imports are rejected.

All exact PR, JDK 8, JDK 17, JDK 21 and combined Shiro 3 integration workflows passed. Each run executed all nine Memcached tests without skips or failures. The matching integration refs contain the verified changes.

Cutover still requires exclusive writers, the original process and routing, and a trusted record of the original expiry. The binary protocol supplied version and value verification. Deployment expiry evidence and cutover remain pending.

loong10k added a commit that referenced this pull request Nov 18, 2026
loong10k added a commit that referenced this pull request Nov 18, 2026
loong10k added a commit that referenced this pull request Nov 18, 2026
loong10k added a commit that referenced this pull request Nov 18, 2026
loong10k added a commit that referenced this pull request Nov 18, 2026
Backport PR #6 coverage for binary and warm-restarted Memcached sources and the observed Redisson write interval.
loong10k added a commit that referenced this pull request Nov 18, 2026
Backport PR #6 coverage for binary and warm-restarted Memcached sources and the observed Redisson write interval.
loong10k added a commit that referenced this pull request Nov 18, 2026
Backport PR #6 coverage for binary and warm-restarted Memcached sources and the observed Redisson write interval.
loong10k added a commit that referenced this pull request Nov 19, 2026
loong10k added a commit that referenced this pull request Nov 19, 2026
loong10k added a commit that referenced this pull request Nov 19, 2026
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.

1 participant