RUBY-3703 Deprecate legacy retry tuning options#3057
Open
comandeo-mongo wants to merge 1 commit into
Open
Conversation
Issue a deprecation warning when :max_read_retries, :read_retry_interval, or :max_write_retries is set. These options only affect the legacy retry implementation, which is deprecated and will be removed in a future version. Modern retryable reads and writes are enabled by default and do not use them.
Contributor
There was a problem hiding this comment.
Pull request overview
Deprecates legacy retry tuning client options that only affect the driver’s legacy retry implementation (itself deprecated), by adding documentation notes and emitting one-time runtime deprecation warnings when those options are explicitly provided.
Changes:
- Annotates
:max_read_retries,:read_retry_interval, and:max_write_retriesoption docs as deprecated for legacy-retry-only behavior. - Adds a private
deprecate_legacy_retry_options!helper to issueMongo::Deprecationswarnings for those options. - Invokes the helper from
validate_options!so warnings apply to bothClient.newandClient#with.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1459
to
+1461
| %i[max_read_retries read_retry_interval max_write_retries].each do |key| | ||
| next unless options.key?(key) | ||
|
|
Comment on lines
1472
to
+1474
| def validate_options!(addresses = nil, is_srv: nil) | ||
| deprecate_legacy_retry_options! | ||
|
|
jamis
approved these changes
Jun 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Deprecates the legacy retry tuning options. These options only affect the
legacy retry implementation, which is deprecated and slated for removal. Modern
retryable reads and writes are enabled by default and ignore them.
A one-time
Mongo::Deprecationswarning is issued when any of the following isexplicitly set on a client:
:max_read_retries:read_retry_interval:max_write_retriesSetting
retry_reads: false/retry_writes: falsedoes not warn — thoseremain valid modern-spec options for disabling retries; only the legacy
retry-once fallback behind the tuning options is being deprecated.
Files changed
lib/mongo/client.rb— new privatedeprecate_legacy_retry_options!(calledfrom
validate_options!, covering bothClient.newand#with); deprecationnotes added to the three
@optiondoc entries.Test plan
No new specs: this is a deprecation-only change (doc annotation + runtime
warning), and the legacy path stays covered by existing tests. Ran against a
local replica set:
rubocop lib/mongo/client.rb— no offensesretry_reads/writes: falsealonespec/mongo/client_construction_spec.rb— 257 examples, 0 failuresspec/mongo/retryable_spec.rb+spec/mongo/retryable/— 91 examples, 0 failuresspec/integration/retryable_writes/retryable_writes_spec.rb— 640 examples, 0 failuresJira: https://jira.mongodb.org/browse/RUBY-3703