Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions driver/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,10 @@ const DEFAULT_SERVER_SELECTION_TIMEOUT: Duration = Duration::from_secs(30);
/// details.
///
/// ## Overload Retry Behavior
/// All operations executed by a `Client` may retry if the selected server is overloaded. For
/// details on server load-shedding, see the documentation for
/// [Intelligent Workload Management](https://www.mongodb.com/docs/atlas/intelligent-workload-management/)
/// and [Overload Errors](https://www.mongodb.com/docs/atlas/overload-errors).
/// All operations executed by a `Client` may retry if the selected server is overloaded. An
/// overload error is indicated by the
/// [`SYSTEM_OVERLOADED_ERROR`](crate::error::SYSTEM_OVERLOADED_ERROR) error label. This behavior is
/// functional with MongoDB server version 9.0 and above.
///
/// The following options can be configured to customize this behavior:
/// - Set [`ClientOptions::retry_reads`] to false to disable retrying all reads. Note that this will
Expand Down
8 changes: 8 additions & 0 deletions driver/src/client/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -689,11 +689,15 @@ pub struct ClientOptions {

/// The maximum number of retries to perform when overload errors are encountered. Defaults to
/// 2.
///
/// This option only has an effect with MongoDB server version 9.0 and above.
pub max_adaptive_retries: Option<u32>,

/// Whether to enable overload retargeting when overload errors are encountered. When overload
/// retargeting is enabled, the server on which an overload error occurs is deprioritized
/// when selecting a server for a retry attempt. Defaults to false.
///
/// This option only has an effect with MongoDB server version 9.0 and above.
pub enable_overload_retargeting: Option<bool>,

/// Information from the SRV URI that generated these client options, if applicable.
Expand Down Expand Up @@ -1088,11 +1092,15 @@ pub struct ConnectionString {

/// The maximum number of retries to perform when overload errors are encountered. Defaults to
/// 2.
///
/// This option only has an effect with MongoDB server version 9.0 and above.
pub max_adaptive_retries: Option<u32>,

/// Whether to enable overload retargeting when overload errors are encountered. When overload
/// retargeting is enabled, the server on which an overload error occurs is deprioritized
/// when selecting a server for a retry attempt. Defaults to false.
///
/// This option only has an effect with MongoDB server version 9.0 and above.
pub enable_overload_retargeting: Option<bool>,

#[serde(serialize_with = "serde_util::serialize_duration_option_as_int_millis")]
Expand Down