Skip to content

Commit

Permalink
[ISSUE apache#7501] The broker supports idempotence in creating topics (
Browse files Browse the repository at this point in the history
  • Loading branch information
fuyou001 authored Oct 27, 2023
1 parent 48ef5ce commit 26fa050
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,13 @@ private synchronized RemotingCommand updateAndCreateTopic(ChannelHandlerContext
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()) {
Expand Down

0 comments on commit 26fa050

Please sign in to comment.