Skip to content

RUBY-3741 Support deprioritizing for all topologies#2984

Merged
comandeo-mongo merged 1 commit intomongodb:masterfrom
comandeo-mongo:3741-deprioritized-servers-all-topologies
Feb 6, 2026
Merged

RUBY-3741 Support deprioritizing for all topologies#2984
comandeo-mongo merged 1 commit intomongodb:masterfrom
comandeo-mongo:3741-deprioritized-servers-all-topologies

Conversation

@comandeo-mongo
Copy link
Contributor

This PR enables server deprioritization on retry attempts for all topologies and apply deprioritized filtering before applying read/write preferences during server selection.

This PR is a part of client backpressure initiative - https://jira.mongodb.org/browse/DRIVERS-3160

Copy link
Contributor

Copilot AI left a 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 implements server deprioritization for all MongoDB topologies as part of the client backpressure initiative (DRIVERS-3160). The changes enable retry operations to avoid repeatedly selecting the same failing servers by deprioritizing them during server selection.

Changes:

  • Added deprioritization filtering that occurs before read/write preference evaluation
  • Implemented fallback logic to select deprioritized servers when no other suitable servers are available
  • Added comprehensive test coverage including 8 new server selection test cases

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.

File Description
lib/mongo/server_selector/base.rb Core implementation: refactored suitable_servers to apply deprioritization filtering through candidates method, added fallback logic for when all suitable servers are deprioritized
spec/runners/server_selection.rb Updated test runner to support deprioritized_servers parameter and added skip logic for one known failing test case
spec/spec_tests/server_selection_spec.rb Added SKIPPED_TESTS configuration to skip DeprioritizedAllSecondaryPreferred test pending RUBY-3768 resolution
spec/spec_tests/data/server_selection/ReplicaSetWithPrimary/read/*.yml Added 8 new test cases covering deprioritization scenarios across different read preferences (Primary, PrimaryPreferred, Secondary, SecondaryPreferred, Nearest) including edge cases like state changes and all-servers-deprioritized

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@jamis jamis left a comment

Choose a reason for hiding this comment

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

👍

There are some test failures, but they appear spurious.

@comandeo-mongo comandeo-mongo merged commit 7f263eb into mongodb:master Feb 6, 2026
176 of 178 checks passed
@comandeo-mongo comandeo-mongo deleted the 3741-deprioritized-servers-all-topologies branch February 6, 2026 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants