You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ta...@apache.org on 2025/02/28 03:57:03 UTC

(iotdb) branch master updated: Shuffle nodeurls to make sure all connections aren't to the first node by default #14983

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

tanxinyu 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 b3e57d29409 Shuffle nodeurls to make sure all connections aren't to the first node by default #14983
b3e57d29409 is described below

commit b3e57d2940909667ca29bad21d0de1c2e64ea617
Author: Potato <ta...@apache.org>
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 <ta...@apache.org>
---
 .../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 6908cad0632..357203563c7 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
@@ -425,6 +425,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;
@@ -441,6 +442,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 {