You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2020/05/14 01:51:20 UTC

[GitHub] [incubator-iotdb] jt2594838 commented on a change in pull request #1198: [IOTDB-355] Start up checks for seed nodes

jt2594838 commented on a change in pull request #1198:
URL: https://github.com/apache/incubator-iotdb/pull/1198#discussion_r424825747



##########
File path: cluster/src/main/java/org/apache/iotdb/cluster/server/member/MetaGroupMember.java
##########
@@ -905,6 +936,63 @@ private boolean processAddNodeLocally(Node node, StartUpStatus startUpStatus,
     return false;
   }
 
+  private boolean checkSeedNodes(boolean isClusterEstablished, List<Node> localSeedNodes,
+      List<Node> remoteSeedNodes) {
+    return isClusterEstablished ? seedNodesContains(localSeedNodes, remoteSeedNodes)
+        : seedNodesEquals(localSeedNodes, remoteSeedNodes);
+  }
+
+  private boolean seedNodesEquals(List<Node> thisNodeList, List<Node> thatNodeList) {
+    Node[] thisNodeArray = thisNodeList.toArray(new Node[0]);
+    Node[] thatNodeArray = thatNodeList.toArray(new Node[0]);
+    Arrays.sort(thisNodeArray, this::compareSeedNode);
+    Arrays.sort(thatNodeArray, this::compareSeedNode);

Review comment:
       Is it necessary to copy them to an array rather than just use `List.sort()`?




----------------------------------------------------------------
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:
users@infra.apache.org