This is an automated email from the ASF dual-hosted git repository. hxd pushed a commit to branch change_rpc_port in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 12018342974695cf48ae23d8669f52eb07a10af4 Author: xiangdong huang <[email protected]> AuthorDate: Mon Feb 15 13:55:32 2021 +0800 fix merge conflict --- .../java/org/apache/iotdb/cluster/ClusterMain.java | 134 ++++++++++----------- .../apache/iotdb/cluster/utils/ClusterNode.java | 4 +- .../apache/iotdb/cluster/utils/ClusterUtils.java | 2 +- .../cluster/client/async/AsyncClientPoolTest.java | 12 +- .../cluster/client/async/AsyncDataClientTest.java | 2 +- .../cluster/client/async/AsyncMetaClientTest.java | 2 +- 6 files changed, 78 insertions(+), 78 deletions(-) diff --git a/cluster/src/main/java/org/apache/iotdb/cluster/ClusterMain.java b/cluster/src/main/java/org/apache/iotdb/cluster/ClusterMain.java index 236c38c..d05a305 100644 --- a/cluster/src/main/java/org/apache/iotdb/cluster/ClusterMain.java +++ b/cluster/src/main/java/org/apache/iotdb/cluster/ClusterMain.java @@ -224,78 +224,78 @@ public class ClusterMain { private static void replaceDefaultProps(String[] params) { Options options = new Options(); - Option metaPort = new Option(OPTION_INTERVAL_META_PORT, OPTION_INTERVAL_META_PORT, true, - "port for metadata service"); - metaPort.setRequired(false); - options.addOption(metaPort); - - Option dataPort = new Option(OPTION_INTERVAL_DATA_PORT, OPTION_INTERVAL_DATA_PORT, true, - "port for data service"); - dataPort.setRequired(false); - options.addOption(dataPort); - - Option clusterRpcPort = new Option(OPTION_CLUSTER_RPC_PORT, OPTION_CLUSTER_RPC_PORT, true, - "port for client service"); - clusterRpcPort.setRequired(false); - options.addOption(clusterRpcPort); - - Option clusterRpcIP = new Option(OPTION_CLUSTER_RPC_IP, OPTION_CLUSTER_RPC_IP, true, - "IP for client service"); - clusterRpcIP.setRequired(false); - options.addOption(clusterRpcIP); - - Option seedNodes = new Option(OPTION_SEED_NODES, OPTION_SEED_NODES, true, - "comma-separated {IP/DOMAIN}:meta_port:data_port:client_port pairs"); - seedNodes.setRequired(false); - options.addOption(seedNodes); - - Option debugRpcPort = new Option(OPTION_DEBUG_RPC_PORT, OPTION_DEBUG_RPC_PORT, true, - "port for debug client service (using single node mode)"); - clusterRpcPort.setRequired(false); - options.addOption(debugRpcPort); +// Option metaPort = new Option(OPTION_INTERVAL_META_PORT, OPTION_INTERVAL_META_PORT, true, +// "port for metadata service"); +// metaPort.setRequired(false); +// options.addOption(metaPort); +// +// Option dataPort = new Option(OPTION_INTERVAL_DATA_PORT, OPTION_INTERVAL_DATA_PORT, true, +// "port for data service"); +// dataPort.setRequired(false); +// options.addOption(dataPort); +// +// Option clusterRpcPort = new Option(OPTION_CLUSTER_RPC_PORT, OPTION_CLUSTER_RPC_PORT, true, +// "port for client service"); +// clusterRpcPort.setRequired(false); +// options.addOption(clusterRpcPort); +// +// Option clusterRpcIP = new Option(OPTION_CLUSTER_RPC_IP, OPTION_CLUSTER_RPC_IP, true, +// "IP for client service"); +// clusterRpcIP.setRequired(false); +// options.addOption(clusterRpcIP); +// +// Option seedNodes = new Option(OPTION_SEED_NODES, OPTION_SEED_NODES, true, +// "comma-separated {IP/DOMAIN}:meta_port:data_port:client_port pairs"); +// seedNodes.setRequired(false); +// options.addOption(seedNodes); +// +// Option debugRpcPort = new Option(OPTION_DEBUG_RPC_PORT, OPTION_DEBUG_RPC_PORT, true, +// "port for debug client service (using single node mode)"); +// clusterRpcPort.setRequired(false); +// options.addOption(debugRpcPort); CommandLine commandLine = parseCommandLine(options, params); if (commandLine == null) { logger.error("replaces properties failed, use default conf params"); } else { - ClusterConfig clusterConfig = ClusterDescriptor.getInstance().getConfig(); - if (commandLine.hasOption(OPTION_INTERVAL_META_PORT)) { - clusterConfig.setInternalMetaPort(Integer.parseInt(commandLine.getOptionValue( - OPTION_INTERVAL_META_PORT))); - logger.debug("replace local meta port with={}", clusterConfig.getInternalMetaPort()); - } - - if (commandLine.hasOption(OPTION_INTERVAL_DATA_PORT)) { - clusterConfig.setInternalDataPort(Integer.parseInt(commandLine.getOptionValue( - OPTION_INTERVAL_DATA_PORT))); - logger.debug("replace local data port with={}", clusterConfig.getInternalDataPort()); - } - - if (commandLine.hasOption(OPTION_CLUSTER_RPC_PORT)) { - clusterConfig.setClusterRpcPort(Integer.parseInt(commandLine.getOptionValue( - OPTION_CLUSTER_RPC_PORT))); - logger.debug("replace local cluster rpc port with={}", clusterConfig.getClusterRpcPort()); - } - - if (commandLine.hasOption(OPTION_CLUSTER_RPC_IP)) { - IoTDBDescriptor.getInstance().getConfig() - .setRpcAddress(commandLine.getOptionValue(OPTION_CLUSTER_RPC_IP)); - logger.debug("replace local cluster rpc port with={}", clusterConfig.getClusterRpcPort()); - } - - if (commandLine.hasOption(OPTION_SEED_NODES)) { - String seedNodeUrls = commandLine.getOptionValue(OPTION_SEED_NODES); - clusterConfig.setSeedNodeUrls(ClusterDescriptor.getSeedUrlList(seedNodeUrls)); - logger.debug("replace seed nodes with={}", clusterConfig.getSeedNodeUrls()); - } - - if (commandLine.hasOption(OPTION_DEBUG_RPC_PORT)) { - IoTDBDescriptor.getInstance().getConfig().setRpcPort(Integer.parseInt(commandLine.getOptionValue( - OPTION_DEBUG_RPC_PORT))); - IoTDBDescriptor.getInstance().getConfig().setEnableRPCService(true); - logger.debug("replace local cluster (single node) rpc port with={}", commandLine.getOptionValue( - OPTION_DEBUG_RPC_PORT)); - } +// ClusterConfig clusterConfig = ClusterDescriptor.getInstance().getConfig(); +// if (commandLine.hasOption(OPTION_INTERVAL_META_PORT)) { +// clusterConfig.setInternalMetaPort(Integer.parseInt(commandLine.getOptionValue( +// OPTION_INTERVAL_META_PORT))); +// logger.debug("replace local meta port with={}", clusterConfig.getInternalMetaPort()); +// } +// +// if (commandLine.hasOption(OPTION_INTERVAL_DATA_PORT)) { +// clusterConfig.setInternalDataPort(Integer.parseInt(commandLine.getOptionValue( +// OPTION_INTERVAL_DATA_PORT))); +// logger.debug("replace local data port with={}", clusterConfig.getInternalDataPort()); +// } +// +// if (commandLine.hasOption(OPTION_CLUSTER_RPC_PORT)) { +// clusterConfig.setClusterRpcPort(Integer.parseInt(commandLine.getOptionValue( +// OPTION_CLUSTER_RPC_PORT))); +// logger.debug("replace local cluster rpc port with={}", clusterConfig.getClusterRpcPort()); +// } +// +// if (commandLine.hasOption(OPTION_CLUSTER_RPC_IP)) { +// IoTDBDescriptor.getInstance().getConfig() +// .setRpcAddress(commandLine.getOptionValue(OPTION_CLUSTER_RPC_IP)); +// logger.debug("replace local cluster rpc port with={}", clusterConfig.getClusterRpcPort()); +// } +// +// if (commandLine.hasOption(OPTION_SEED_NODES)) { +// String seedNodeUrls = commandLine.getOptionValue(OPTION_SEED_NODES); +// clusterConfig.setSeedNodeUrls(ClusterDescriptor.getSeedUrlList(seedNodeUrls)); +// logger.debug("replace seed nodes with={}", clusterConfig.getSeedNodeUrls()); +// } +// +// if (commandLine.hasOption(OPTION_DEBUG_RPC_PORT)) { +// IoTDBDescriptor.getInstance().getConfig().setRpcPort(Integer.parseInt(commandLine.getOptionValue( +// OPTION_DEBUG_RPC_PORT))); +// IoTDBDescriptor.getInstance().getConfig().setEnableRPCService(true); +// logger.debug("replace local cluster (single node) rpc port with={}", commandLine.getOptionValue( +// OPTION_DEBUG_RPC_PORT)); +// } } } diff --git a/cluster/src/main/java/org/apache/iotdb/cluster/utils/ClusterNode.java b/cluster/src/main/java/org/apache/iotdb/cluster/utils/ClusterNode.java index 334c90f..1e5b15b 100644 --- a/cluster/src/main/java/org/apache/iotdb/cluster/utils/ClusterNode.java +++ b/cluster/src/main/java/org/apache/iotdb/cluster/utils/ClusterNode.java @@ -32,8 +32,8 @@ public class ClusterNode extends Node { public ClusterNode() { } - public ClusterNode(String ip, int metaPort, int nodeIdentifier, int dataPort, int clientPort) { - super(ip, metaPort, nodeIdentifier, dataPort, clientPort); + public ClusterNode(String ip, int metaPort, int nodeIdentifier, int dataPort) { + super(ip, metaPort, nodeIdentifier, dataPort); } public ClusterNode(Node other) { diff --git a/cluster/src/main/java/org/apache/iotdb/cluster/utils/ClusterUtils.java b/cluster/src/main/java/org/apache/iotdb/cluster/utils/ClusterUtils.java index 7919595..f9207af 100644 --- a/cluster/src/main/java/org/apache/iotdb/cluster/utils/ClusterUtils.java +++ b/cluster/src/main/java/org/apache/iotdb/cluster/utils/ClusterUtils.java @@ -284,7 +284,7 @@ public class ClusterUtils { int dataPort = Integer.parseInt(str.substring(dataPortFirstPos, dataPortLastPos)); int clientPort = Integer.parseInt(str.substring(clientPortFirstPos, clientPortLastPos)); //TODO hxd: we do not set values to all fields of a Node. - return new Node(ip, metaPort, id, dataPort, clientPort); + return new Node(ip, metaPort, id, dataPort).setClientPort(clientPort); } public static Node parseNode(String nodeUrl) { diff --git a/cluster/src/test/java/org/apache/iotdb/cluster/client/async/AsyncClientPoolTest.java b/cluster/src/test/java/org/apache/iotdb/cluster/client/async/AsyncClientPoolTest.java index 9581903..12eb645 100644 --- a/cluster/src/test/java/org/apache/iotdb/cluster/client/async/AsyncClientPoolTest.java +++ b/cluster/src/test/java/org/apache/iotdb/cluster/client/async/AsyncClientPoolTest.java @@ -53,7 +53,7 @@ public class AsyncClientPoolTest { } private void getClient() throws IOException { - AsyncClientPool asyncClientPool = new AsyncClientPool("Test", testAsyncClientFactory); + AsyncClientPool asyncClientPool = new AsyncClientPool(testAsyncClientFactory); for (int i = 0; i < 10; i++) { AsyncClient client = asyncClientPool.getClient(TestUtils.getNode(i)); if (client instanceof TestAsyncClient) { @@ -64,7 +64,7 @@ public class AsyncClientPoolTest { } private void putClient() throws IOException { - AsyncClientPool asyncClientPool = new AsyncClientPool("Test", testAsyncClientFactory); + AsyncClientPool asyncClientPool = new AsyncClientPool(testAsyncClientFactory); List<AsyncClient> testClients = new ArrayList<>(); for (int i = 0; i < 10; i++) { AsyncClient client = asyncClientPool.getClient(TestUtils.getNode(i)); @@ -95,7 +95,7 @@ public class AsyncClientPoolTest { int maxClientNum = ClusterDescriptor.getInstance().getConfig().getMaxClientPerNodePerMember(); ClusterDescriptor.getInstance().getConfig().setMaxClientPerNodePerMember(5); testAsyncClientFactory = new TestAsyncClientFactory(); - AsyncClientPool asyncClientPool = new AsyncClientPool("Test", testAsyncClientFactory); + AsyncClientPool asyncClientPool = new AsyncClientPool(testAsyncClientFactory); for (int i = 0; i < 5; i++) { asyncClientPool.getClient(TestUtils.getNode(0)); @@ -121,7 +121,7 @@ public class AsyncClientPoolTest { try { ClusterDescriptor.getInstance().getConfig().setMaxClientPerNodePerMember(10); testAsyncClientFactory = new TestAsyncClientFactory(); - AsyncClientPool asyncClientPool = new AsyncClientPool("Test", testAsyncClientFactory); + AsyncClientPool asyncClientPool = new AsyncClientPool(testAsyncClientFactory); Node node = TestUtils.getNode(0); List<AsyncClient> clients = new ArrayList<>(); @@ -160,7 +160,7 @@ public class AsyncClientPoolTest { try { ClusterDescriptor.getInstance().getConfig().setMaxClientPerNodePerMember(1); testAsyncClientFactory = new TestAsyncClientFactory(); - AsyncClientPool asyncClientPool = new AsyncClientPool("Test", testAsyncClientFactory); + AsyncClientPool asyncClientPool = new AsyncClientPool(testAsyncClientFactory); Node node = TestUtils.getNode(0); List<AsyncClient> clients = new ArrayList<>(); @@ -177,7 +177,7 @@ public class AsyncClientPoolTest { @Test public void testRecreateClient() throws IOException { testAsyncClientFactory = new TestAsyncClientFactory(); - AsyncClientPool asyncClientPool = new AsyncClientPool("Test", new AsyncMetaClient.FactoryAsync(new Factory())); + AsyncClientPool asyncClientPool = new AsyncClientPool(new AsyncMetaClient.FactoryAsync(new Factory())); AsyncMetaClient client = (AsyncMetaClient) asyncClientPool.getClient(TestUtils.getNode(0)); client.onError(new Exception()); diff --git a/cluster/src/test/java/org/apache/iotdb/cluster/client/async/AsyncDataClientTest.java b/cluster/src/test/java/org/apache/iotdb/cluster/client/async/AsyncDataClientTest.java index 5f9afab..7030fc1 100644 --- a/cluster/src/test/java/org/apache/iotdb/cluster/client/async/AsyncDataClientTest.java +++ b/cluster/src/test/java/org/apache/iotdb/cluster/client/async/AsyncDataClientTest.java @@ -25,7 +25,7 @@ public class AsyncDataClientTest { @Test public void test() throws IOException, TException { - AsyncClientPool asyncClientPool = new AsyncClientPool("Test", new SingleManagerFactory(new Factory())); + AsyncClientPool asyncClientPool = new AsyncClientPool(new SingleManagerFactory(new Factory())); AsyncDataClient client; Node node = TestUtils.getNode(0); client = new AsyncDataClient(new Factory(), new TAsyncClientManager(), diff --git a/cluster/src/test/java/org/apache/iotdb/cluster/client/async/AsyncMetaClientTest.java b/cluster/src/test/java/org/apache/iotdb/cluster/client/async/AsyncMetaClientTest.java index 5e795f0..ffca8c5 100644 --- a/cluster/src/test/java/org/apache/iotdb/cluster/client/async/AsyncMetaClientTest.java +++ b/cluster/src/test/java/org/apache/iotdb/cluster/client/async/AsyncMetaClientTest.java @@ -25,7 +25,7 @@ public class AsyncMetaClientTest { @Test public void test() throws IOException, TException { - AsyncClientPool asyncClientPool = new AsyncClientPool("Test", new FactoryAsync(new Factory())); + AsyncClientPool asyncClientPool = new AsyncClientPool(new FactoryAsync(new Factory())); AsyncMetaClient client; Node node = TestUtils.getNode(0); client = new AsyncMetaClient(new Factory(), new TAsyncClientManager(),
