ai-yang opened a new pull request, #10735:
URL: https://github.com/apache/rocketmq/pull/10735

   ### Which Issue(s) This PR Fixes
   
   - Fixes #10734
   
   ### Brief Description
   
   `BroadcastOffsetManager.queryInitOffset` initialized `clientOffsetStore` 
with a non-atomic `get` / create / `put` sequence. If `updateOffset` inserted 
and updated the same client's store between the `get` and `put`, the query 
thread replaced that store and discarded the newly committed offset.
   
   Use `computeIfAbsent` so initialization and concurrent updates retain the 
same winning `BroadcastTimedOffsetStore` instance. The change is internal and 
does not alter the public protocol.
   
   ### How Did You Test This Change?
   
   - Added a deterministic latch-controlled concurrency regression test with no 
sleeps or random scheduling.
   - Reverted to the previous implementation: the regression test failed 5/5 
times (`expected 100 but was 10`).
   - Applied this fix: the regression test passed 20/20 times.
   - Ran the complete affected JDK 8 reactor: all modules passed; broker ran 
753 tests with 0 failures, 0 errors, and 4 skipped tests.
   - Ran Maven `validate`: Checkstyle reported 0 violations across the 10 
affected modules.
   - Ran broker SpotBugs: `BugInstance=0`, `Error=0`.
   - Ran `git diff --check` successfully.
   


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