You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "dingshuangxi888 (via GitHub)" <gi...@apache.org> on 2023/02/03 08:10:25 UTC

[GitHub] [rocketmq] dingshuangxi888 commented on a diff in pull request #5976: [ISSUE #5975] Fix getUserTopicConfig Impl not remove system topic

dingshuangxi888 commented on code in PR #5976:
URL: https://github.com/apache/rocketmq/pull/5976#discussion_r1095463186


##########
tools/src/main/java/org/apache/rocketmq/tools/admin/DefaultMQAdminExtImpl.java:
##########
@@ -1658,8 +1660,14 @@ public TopicConfigSerializeWrapper getUserTopicConfig(final String brokerAddr, f
         TopicList topicList = this.mqClientInstance.getMQClientAPIImpl().getSystemTopicListFromBroker(brokerAddr, timeoutMillis);
         Iterator<Entry<String, TopicConfig>> iterator = topicConfigSerializeWrapper.getTopicConfigTable().entrySet().iterator();
         while (iterator.hasNext()) {
-            String topic = iterator.next().getKey();
-            if (topicList.getTopicList().contains(topic) || !specialTopic && (topic.startsWith(MixAll.RETRY_GROUP_TOPIC_PREFIX) || topic.startsWith(MixAll.DLQ_GROUP_TOPIC_PREFIX))) {
+            TopicConfig topicConfig = iterator.next().getValue();
+            if (topicList.getTopicList().contains(topicConfig.getTopicName())
+                    || TopicValidator.isSystemTopic(topicConfig.getTopicName())) {
+                iterator.remove();
+            } else if (!specialTopic && StringUtils.startsWithAny(topicConfig.getTopicName(),
+                    MixAll.RETRY_GROUP_TOPIC_PREFIX, MixAll.DLQ_GROUP_TOPIC_PREFIX)) {
+                iterator.remove();
+            } else if (!PermName.isValid(topicConfig.getPerm())) {

Review Comment:
   存在broker的hostname作为系统内部topic的用法,为了屏蔽用户访问,设置了perm=7。另外从用户视角来看,设置了不存在的权限的topic也不需要查询出来。



-- 
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: commits-unsubscribe@rocketmq.apache.org

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