You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "chennaji9 (via GitHub)" <gi...@apache.org> on 2026/10/09 12:56:10 UTC
[I] [Enhancement] SyncStateInfo defensive-copy and epoch semantics lack direct tests [rocketmq]
chennaji9 opened a new issue, #11338:
URL: https://github.com/apache/rocketmq/issues/11338
### 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:
```java
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.
--
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: commits-unsubscribe@rocketmq.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Enhancement] SyncStateInfo defensive-copy and epoch semantics lack direct tests [rocketmq]
Posted by "RockteMQ-AI (via GitHub)" <gi...@apache.org>.
RockteMQ-AI commented on issue #11338:
URL: https://github.com/apache/rocketmq/issues/11338#issuecomment-6110385912
**Issue Evaluation**
Category: `type/enhancement` | Status: **Evaluated**
**Feasibility:** Feasible
**Scope:** `controller` module — `SyncStateInfo` test coverage
**Compatibility:** No breaking changes
`SyncStateInfo` holds the controller's view of DLedger sync state. Defensive-copy and epoch semantics are critical for correctness — if the defensive copy regressed, external callers could mutate internal state, and epoch mismatches could cause incorrect controller decisions.
**Assessment:** Valid enhancement. Direct tests for these contracts would prevent subtle regressions in the controller's state management.
---
*Automated evaluation by RocketMQ-AI*
--
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: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Enhancement] SyncStateInfo defensive-copy and epoch semantics lack direct tests [rocketmq]
Posted by "RockteMQ-AI (via GitHub)" <gi...@apache.org>.
RockteMQ-AI commented on issue #11338:
URL: https://github.com/apache/rocketmq/issues/11338#issuecomment-6095955959
**Issue Evaluation**
Category: `type/enhancement` | Status: **Evaluated**
**Feasibility:** Feasible
**Scope:** `controller` module — `SyncStateInfo`
**Compatibility:** No breaking changes
Valid request. Tests for defensive-copy and epoch semantics would guard against accidental mutation of the controller's per-broker mastership state.
---
*Automated evaluation by RockteMQ-AI*
--
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: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org