fuyou001 commented on code in PR #7325:
URL: https://github.com/apache/rocketmq/pull/7325#discussion_r1319289034
##########
broker/src/main/java/org/apache/rocketmq/broker/BrokerController.java:
##########
@@ -1766,29 +1770,31 @@ public synchronized void
registerIncrementBrokerData(List<TopicConfig> topicConf
}
public synchronized void registerBrokerAll(final boolean checkOrderConfig,
boolean oneway, boolean forceRegister) {
+ ConcurrentMap<String, TopicConfig> topicConfigMap =
this.getTopicConfigManager().getTopicConfigTable();
- TopicConfigAndMappingSerializeWrapper topicConfigWrapper = new
TopicConfigAndMappingSerializeWrapper();
-
-
topicConfigWrapper.setDataVersion(this.getTopicConfigManager().getDataVersion());
-
topicConfigWrapper.setTopicConfigTable(this.getTopicConfigManager().getTopicConfigTable());
-
-
topicConfigWrapper.setTopicQueueMappingInfoMap(this.getTopicQueueMappingManager().getTopicQueueMappingTable().entrySet().stream().map(
+ Map<String, TopicQueueMappingInfo> topicQueueMappingInfoMap =
this.getTopicQueueMappingManager().getTopicQueueMappingTable().entrySet().stream().map(
entry -> new AbstractMap.SimpleImmutableEntry<>(entry.getKey(),
TopicQueueMappingDetail.cloneAsMappingInfo(entry.getValue()))
- ).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)));
+ ).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
+ ConcurrentHashMap<String, TopicConfig> topicConfigTable = new
ConcurrentHashMap<>();
if (!PermName.isWriteable(this.getBrokerConfig().getBrokerPermission())
||
!PermName.isReadable(this.getBrokerConfig().getBrokerPermission())) {
- ConcurrentHashMap<String, TopicConfig> topicConfigTable = new
ConcurrentHashMap<>();
- for (TopicConfig topicConfig :
topicConfigWrapper.getTopicConfigTable().values()) {
+ for (TopicConfig topicConfig : topicConfigMap.values()) {
TopicConfig tmp =
new TopicConfig(topicConfig.getTopicName(),
topicConfig.getReadQueueNums(), topicConfig.getWriteQueueNums(),
topicConfig.getPerm() &
this.brokerConfig.getBrokerPermission(), topicConfig.getTopicSysFlag());
topicConfigTable.put(topicConfig.getTopicName(), tmp);
+ if (this.brokerConfig.isEnableSplitRegistration() &&
topicConfigTable.size() >= this.brokerConfig.getSplitRegistrationSize()) {
+ TopicConfigAndMappingSerializeWrapper topicConfigWrapper =
buildSerializeWrapper(topicConfigTable, topicQueueMappingInfoMap);
+ doRegisterBrokerAll(checkOrderConfig, oneway,
topicConfigWrapper);
+ topicConfigTable.clear();
+ topicQueueMappingInfoMap.clear();
Review Comment:
The last batch of metadata was not registered.
--
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]