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 2020/10/09 16:04:49 UTC

[GitHub] [rocketmq] maixiaohai commented on a change in pull request #2167: [ISSUE #2165] Slave read enable not work sometimes When cluster deployed on DLedger mode

maixiaohai commented on a change in pull request #2167:
URL: https://github.com/apache/rocketmq/pull/2167#discussion_r502530945



##########
File path: client/src/main/java/org/apache/rocketmq/client/impl/factory/MQClientInstance.java
##########
@@ -1044,9 +1044,14 @@ public FindBrokerResult findBrokerAddressInSubscribe(
             found = brokerAddr != null;
 
             if (!found && !onlyThisBroker) {
-                Entry<Long, String> entry = map.entrySet().iterator().next();
-                brokerAddr = entry.getValue();
-                slave = entry.getKey() != MixAll.MASTER_ID;
+                if (brokerId == 1 && map.size() > 2) {
+                    brokerAddr = map.get(2L);

Review comment:
       I agree with u, I'will try to find a more elegant way.




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