unbridled-41 commented on PR #10992:
URL: https://github.com/apache/rocketmq/pull/10992#issuecomment-5468005513
### Test evidence (before → after)
`ConsumerOffsetManagerTest#testConcurrentCommitOffsetDoesNotLoseQueues` was
run repeatedly on JDK 8 with the fix reverted and with the fix applied (5 runs
each, `mvn -pl broker test
-Dtest='ConsumerOffsetManagerTest#testConcurrentCommitOffsetDoesNotLoseQueues'`):
**On the unfixed code: 5/5 runs fail.** Example failure (queues 0 and 7 of
`topic1` lost — the loser's map was overwritten):
```
java.lang.AssertionError:
[offsets of topic1]
Expected size: 8 but was: 6 in:
{1=1L, 2=1L, 3=1L, 4=1L, 5=1L, 6=1L}
```
The race window is the very first
`offsetTable.get(key)`/`offsetTable.put(key, map)` pair per fresh `topic@group`
key, so it reproduces reliably, not stochastically.
**With this PR: 5/5 runs pass** (`Tests run: 1, Failures: 0, Errors: 0,
Skipped: 0` each run; the whole `ConsumerOffsetManagerTest` is 6/6 green).
The loss is not just a test artifact: every commit the losing thread made
for that queue is gone until that queue's next commit (5s flush cadence, but
`queryOffset` returns `-1` immediately), so a consumer reconnect in that window
re-initializes the queue per `consumeFromWhere`.
Side note on CI: the workflow runs for this PR are in `action_required`
state (first-time contributor) and will start once a maintainer approves them.
--
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]