[Summer of code] Fix the isuue of frequent disconnection of ha connection (#4399)

* fix bug

* throw exception in haWriter

* fix haconnection can't read msg.

* set channel buf = 0

* code review

* code review

* change client address to slave address

* Revert "change client address to slave address"

This reverts commit 198bcdb00e.
This commit is contained in:
hzh0425
2022-06-02 11:07:19 +08:00
committed by GitHub
parent 6f3b372e83
commit 99d77df54f
8 changed files with 212 additions and 191 deletions
@@ -117,21 +117,23 @@ public class BrokerContainerProcessor implements NettyRequestProcessor {
}
if (!messageStoreConfig.isEnableDLegerCommitLog()) {
switch (messageStoreConfig.getBrokerRole()) {
case ASYNC_MASTER:
case SYNC_MASTER:
brokerConfig.setBrokerId(MixAll.MASTER_ID);
break;
case SLAVE:
if (brokerConfig.getBrokerId() <= 0) {
response.setCode(ResponseCode.SYSTEM_ERROR);
response.setRemark("slave broker id must be > 0");
return response;
}
break;
default:
break;
if (!brokerConfig.isEnableControllerMode()) {
switch (messageStoreConfig.getBrokerRole()) {
case ASYNC_MASTER:
case SYNC_MASTER:
brokerConfig.setBrokerId(MixAll.MASTER_ID);
break;
case SLAVE:
if (brokerConfig.getBrokerId() <= 0) {
response.setCode(ResponseCode.SYSTEM_ERROR);
response.setRemark("slave broker id must be > 0");
return response;
}
break;
default:
break;
}
}
if (messageStoreConfig.getTotalReplicas() < messageStoreConfig.getInSyncReplicas()
@@ -149,20 +149,22 @@ public class BrokerContainerStartup {
MixAll.properties2Object(ServerUtil.commandLine2Properties(commandLine), brokerConfig);
switch (messageStoreConfig.getBrokerRole()) {
case ASYNC_MASTER:
case SYNC_MASTER:
brokerConfig.setBrokerId(MixAll.MASTER_ID);
break;
case SLAVE:
if (brokerConfig.getBrokerId() <= 0) {
System.out.printf("Slave's brokerId must be > 0%n");
System.exit(-3);
}
if (!brokerConfig.isEnableControllerMode()) {
switch (messageStoreConfig.getBrokerRole()) {
case ASYNC_MASTER:
case SYNC_MASTER:
brokerConfig.setBrokerId(MixAll.MASTER_ID);
break;
case SLAVE:
if (brokerConfig.getBrokerId() <= 0) {
System.out.printf("Slave's brokerId must be > 0%n");
System.exit(-3);
}
break;
default:
break;
break;
default:
break;
}
}
if (messageStoreConfig.getTotalReplicas() < messageStoreConfig.getInSyncReplicas()