zmuxuny opened a new pull request, #7171:
URL: https://github.com/apache/rocketmq-dashboard/pull/7171

   ### Which Issue(s) This PR Fixes
   
   Fixes #7170.
   
   ### Brief Description
   
   A cold data-source inventory read can capture rows before a successful 
create/update/delete, return after that write clears the cache, and publish its 
old rows back into the cache. With the current no-expiry ConcurrentMap cache, 
later readers continue seeing the stale list until another eviction or restart.
   
   Enable synchronized loading on both existing inventory cache entries. With 
the production ConcurrentMapCacheManager, the loader runs inside 
computeIfAbsent and clear waits for an in-flight loader before removing its 
entry. Keep the existing keys, cached results and successful-write-only 
eviction behavior.
   
   The new regression class loads the real CacheConfig and Spring caching 
proxy. It covers all three writes against both inventory overloads, full and 
paged loads overlapping the same write, and preservation of warmed cache 
entries when a write fails. Repeated reads also assert cache hits so removing 
caching cannot satisfy the tests.
   
   AI assistance was used for investigation, implementation and verification.
   
   ### How Did You Test This Change?
   
   Base: `rocketmq-studio@127c47b06a268cc74224d5f34c56ec7c36ac0d55`. JDK 
21.0.12.1 and Maven 3.9.12.
   
   - Before the production change: all six full/page × create/update/delete 
regressions failed on stale-row assertions, with zero test errors.
   - Final focused suite: **96 tests passed, 0 failures/errors/skips** across 
SettingsServiceCacheInvalidationTest (10), SettingsServiceCachingTest (1), 
SettingsServiceTest (52), CacheConfigTest (2) and MetricsServiceTest (31).
   - Checkstyle: 0 violations; git diff check passed. Independent review 
checked the final committed source and test artifacts.
   
   From `server/`, using the configured local dependency cache:
   
   ```sh
   MAVEN_OPTS=-Xmx384m mvn -o -B -ntp test \
     -DforkCount=1 \
     -DargLine="-Xmx256m 
-javaagent:$MAVEN_REPO/org/mockito/mockito-core/5.23.0/mockito-core-5.23.0.jar" 
\
     
-Dtest=SettingsServiceCacheInvalidationTest,SettingsServiceCachingTest,SettingsServiceTest,CacheConfigTest,MetricsServiceTest
   ```
   
   ### Scope and trade-off
   
   A successful write can now wait for an overlapping cache-miss database read 
to finish before its eviction completes. This synchronization guarantee relies 
on the current ConcurrentMap cache implementation; it is not a cross-process 
cache consistency mechanism or a guarantee for arbitrary replacement cache 
providers.
   
   The repository is latch-controlled in the concurrency tests. No MySQL 
load/latency benchmark or full backend integration run is claimed. Metrics 
queries reload and validate a selected source later, so this fix does not claim 
that old URLs or credentials were directly used; it repairs stale inventory and 
source-selection inputs.
   
   No API, schema, dependency, UI or cache-capacity policy changes.
   


-- 
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