Willhow-Gao opened a new issue, #8090:
URL: https://github.com/apache/rocketmq/issues/8090

   ### Before Creating the Enhancement Request
   
   - [X] I have confirmed that this should be classified as an enhancement 
rather than a bug/feature.
   
   
   ### Summary
   
   1. 
方法isSetEqual在比较两个set时,两个set都为empty时,返回的是不相等,从逻辑上来说,应该是true吧,毕竟两个set都为null判定的都是相等。从代码上说,从broker获取topic的messagequeue不可能是空的,否则会抛MQClientException异常。因此我认为应该移除掉set1.size()==0这个判断。
   <img width="955" alt="image" 
src="https://github.com/apache/rocketmq/assets/65004897/8256e5d7-c96d-401b-844e-ac848cad03ce";>
   <img width="1120" alt="image" 
src="https://github.com/apache/rocketmq/assets/65004897/f71d149c-0544-44c8-ba3a-b2ddf9724538";>
   <img width="872" alt="image" 
src="https://github.com/apache/rocketmq/assets/65004897/fcc9b322-17b3-4830-9ff8-afff5d144ce1";>
   2. 当已经找到了一个set1中存在,但是set2中不存在的元素时,就可以判定两个set不相等了,直接退出循环即可,没必要再继续比较了
   <img width="816" alt="image" 
src="https://github.com/apache/rocketmq/assets/65004897/f25930d7-2213-48df-a222-f41e78157c71";>
   
   
   
   ### Motivation
   
   优化isSetEqual以提高方法性能
   
   ### Describe the Solution You'd Like
   
   1. 移除错误且不必要的分支判断set1.size() == 0
   2. 检测到不相等元素时,提前退出循环并返回结果
   
   ### Describe Alternatives You've Considered
   
   无
   
   ### Additional Context
   
   _No response_


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