apkipa opened a new issue, #11519:
URL: https://github.com/apache/rocketmq/issues/11519

   ### Before Creating the Bug Report
   
   - [x] I found a bug, not just asking a question, which should be created in 
[GitHub Discussions](https://github.com/apache/rocketmq/discussions).
   
   - [x] I have searched the [GitHub 
Issues](https://github.com/apache/rocketmq/issues) and [GitHub 
Discussions](https://github.com/apache/rocketmq/discussions)  of this 
repository and believe that this is not a duplicate.
   
   - [x] I have confirmed that this bug belongs to the current repository, not 
other repositories of RocketMQ.
   
   
   ### Runtime platform environment
   
   OS: Ubuntu 24.04 LTS (Linux x86_64) / Official Docker image 
apache/rocketmq:5.5.0
   
   ### RocketMQ version
   
   branch: develop
   version: 5.3.0 - 5.5.1 (introduced in #8267)
   Git commit id: 164322b91e26fca2a53e6580003e582ff0621514
   
   ### JDK Version
   
   Runtime / Compiler: Eclipse Temurin OpenJDK 1.8.0_482 / 1.8.0_512
   
   ### Describe the Bug
   
   In 
`org.apache.rocketmq.broker.processor.AdminBrokerProcessor#updateAndCreateTopicList`
 (`AdminBrokerProcessor.java`, lines 681–686 on `develop`), the validation loop 
checks whether each `TopicConfig` in `topicConfigList` already exists with 
identical configuration:
   
   ```java
   if 
(topicConfig.equals(this.brokerController.getTopicConfigManager().getTopicConfigTable().get(topic)))
 {
       LOGGER.info("Broker receive request to update or create topic={}, but 
topicConfig has  no changes , so idempotent, caller address={}",
           topic, RemotingHelper.parseChannelRemoteAddr(ctx.channel()));
       response.setCode(ResponseCode.SUCCESS);
       return response;
   }
   ```
   
   Because this executes `return response;` instead of skipping only the 
unchanged topic, as soon as **any** topic in the batch matches its existing 
`TopicConfig` in `topicConfigTable`, the entire `UPDATE_AND_CREATE_TOPIC_LIST` 
request exits early with `ResponseCode.SUCCESS`. All subsequent new or modified 
topics in `topicConfigList` are neither validated, persisted, nor registered to 
NameServer.
   
   ### Steps to Reproduce
   
   1. Prepare `topics.json` with one topic:
      ```json
      [
        {
          "topicName": "TopicA",
          "readQueueNums": 8,
          "writeQueueNums": 8,
          "perm": 6
        }
      ]
      ```
      Run `mqadmin updateTopicList -n <namesrv> -c DefaultCluster -f 
topics.json`. `TopicA` is created as expected.
   
   2. Append a second topic `TopicB` (or modify an existing topic placed after 
`TopicA`) in `topics.json`:
      ```json
      [
        {
          "topicName": "TopicA",
          "readQueueNums": 8,
          "writeQueueNums": 8,
          "perm": 6
        },
        {
          "topicName": "TopicB",
          "readQueueNums": 8,
          "writeQueueNums": 8,
          "perm": 6
        }
      ]
      ```
      Run `mqadmin updateTopicList -n <namesrv> -c DefaultCluster -f 
topics.json` again.
   
   3. Check `mqadmin topicList -n <namesrv>` and `broker.log`.
   
   ### What Did You Expect to See?
   
   Unchanged `TopicA` is skipped idempotently, while `TopicB` (and any other 
new or updated topics in the batch) is created/updated in `TopicConfigManager` 
and registered to NameServer.
   
   ### What Did You See Instead?
   
   - `mqadmin updateTopicList` prints `submit batch of topic config to ... 
success` and exits with code `0`.
   - `broker.log` logs `Broker receive request to update or create 
topic=TopicA, but topicConfig has  no changes , so idempotent` and immediately 
returns.
   - `TopicB` is never created in `topicConfigTable` and has no route in 
NameServer.
   
   ### Additional Context
   
   _No response_


-- 
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]

Reply via email to