RongtongJin commented on code in PR #10380:
URL: https://github.com/apache/rocketmq/pull/10380#discussion_r3308188790


##########
client/src/main/java/org/apache/rocketmq/client/impl/MQAdminImpl.java:
##########
@@ -157,9 +157,14 @@ public List<MessageQueue> fetchPublishMessageQueues(String 
topic) throws MQClien
     }
 
     public List<MessageQueue> parsePublishMessageQueues(List<MessageQueue> 
messageQueueList) {
-        List<MessageQueue> resultQueues = new ArrayList<>();
+        String namespace = 
this.mQClientFactory.getClientConfig().getNamespace();
+        if (namespace == null || namespace.isEmpty()) {
+            return messageQueueList;

Review Comment:
   One concern about this change is that the method semantics change from 
“always returning a new list” to “returning the original list when namespace is 
empty”.
   
   If any caller mutates the returned list, this could accidentally mutate the 
original message queue list, especially if that list is reused or cached 
elsewhere in the send path.
   
   Could you confirm that the return value of `parsePublishMessageQueues` is 
treated as read-only by all callers, or that the original list is not reused as 
mutable shared state?



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

Reply via email to