@@ -1765,29 +1765,34 @@ public synchronized void registerIncrementBrokerData(List<TopicConfig> topicConf
1765
1765
}
1766
1766
1767
1767
public synchronized void registerBrokerAll (final boolean checkOrderConfig , boolean oneway , boolean forceRegister ) {
1768
+ ConcurrentMap <String , TopicConfig > topicConfigMap = this .getTopicConfigManager ().getTopicConfigTable ();
1769
+ ConcurrentHashMap <String , TopicConfig > topicConfigTable = new ConcurrentHashMap <>();
1768
1770
1769
- TopicConfigAndMappingSerializeWrapper topicConfigWrapper = new TopicConfigAndMappingSerializeWrapper ();
1770
-
1771
- topicConfigWrapper .setDataVersion (this .getTopicConfigManager ().getDataVersion ());
1772
- topicConfigWrapper .setTopicConfigTable (this .getTopicConfigManager ().getTopicConfigTable ());
1773
-
1774
- topicConfigWrapper .setTopicQueueMappingInfoMap (this .getTopicQueueMappingManager ().getTopicQueueMappingTable ().entrySet ().stream ().map (
1775
- entry -> new AbstractMap .SimpleImmutableEntry <>(entry .getKey (), TopicQueueMappingDetail .cloneAsMappingInfo (entry .getValue ()))
1776
- ).collect (Collectors .toMap (Map .Entry ::getKey , Map .Entry ::getValue )));
1777
-
1778
- if (!PermName .isWriteable (this .getBrokerConfig ().getBrokerPermission ())
1779
- || !PermName .isReadable (this .getBrokerConfig ().getBrokerPermission ())) {
1780
- ConcurrentHashMap <String , TopicConfig > topicConfigTable = new ConcurrentHashMap <>();
1781
- for (TopicConfig topicConfig : topicConfigWrapper .getTopicConfigTable ().values ()) {
1782
- TopicConfig tmp =
1771
+ for (TopicConfig topicConfig : topicConfigMap .values ()) {
1772
+ if (!PermName .isWriteable (this .getBrokerConfig ().getBrokerPermission ())
1773
+ || !PermName .isReadable (this .getBrokerConfig ().getBrokerPermission ())) {
1774
+ topicConfigTable .put (topicConfig .getTopicName (),
1783
1775
new TopicConfig (topicConfig .getTopicName (), topicConfig .getReadQueueNums (), topicConfig .getWriteQueueNums (),
1784
- topicConfig .getPerm () & this .brokerConfig .getBrokerPermission (), topicConfig .getTopicSysFlag ());
1785
- topicConfigTable .put (topicConfig .getTopicName (), tmp );
1776
+ topicConfig .getPerm () & getBrokerConfig ().getBrokerPermission ()));
1777
+ } else {
1778
+ topicConfigTable .put (topicConfig .getTopicName (), topicConfig );
1779
+ }
1780
+
1781
+ if (this .brokerConfig .isEnableSplitRegistration ()
1782
+ && topicConfigTable .size () >= this .brokerConfig .getSplitRegistrationSize ()) {
1783
+ TopicConfigAndMappingSerializeWrapper topicConfigWrapper = this .getTopicConfigManager ().buildSerializeWrapper (topicConfigTable );
1784
+ doRegisterBrokerAll (checkOrderConfig , oneway , topicConfigWrapper );
1785
+ topicConfigTable .clear ();
1786
1786
}
1787
- topicConfigWrapper .setTopicConfigTable (topicConfigTable );
1788
1787
}
1789
1788
1790
- if (forceRegister || needRegister (this .brokerConfig .getBrokerClusterName (),
1789
+ Map <String , TopicQueueMappingInfo > topicQueueMappingInfoMap = this .getTopicQueueMappingManager ().getTopicQueueMappingTable ().entrySet ().stream ()
1790
+ .map (entry -> new AbstractMap .SimpleImmutableEntry <>(entry .getKey (), TopicQueueMappingDetail .cloneAsMappingInfo (entry .getValue ())))
1791
+ .collect (Collectors .toMap (Map .Entry ::getKey , Map .Entry ::getValue ));
1792
+
1793
+ TopicConfigAndMappingSerializeWrapper topicConfigWrapper = this .getTopicConfigManager ().
1794
+ buildSerializeWrapper (topicConfigTable , topicQueueMappingInfoMap );
1795
+ if (this .brokerConfig .isEnableSplitRegistration () || forceRegister || needRegister (this .brokerConfig .getBrokerClusterName (),
1791
1796
this .getBrokerAddr (),
1792
1797
this .brokerConfig .getBrokerName (),
1793
1798
this .brokerConfig .getBrokerId (),
0 commit comments