zjncs opened a new pull request, #11093:
URL: https://github.com/apache/rocketmq/pull/11093
### Motivation
`SubscriptionGroupManager.updateForbiddenValue` handles a forbidden value of
0 (i.e. `clearForbidden` released the last forbidden bit of a topic) by
removing the **whole group** from `forbiddenTable`:
```java
if (forbidden == null || forbidden <= 0) {
this.forbiddenTable.remove(group);
log.info("clear group forbidden, {}@{} ", group, topic);
return;
}
```
Two problems:
1. **Cross-topic state loss.** When a group is forbidden on multiple topics
and one topic's permission is restored, the other topics' forbidden bits are
silently dropped — the admin only intended to un-forbid one topic.
(`AdminBrokerProcessor.updateForbidden` / the dashboard's per-topic perm toggle
hit exactly this path.)
2. **No persist / no data-version bump.** The removal neither calls
`updateDataVersion()` nor `persist()`, so after a broker restart the stale
forbidden state comes back from disk, and peers syncing via
`GET_ALL_SUBSCRIPTIONGROUP_CONFIG` see an unchanged data version and keep the
old bits.
### Changes
In the `forbidden <= 0` branch: remove only the given topic's entry from the
group's map (dropping the now-empty group map when the last topic is gone),
then `updateDataVersion()` + `persist()`, mirroring the set path. A clear of a
topic that was never forbidden stays a no-op (no spurious version bump).
### Verification
New regression test
`ForbiddenTest#testClearOneTopicForbiddenKeepsOtherTopicsOfTheSameGroup`:
forbids `t1`/`t2` of one group, clears `t1`, and asserts `t2` keeps its
forbidden bit, the table shrinks to the single remaining entry, the data
version counter is bumped, and clearing the last topic removes the group entry.
```
$ mvn -pl broker test -Dtest='ForbiddenTest'
(before) Tests run: 2, Failures: 1, Errors: 0 (t2's state lost + version
not bumped)
(after) Tests run: 2, Failures: 0, Errors: 0
```
--
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]