Skip to content

[Bug] Topic update silently ignores explicit zero queue counts #5274

Open

Description

@Frun1na

Before Creating the Bug Report

  • I have searched the open issues of this repository and believe that this is not a duplicate.

  • This is a defect in RocketMQ Studio, not a usage question and not a defect in another Apache RocketMQ repository.

  • I can reproduce this on the current master branch, or I have stated the exact version I am running below.

Studio Version

branch: master
git commit id: d50ffec
deployed as: built from source

Runtime Environment

OS: Ubuntu 24.04 (WSL2)
MySQL: 8.x, container from deploy/docker-compose.yml
browser: not applicable (API-level defect)

Connected RocketMQ Cluster

Not applicable: reproduced with a unit test (RocketMQAdminClientImplTest) on master, where DefaultMQAdminExt is mocked. The defect is in the update path itself, before any cluster call.

Build Toolchain

No response

Describe the Bug

POST /api/topics/update (and the rmq.topic.update AI tool) silently ignores an explicit writeQueues: 0. A write-queue count of 0 is a legitimate way to stop producers while consumers drain a topic, but the request behaves exactly like omitting the field: the stored queue count (or the default of 8) is applied instead.

Root cause: TopicVO declares writeQueues/readQueues as primitive int, so once UpdateTopicDTO.toTopicVO() / TopicUpdateInput.mergeWith() copy the value, an explicit 0 and an omitted field are indistinguishable. RocketMQAdminClientImpl.updateTopic then uses a > 0 check to mean "not provided".

Steps to Reproduce

  1. On master, run the (new) unit test RocketMQAdminClientImplTest.updateTopicAppliesExplicitZeroQueueCounts, or:
  2. Call POST /api/topics/update for an existing 8/8 topic with body {"instanceId": "...", "name": "orders", "writeQueues": 0, "readQueues": 8}.
  3. The broker config and the stored metadata keep writeQueueNums: 8; the response also reports 8.

What Did You Expect to See?

An explicit writeQueues: 0 is applied to the broker topic config and the stored metadata. An omitted value continues to preserve the stored count (the fix for #4123/#4275 already established "absent keeps the stored value").

What Did You See Instead?

writeQueues: 0 is treated as "not provided" and silently replaced with the previous value or the default of 8.

Additional Context

Suggested direction: make the two TopicVO fields nullable (Integer), mirroring the optional semantics perm already uses, and let the Apache update path apply an explicit 0. I have a failing-test-first patch ready and will link the PR here shortly.

Are You Willing to Submit a Pull Request?

  • Yes, I am willing to submit a pull request.

Re-submission: the original report (#4582) was closed by the stale bot after 7 days without triage activity, and GitHub now rejects reopening items in this repository. Refiled unchanged; the fix PR is linked below.

Activity

  1. Frun1na commented on Oct 1, 2026

    @Frun1na
    ContributorAuthor

    Fix: #5275

  2. Frun1na commented on Oct 7, 2026

    @Frun1na
    ContributorAuthor

    Friendly ping — the fix for this is in #5275 and is waiting for review; keeping the issue from the stale bot meanwhile.

  3. Frun1na commented on Oct 10, 2026

    @Frun1na
    ContributorAuthor

    Friendly ping — the fix for this is in #5275 and is waiting for review; keeping the issue from the stale bot meanwhile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions