zcsh0721 opened a new issue #2750:
URL: https://github.com/apache/rocketmq/issues/2750
在 `PullMessageProcessor.processRequest()` 中:
```
// 步骤1
if (getMessageResult.isSuggestPullingFromSlave()) {
responseHeader.setSuggestWhichBrokerId(subscriptionGroupConfig.getWhichBrokerWhenConsumeSlowly());
} else {
responseHeader.setSuggestWhichBrokerId(MixAll.MASTER_ID);
}
// 步骤 2
switch
(this.brokerController.getMessageStoreConfig().getBrokerRole()) {
case ASYNC_MASTER:
case SYNC_MASTER:
break;
case SLAVE:
if
(!this.brokerController.getBrokerConfig().isSlaveReadEnable()) {
response.setCode(ResponseCode.PULL_RETRY_IMMEDIATELY);
responseHeader.setSuggestWhichBrokerId(MixAll.MASTER_ID);
}
break;
}
// 步骤3
if (this.brokerController.getBrokerConfig().isSlaveReadEnable())
{
// consume too slow ,redirect to another machine
if (getMessageResult.isSuggestPullingFromSlave()) {
responseHeader.setSuggestWhichBrokerId(subscriptionGroupConfig.getWhichBrokerWhenConsumeSlowly());
}
// consume ok
else {
responseHeader.setSuggestWhichBrokerId(subscriptionGroupConfig.getBrokerId());
}
} else {
responseHeader.setSuggestWhichBrokerId(MixAll.MASTER_ID);
}
```
发现在步骤 3 中,一定会执行 `responseHeader.setSuggestWhichBrokerId()` , 那么 步骤 1 和步骤 2
执行的 `responseHeader.setSuggestWhichBrokerId()` 就没有任何意义了;
我进行了一定的删减, 并把代码抽离成一个独立的方法
--
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:
[email protected]