Skip to content

Commit dad6b4d

Browse files
authored
[ISSUE #7334] registerIncrementBrokerData for single topic update (#7335)
Signed-off-by: Ziy1-Tan <ajb459684460@gmail.com>
1 parent c100d81 commit dad6b4d

1 file changed

Lines changed: 25 additions & 5 deletions

File tree

broker/src/main/java/org/apache/rocketmq/broker/topic/TopicConfigManager.java

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,11 @@ public TopicConfig createTopicInSendMessageMethod(final String topic, final Stri
290290
}
291291

292292
if (createNew) {
293-
this.brokerController.registerBrokerAll(false, true, true);
293+
if (brokerController.getBrokerConfig().isEnableSingleTopicRegister()) {
294+
this.brokerController.registerSingleTopicAll(topicConfig);
295+
} else {
296+
this.brokerController.registerIncrementBrokerData(topicConfig, dataVersion);
297+
}
294298
}
295299

296300
return topicConfig;
@@ -394,7 +398,11 @@ public TopicConfig createTopicInSendMessageBackMethod(
394398
}
395399

396400
if (createNew) {
397-
this.brokerController.registerBrokerAll(false, true, true);
401+
if (brokerController.getBrokerConfig().isEnableSingleTopicRegister()) {
402+
this.brokerController.registerSingleTopicAll(topicConfig);
403+
} else {
404+
this.brokerController.registerIncrementBrokerData(topicConfig, dataVersion);
405+
}
398406
}
399407

400408
return topicConfig;
@@ -435,7 +443,11 @@ public TopicConfig createTopicOfTranCheckMaxTime(final int clientDefaultTopicQue
435443
}
436444

437445
if (createNew) {
438-
this.brokerController.registerBrokerAll(false, true, true);
446+
if (brokerController.getBrokerConfig().isEnableSingleTopicRegister()) {
447+
this.brokerController.registerSingleTopicAll(topicConfig);
448+
} else {
449+
this.brokerController.registerIncrementBrokerData(topicConfig, dataVersion);
450+
}
439451
}
440452

441453
return topicConfig;
@@ -461,7 +473,11 @@ public void updateTopicUnitFlag(final String topic, final boolean unit) {
461473
dataVersion.nextVersion(stateMachineVersion);
462474

463475
this.persist();
464-
this.brokerController.registerBrokerAll(false, true, true);
476+
if (brokerController.getBrokerConfig().isEnableSingleTopicRegister()) {
477+
this.brokerController.registerSingleTopicAll(topicConfig);
478+
} else {
479+
this.brokerController.registerIncrementBrokerData(topicConfig, dataVersion);
480+
}
465481
}
466482
}
467483

@@ -484,7 +500,11 @@ public void updateTopicUnitSubFlag(final String topic, final boolean hasUnitSub)
484500
dataVersion.nextVersion(stateMachineVersion);
485501

486502
this.persist();
487-
this.brokerController.registerBrokerAll(false, true, true);
503+
if (brokerController.getBrokerConfig().isEnableSingleTopicRegister()) {
504+
this.brokerController.registerSingleTopicAll(topicConfig);
505+
} else {
506+
this.brokerController.registerIncrementBrokerData(topicConfig, dataVersion);
507+
}
488508
}
489509
}
490510

0 commit comments

Comments
 (0)