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

GODRIVER-2222 Prevent removing valid servers when updating SRV hosts. #805

Merged
merged 2 commits into from Nov 23, 2021

Conversation

matthewdale
Copy link
Collaborator

GODRIVER-2222

Currently, the driver may remove valid servers from a topology when updating the topology based on the SRV host records if len(SRV hosts) > srvMaxHosts. Instead, when updating topology servers from SRV host records, wait until we've determined the added and removed hosts to limit the topology servers list to srvMaxHosts.

Also use rand.Rand.Shuffle instead of a custom shuffle implementation and re-enable the "SRVMaxHosts is less than number of hosts" test.

Copy link
Contributor

@benjirewis benjirewis left a comment

Choose a reason for hiding this comment

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

Thanks for taking this!

x/mongo/driver/topology/topology.go Outdated Show resolved Hide resolved
Copy link
Contributor

@kevinAlbs kevinAlbs left a comment

Choose a reason for hiding this comment

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

LGTM with suggested change to only shuffle when necessary.

x/mongo/driver/topology/topology.go Outdated Show resolved Hide resolved
Copy link
Contributor

@benjirewis benjirewis left a comment

Choose a reason for hiding this comment

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

LGTM!

@matthewdale
Copy link
Collaborator Author

All failing tests are due to DRIVERS-1991 or GODRIVER-2238.

@matthewdale matthewdale merged commit a452f51 into mongodb:master Nov 23, 2021
faem pushed a commit to kubedb/mongo-go-driver that referenced this pull request Mar 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants