[Enhancement] SyncStateInfo defensive-copy and epoch semantics lack direct tests
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- java
- Domain
- testing-qa
Research direction
The class under test is controller/src/main/java/org/apache/rocketmq/controller/impl/manager/SyncStateInfo.java, which copies sets on input in updateSyncStateSetInfo and on output in getSyncStateSet. Read those methods and the existing manager-level tests to see how the controller state is built. Add direct unit tests that mutate the caller's set and the returned set and assert the stored state is unchanged, that updateMasterInfo increments the master epoch, and that removeFromSyncState leaves the sync-state epoch alone. Done when the new tests pass and would fail if the copies were removed.
Written by the indexing model from the issue text.
Description
Description
SyncStateInfo (controller/src/main/java/org/apache/rocketmq/controller/impl/manager/SyncStateInfo.java) maintains the controller's per-broker view of mastership: master identity + epoch, and the sync-state set + epoch. It deliberately copies sets on the way in and out:
public void updateSyncStateSetInfo(Set<Long> newSyncStateSet) {
this.syncStateSet = new HashSet<>(newSyncStateSet);
...
}
public Set<Long> getSyncStateSet() {
return new HashSet<>(syncStateSet);
}
The existing manager-level tests touch the class via larger flows, but no test pins the defensive-copy contract itself: mutating the caller's set after updateSyncStateSetInfo (or mutating the set returned by the getter) must not corrupt controller state, updateMasterInfo must bump the master epoch, and removeFromSyncState must remove locally without advancing the sync-state epoch. Losing any of these (e.g. "simplifying" away the copies) would silently let callers mutate controller state and currently no test would notice.
Expected behavior
Direct unit coverage of the isolation and epoch semantics described above.
- Dominant language
- Java
- Stars
- 22.6k
- Forks
- 12k
- Avg merge
- 6d 16h
- Merged PRs (30d)
- 18
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing 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
-
[Bug] mqadmin createUser/updateUser trim the ACL password, storing a secret the caller never typedPossibly taken @iloveeyjafjalla claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
apache/rocketmq#11446 · 1 comment ·
Maintainers usually reply within 1 day
-
[Bug] notifyMasterOnline aborts the long-polling wake-up with a NullPointerException when an arrival drains a bucket firstPossibly taken @iloveeyjafjalla claimed this 3 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
apache/rocketmq#11441 · 1 comment ·
Maintainers usually reply within 1 day
-
[Bug] DefaultMQPushConsumer.shutdown() never stops the pop consume service, so its non-daemon threads keep the JVM alivePossibly taken @iloveeyjafjalla claimed this 3 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
apache/rocketmq#11427 · 2 comments ·
Maintainers usually reply within 1 day
-
[Enhancement] FilterFactory duplicate-registration and unregister semantics lack testsPossibly taken @chennaji9 claimed this 7 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
apache/rocketmq#11340 · 2 comments ·
Maintainers usually reply within 1 day
-
[Enhancement] LogicExpression three-valued truth table and short-circuit behavior lack direct testsPossibly taken @chennaji9 claimed this 7 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
apache/rocketmq#11339 · 2 comments ·
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
apache/rocketmq-dashboard#6896 ·
Maintainers usually reply within 3 days
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
OpenIntegrationEngine/engine#496 ·
Maintainers usually reply within 1 day
-
enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
SasanLabs/VulnerableApp#836 ·
Maintainers usually reply within 1 day
-
enhancement frontend
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Albertinesilva/backend-engineering-journey-java-springboot#46 ·