You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ji...@apache.org on 2020/12/10 01:55:23 UTC

[iotdb] branch master updated: Change variable names makes the logic easier to understand

This is an automated email from the ASF dual-hosted git repository.

jiangtian pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/master by this push:
     new 27c28a1  Change variable names makes the logic easier to understand
     new 4fc4cf2  Merge pull request #2232 from liutaohua/add_comment
27c28a1 is described below

commit 27c28a118fc80488775814f75afbe9e2fd44a330
Author: liudw <li...@apache.org>
AuthorDate: Wed Dec 9 18:20:05 2020 +0800

    Change variable names makes the logic easier to understand
---
 cluster/src/main/java/org/apache/iotdb/cluster/ClusterMain.java | 9 +++++----
 1 file changed, 5 insertions(+), 4 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 b382242..4d87317 100644
--- a/cluster/src/main/java/org/apache/iotdb/cluster/ClusterMain.java
+++ b/cluster/src/main/java/org/apache/iotdb/cluster/ClusterMain.java
@@ -201,14 +201,15 @@ public class ClusterMain {
     }
 
     // 1. check the cluster_rpc_ip and seed_nodes consistent or not
+    // when clusterRpcIp is 127.0.0.1, the entire cluster must be start locally
     ClusterConfig config = ClusterDescriptor.getInstance().getConfig();
-    String clusterRpcIp = "127.0.0.1";
+    String localhostIp = "127.0.0.1";
     String configClusterRpcIp = config.getClusterRpcIp();
     List<String> seedNodes = config.getSeedNodeUrls();
-    boolean isClusterRpcIp = clusterRpcIp.equals(configClusterRpcIp);
+    boolean isLocalCluster = localhostIp.equals(configClusterRpcIp);
     for (String seedNodeIP : seedNodes) {
-      if ((isClusterRpcIp && !seedNodeIP.contains(clusterRpcIp)) ||
-          (!isClusterRpcIp && seedNodeIP.contains(clusterRpcIp))) {
+      if ((isLocalCluster && !seedNodeIP.contains(localhostIp)) ||
+          (!isLocalCluster && seedNodeIP.contains(localhostIp))) {
         logger.error(
             "cluster_rpc_ip={} and seed_nodes={} should be consistent, both use local ip or real ip please",
             configClusterRpcIp, seedNodes);