This is an automated email from the ASF dual-hosted git repository. tanxinyu pushed a commit to branch session_nodeurl_shuffle_cp in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 5bca08b1bf22e0ce0b16a55963d7594ea6dffa2f Author: Potato <[email protected]> AuthorDate: Fri Feb 28 11:56:58 2025 +0800 Shuffle nodeurls to make sure all connections aren't to the first node by default #14983 Signed-off-by: OneSizeFitQuorum <[email protected]> --- .../session/src/main/java/org/apache/iotdb/session/Session.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/iotdb-client/session/src/main/java/org/apache/iotdb/session/Session.java b/iotdb-client/session/src/main/java/org/apache/iotdb/session/Session.java index d283b1ee066..b7bf5daac0c 100644 --- a/iotdb-client/session/src/main/java/org/apache/iotdb/session/Session.java +++ b/iotdb-client/session/src/main/java/org/apache/iotdb/session/Session.java @@ -412,6 +412,7 @@ public class Session implements ISession { if (nodeUrls.isEmpty()) { throw new IllegalArgumentException("nodeUrls shouldn't be empty."); } + Collections.shuffle(nodeUrls); this.nodeUrls = nodeUrls; this.username = username; this.password = password; @@ -428,6 +429,7 @@ public class Session implements ISession { if (builder.nodeUrls.isEmpty()) { throw new IllegalArgumentException("nodeUrls shouldn't be empty."); } + Collections.shuffle(builder.nodeUrls); this.nodeUrls = builder.nodeUrls; this.enableQueryRedirection = true; } else {
