Static topic mapping may select a stale epoch when the epoch delta overflows
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- java
- Domain
- distributed-systems
Research direction
Start at checkAndBuildMappingItems and trace the replacement-mode ordering of mapping details for the same logical queue. Reproduce the issue with epochs 0 and Long.MAX_VALUE, then verify that the latest epoch is selected without overflow and add or run a regression check for that behavior.
Written by the indexing model from the issue text.
Description
Description
Static topic mapping sorts long epoch values by subtracting them and narrowing the result to int. When two epochs differ by more than Integer.MAX_VALUE, the comparator can reverse their order. In replacement mode, checkAndBuildMappingItems then keeps the stale broker mapping instead of the latest one.
Expected behavior
Epochs should be ordered with Long.compare so the newest mapping always wins without arithmetic overflow.
Reproduction
Create two mapping details for the same logical queue with epochs 0 and Long.MAX_VALUE, call checkAndBuildMappingItems with replace enabled, and observe that the epoch-0 mapping is selected.
- Dominant language
- Java
- Stars
- 22.6k
- Forks
- 12k
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 25
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/rocketmq
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
[Bug] TopicValidator rejects V2 retry topic names containing `+` separator introduced by KeyBuilder Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100