Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE #6537] Fix bug MessageStoreConfig.haListenPort item config not… #6538

Merged
merged 14 commits into from
Apr 25, 2023
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public static BrokerController buildBrokerController(String[] args) throws Excep
final NettyClientConfig nettyClientConfig = new NettyClientConfig();
final MessageStoreConfig messageStoreConfig = new MessageStoreConfig();
nettyServerConfig.setListenPort(10911);
messageStoreConfig.setHaListenPort(0);

Options options = ServerUtil.buildCommandlineOptions(new Options());
CommandLine commandLine = ServerUtil.parseCmdLine(
Expand Down Expand Up @@ -167,7 +168,10 @@ public static BrokerController buildBrokerController(String[] args) throws Excep
System.exit(-4);
}

messageStoreConfig.setHaListenPort(nettyServerConfig.getListenPort() + 1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the user has not configured it, could the default port for HA be set to nettyServerConfig.getListenPort() + 1 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

haListenPort default value is nettyServerConfig.getListenPort()'default value +1

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nettyServerConfig.listenPort default value is 10911

image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this PR will break the compatibility, that is, the default value of haLitenPort is listenPort + 1. Users setting listenPort but not setting haLitenPort explicitly will find haLitenPort changes after updating to new version.

The more appropriate way may be:

  • if haLitenPort is set explicitly, use the value set by user;
  • if haLitenPort is not set, assign listenPort + 1 to it.

if (messageStoreConfig.getHaListenPort() <= 0) {
messageStoreConfig.setHaListenPort(nettyServerConfig.getListenPort() + 1);
}

brokerConfig.setInBrokerContainer(false);

System.setProperty("brokerLogDir", "");
Expand Down