Frun1na opened a new pull request, #4581:
URL: https://github.com/apache/rocketmq-dashboard/pull/4581
fix(topic): apply explicit zero queue counts when updating a topic
<!-- Make sure the base branch is `master`: that is the RocketMQ Studio
trunk. -->
### Which Issue(s) This PR Fixes
<!-- Link the issue with a keyword so it closes on merge. Trivial fixes need
no issue.
https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue
-->
- Fixes #<issue-id>
### Brief Description
An update that submitted `writeQueues: 0` — a legitimate way to stop
producers
while consumers drain a topic — was silently ignored: the stored or default
queue count was applied instead. `TopicVO` held `writeQueues`/`readQueues` as
primitive ints, so the provider could not tell an explicit 0 from a value the
caller never sent, and its `> 0` check treated both as "not provided".
This makes the two `TopicVO` fields nullable (`Integer`), mirroring the
optional semantics `perm` already uses:
- the Apache update path applies an explicit 0 unchanged, while an omitted
value still preserves the stored count (existing behaviour, covered by
`updateTopicPreservesQueueCountsWhenNotSpecified`);
- the create path is unchanged (0 still falls back to the default of 8);
- Tencent validation keeps its current semantics (null behaves like the old
0);
- the web topic form keeps `min={1}`, so this change is observable over the
REST API and the AI tools today; relaxing the form is left for a separate
discussion.
### How Did You Test This Change?
`cd server && mvn -B -ntp test` — `Tests run: 2415, Failures: 0, Errors: 0,
Skipped: 0`, BUILD SUCCESS.
- New regression test `updateTopicAppliesExplicitZeroQueueCounts` fails on
master (`expected: 0 but was: 8`) and passes with this change.
- The existing queue-count tests
(`updateTopicPreservesQueueCountsWhenNotSpecified`,
`updateTopicAppliesExplicitQueueCounts`) still pass, so partial updates and
non-zero resizes behave exactly as before.
### Checklist
- [x] One coherent change; unrelated modifications are not bundled in
- [x] Commit subject follows Conventional Commits (`feat:` / `fix:` /
`refactor:` / `chore:` / `docs:` / `perf:`)
- [x] Tests added or updated for non-trivial changes, test methods named
`...Test`
- [ ] New UI text has both Chinese and English entries under `web/src/i18n/`
- [x] Architecture constraints stay green (`mvn test` runs the ArchUnit
checks)
- [x] New source files carry the ASF license header
- [ ] Documentation touched where behaviour changed (README / `docs/` /
in-app help)
--
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]