-
Notifications
You must be signed in to change notification settings - Fork 916
GODRIVER-3648 Make server selection block on topology updates. #2211
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-3648 Make server selection block on topology updates. #2211
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a bug where server selection enters a tight loop when no selectable servers are available by removing the default
case from a select statement to make topology updates blocking.
- Removes the
default
case from the select statement inTopology.selectServerFromSubscription
- Changes the server selection loop from non-blocking to blocking behavior
- Prevents CPU-intensive tight looping when waiting for topology changes
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
API Change ReportNo changes found! |
🧪 Performance ResultsCommit SHA: de38ea6There were no significant changes to the performance to report for version 68dc7f808b51940007329b3e.
For a comprehensive view of all microbenchmark results for this PR's commit, please check out the Evergreen perf task for this patch. |
d91361f
to
768bf6d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need a test case for the change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it would be a good idea to add a test. I'll try to find a sensible assertion we can make to check that it doesn't enter a busy wait.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a test that catches the busy-wait case.
GODRIVER-3648
Summary
Remove the
default
case from the select statement inTopology.selectServerFromSubscription
, making the loop block until there is a topology change.Background & Motivation
A bug was introduced in #1515 that makes the
Topology.selectServerFromSubscription
loop non-blocking, resulting in a tight loop when there are no selectable servers.