Skip to content

Commit

Permalink
Shuffle nodeurls to make sure all connections aren't to the first nod…
Browse files Browse the repository at this point in the history
…e by default #14983 (#14986)

Signed-off-by: OneSizeFitQuorum <tanxinyu@apache.org>
  • Loading branch information
OneSizeFitsQuorum authored Feb 28, 2025
1 parent 97657f9 commit 56fd6ea
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ public Session(
if (nodeUrls.isEmpty()) {
throw new IllegalArgumentException("nodeUrls shouldn't be empty.");
}
Collections.shuffle(nodeUrls);
this.nodeUrls = nodeUrls;
this.username = username;
this.password = password;
Expand All @@ -428,6 +429,7 @@ public Session(Builder builder) {
if (builder.nodeUrls.isEmpty()) {
throw new IllegalArgumentException("nodeUrls shouldn't be empty.");
}
Collections.shuffle(builder.nodeUrls);
this.nodeUrls = builder.nodeUrls;
this.enableQueryRedirection = true;
} else {
Expand Down

0 comments on commit 56fd6ea

Please # to comment.