Koado commented on code in PR #9153:
URL: https://github.com/apache/rocketmq/pull/9153#discussion_r1928264492
##########
broker/src/main/java/org/apache/rocketmq/broker/processor/AdminBrokerProcessor.java:
##########
@@ -2038,6 +2022,37 @@ private RemotingCommand
getConsumeStats(ChannelHandlerContext ctx,
return response;
}
+ private Set<String> getTopicsForCollecting(List<String> topicListProvided,
String topicProvided, String group) {
+ Set<String> topicsForCollecting = new HashSet<>();
+ if (!topicListProvided.isEmpty()) {
+ // if topic list is provided, only collect the topics in the list
+ // and ignore subscription check
+ topicsForCollecting.addAll(topicListProvided);
+ } else {
+ // In order to be compatible with the old logic,
+ // even if the topic has been provided here, the subscription will
be checked.
+ if (UtilAll.isBlank(topicProvided)) {
+ topicsForCollecting.addAll(
+
this.brokerController.getConsumerOffsetManager().whichTopicByConsumer(group));
+ } else {
+ topicsForCollecting.add(topicProvided);
+ }
+ int subscriptionCount =
this.brokerController.getConsumerManager().findSubscriptionDataCount(group);
+ Iterator<String> iterator = topicsForCollecting.iterator();
+ while (iterator.hasNext()) {
+ String topic = iterator.next();
+ SubscriptionData findSubscriptionData =
this.brokerController.getConsumerManager().findSubscriptionData(group, topic);
+ if (findSubscriptionData == null && subscriptionCount > 0) {
+ LOGGER.warn(
+ "AdminBrokerProcessor#getConsumeStats: topic does not
exist in consumer group's subscription, topic={}, consumer group={}",
+ topic, group);
+ iterator.remove();
+ }
+ }
+ }
Review Comment:
why no need to enter this filtering logic when providing topicList?
--
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]