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

fix(NODE-4557): randomize servers when there are only 2 eligible servers #3390

Merged
merged 6 commits into from Sep 1, 2022

Conversation

baileympearson
Copy link
Contributor

@baileympearson baileympearson commented Aug 30, 2022

Description

What is changing?

When we encounter exactly 2 eligible servers in the server selection process, we now shuffle the array of two servers. This prevents a scenario where, when we receive a sequence of operations and each operation completes before the next (or approximately this scenario), we would select the same server for each request.

Is there new documentation needed for these changes?

No.

Double check the following

  • Ran npm run check:lint script
  • Self-review completed using the steps outlined here
  • PR title follows the correct format: <type>(NODE-xxxx)<!>: <description>
  • Changes are covered by tests
  • New TODOs have a related JIRA ticket

@baileympearson baileympearson changed the title add failing regression test wip add failing regression test Aug 30, 2022
@baileympearson baileympearson changed the title wip add failing regression test fix(NODE-4557): shuffles servers when there are only 2 eligible servers Aug 30, 2022
@baileympearson baileympearson marked this pull request as ready for review August 30, 2022 17:14
@baileympearson baileympearson changed the title fix(NODE-4557): shuffles servers when there are only 2 eligible servers fix(NODE-4557): shuffle servers when there are only 2 eligible servers Aug 30, 2022
@nbbeeken nbbeeken self-requested a review August 30, 2022 20:31
@nbbeeken nbbeeken added the Primary Review In Review with primary reviewer, not yet ready for team's eyes label Aug 30, 2022
nbbeeken
nbbeeken previously approved these changes Aug 31, 2022
Copy link
Contributor

@nbbeeken nbbeeken left a comment

Choose a reason for hiding this comment

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

LGTM

src/sdam/topology.ts Outdated Show resolved Hide resolved
nbbeeken
nbbeeken previously approved these changes Aug 31, 2022
@nbbeeken nbbeeken added Team Review Needs review from team and removed Primary Review In Review with primary reviewer, not yet ready for team's eyes labels Aug 31, 2022
@baileympearson baileympearson changed the title fix(NODE-4557): shuffle servers when there are only 2 eligible servers fix(NODE-4557): randomize servers when there are only 2 eligible servers Aug 31, 2022
durran
durran previously approved these changes Aug 31, 2022
src/sdam/topology.ts Outdated Show resolved Hide resolved
@jyemin jyemin self-requested a review September 1, 2022 18:45
@nbbeeken nbbeeken merged commit ddcfa49 into main Sep 1, 2022
@nbbeeken nbbeeken deleted the NODE-4557-operation-count-poc branch September 1, 2022 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team Review Needs review from team
Projects
None yet
4 participants