Palaiologos1453 opened a new pull request, #11058:
URL: https://github.com/apache/rocketmq/pull/11058

   ### Which Issue(s) This PR Fixes
   
   - Fixes #11057
   
   ### Brief Description
   
   After TTL cleanup deletes a LiteTopic, its cached lag timestamp can still 
contribute to aggregate latency and occupy a timestamp TopK slot. Validate 
cached candidates against the lifecycle manager's maximum queue offset when 
reporting latency or querying timestamp TopK. Remove samples for absent queues 
before selecting results, preserving active candidates and returning no latency 
observation when all candidates have expired.
   
   Validation happens when consuming the cache because a POP request can 
publish a previously read timestamp after deletion. Removal matches the sample 
by identity so a concurrent replacement for a recreated session is preserved. 
The check uses existing in-memory queue state for cached candidates; it does 
not scan the full queue table or read message timestamps.
   
   Cleanup occurs at report/query time. Collection is not atomic with queue 
deletion, so an overlapping collection can observe the earlier state and a 
subsequent collection revalidates it.
   
   ### How Did You Test This Change?
   
   With Amazon Corretto 8u482 and Maven 3.9.11:
   
   ```sh
   mvn -B -pl broker -am 
-Dtest=LiteConsumerLagCalculatorTest,LiteManagerProcessorTest,AbstractLiteLifecycleManagerTest,LiteLifecycleManagerTest,RocksDBLiteLifecycleManagerTest
 -DfailIfNoTests=false test
   ```
   
   - Build succeeded: 57 tests reported, 55 passed, 2 skipped, no failures or 
errors. Checkstyle and SpotBugs passed.
   - The skipped tests already have `@Ignore`: 
`LiteLifecycleManagerTest.testCleanExpiredLiteTopic` and 
`RocksDBLiteLifecycleManagerTest.testInit_tieredStore`.
   - New coverage checks mixed active/expired candidates, all-expired results, 
removal before TopK selection, late updates after deletion, recreation with a 
fresh sample, and a deterministic interleaving that preserves a concurrent 
replacement.
   - The expired-topic regression fails on the unmodified calculator and passes 
with this change.
   - `git diff --check` passed. No live-cluster test was run.
   


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