Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Randomized connection order of servers #391

Merged
merged 1 commit into from
Nov 6, 2024

Conversation

abuijze
Copy link
Contributor

@abuijze abuijze commented Oct 23, 2024

Randomizing the order in which servers are used for connections prevents a misbehaving (e.g. out of sync) first candidate to prevent the application from connecting via other instances in the cluster.

Randomizing the order in which servers are used for connections prevents a misbehaving (e.g. out of sync) first candidate to prevent the application from connecting via other instances in the cluster.
Copy link
Contributor

@smcvb smcvb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes seem fine to me, but wouldn't they be nice for a patch release perhaps?

Copy link

new ServerAddress("server3")),
connectAttempts);
// we don't care in which order the connects happened, as long as all hosts have been tried
assertEquals(new HashSet<>(asList(new ServerAddress("server1"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Collections.unmodifiableSet(...) instead of new HashSet<>(asList(...))?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Collections.unmodifiableSet(...) expects a Set, so that would change it to Collections.unmodifiableSet(new HashSet<>(asList(...).

@smcvb smcvb changed the base branch from master to connector-2024.1.x November 6, 2024 14:04
@smcvb smcvb changed the base branch from connector-2024.1.x to master November 6, 2024 14:04
Copy link
Contributor

@smcvb smcvb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving this PR, as I want to proceed to merge this into 2024.1.1 for the upcoming patch release.

@smcvb smcvb merged commit 5b16f79 into master Nov 6, 2024
4 of 5 checks passed
@smcvb smcvb deleted the improvement/random-connect-order branch November 6, 2024 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants