You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2021/05/11 02:56:09 UTC

[GitHub] [rocketmq] hYuang opened a new issue #2864: producer auto create topic , defaultTopicQueueNums not work 。the queueNums always smaller then defaultTopicConfig

hYuang opened a new issue #2864:
URL: https://github.com/apache/rocketmq/issues/2864


    **broker/src/main/java/org/apache/rocketmq/broker/topic/TopicConfigManager.java**
   
   
    public TopicConfig createTopicInSendMessageMethod(final String topic, final String defaultTopic,
           final String remoteAddress, final int clientDefaultTopicQueueNums, final int topicSysFlag) {
           TopicConfig topicConfig = null;
           boolean createNew = false;
   
           try {
               if (this.lockTopicConfigTable.tryLock(LOCK_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS)) {
                   try {
                       topicConfig = this.topicConfigTable.get(topic);
                       if (topicConfig != null)
                           return topicConfig;
   
                       TopicConfig defaultTopicConfig = this.topicConfigTable.get(defaultTopic);
                       if (defaultTopicConfig != null) {
                           if (defaultTopic.equals(TopicValidator.AUTO_CREATE_TOPIC_KEY_TOPIC)) {
                               if (!this.brokerController.getBrokerConfig().isAutoCreateTopicEnable()) {
                                   defaultTopicConfig.setPerm(PermName.PERM_READ | PermName.PERM_WRITE);
                               }
                           }
   
                           if (PermName.isInherited(defaultTopicConfig.getPerm())) {
                               topicConfig = new TopicConfig(topic);
   
                              
   
    _**int queueNums =
                                   clientDefaultTopicQueueNums > defaultTopicConfig.getWriteQueueNums() ? defaultTopicConfig
                                       .getWriteQueueNums() : clientDefaultTopicQueueNums;**_ 
   
                               if (queueNums < 0) {
                                   queueNums = 0;
                               }
   
                               topicConfig.setReadQueueNums(queueNums);
                               topicConfig.setWriteQueueNums(queueNums);
                               int perm = defaultTopicConfig.getPerm();
                               perm &= ~PermName.PERM_INHERIT;
                               topicConfig.setPerm(perm);
                               topicConfig.setTopicSysFlag(topicSysFlag);
                               topicConfig.setTopicFilterType(defaultTopicConfig.getTopicFilterType());
                           } else {
                               log.warn("Create new topic failed, because the default topic[{}] has no perm [{}] producer:[{}]",
                                   defaultTopic, defaultTopicConfig.getPerm(), remoteAddress);
                           }
                     
   
   
       }


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq] panzhi33 commented on issue #2864: producer auto create topic , defaultTopicQueueNums not work 。the queueNums always smaller then defaultTopicConfig

Posted by GitBox <gi...@apache.org>.
panzhi33 commented on issue #2864:
URL: https://github.com/apache/rocketmq/issues/2864#issuecomment-839378587


   The number of queues in defaultTopicConfig is determined by the defaultTopicQueueNums in the broker.conf configuration file. Generally, it should not be larger than this number. If you need to modify it, you can use the updateTopic operation and maintenance command to modify it.
   Also, it is not recommended to turn on the autoCreateTopicEnable switch


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq] hYuang commented on issue #2864: producer auto create topic , defaultTopicQueueNums not work 。the queueNums always smaller then defaultTopicConfig

Posted by GitBox <gi...@apache.org>.
hYuang commented on issue #2864:
URL: https://github.com/apache/rocketmq/issues/2864#issuecomment-840213503


   > The number of queues in defaultTopicConfig is determined by the defaultTopicQueueNums in the broker.conf configuration file. Generally, it should not be larger than this number. If you need to modify it, you can use the updateTopic operation and maintenance command to modify it.
   > Also, it is not recommended to turn on the autoCreateTopicEnable switch
   
   thank you


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq] hYuang closed issue #2864: producer auto create topic , defaultTopicQueueNums not work 。the queueNums always smaller then defaultTopicConfig

Posted by GitBox <gi...@apache.org>.
hYuang closed issue #2864:
URL: https://github.com/apache/rocketmq/issues/2864


   


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org