This is an automated email from the ASF dual-hosted git repository.

jinrongtong pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/rocketmq.git


The following commit(s) were added to refs/heads/develop by this push:
     new 26fa050148 [ISSUE #7501] The broker supports idempotence in creating 
topics (#7502)
26fa050148 is described below

commit 26fa0501482bbf31c2a64a33f329ab9744ac3800
Author: fuyou001 <yubao....@alibaba-inc.com>
AuthorDate: Fri Oct 27 16:28:17 2023 +0800

    [ISSUE #7501] The broker supports idempotence in creating topics (#7502)
---
 .../org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git 
a/broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java
 
b/broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java
index 004bf12acd..fbba6633b6 100644
--- 
a/broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java
+++ 
b/broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java
@@ -440,6 +440,13 @@ public class AdminBrokerProcessor implements 
NettyRequestProcessor {
             return response;
         }
 
+        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={}",
+                requestHeader.getTopic(), 
RemotingHelper.parseChannelRemoteAddr(ctx.channel()));
+            response.setCode(ResponseCode.SUCCESS);
+            return response;
+        }
+
         try {
             
this.brokerController.getTopicConfigManager().updateTopicConfig(topicConfig);
             if 
(brokerController.getBrokerConfig().isEnableSingleTopicRegister()) {

Reply via email to