You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implement Client Side Operation Timeout (CSOT) feature (#1215)
Introduce a unified Client Side Operation Timeout (CSOT) as an Alpha feature to simplify the multitude of existing
timeout settings. This consolidation merges various complex timeout settings into a single, overarching operation
timeout option, enhancing usability and predictability. Existing timeout options will continue to be honored if the
operation timeout is not set. The options `serverSelectionTimeoutMS` and `connectTimeoutMS` are still honored even
if the operation timeout is set.
Key Changes:
- Implement CSOT across various layers of the driver, applying the new operation
timeout configuration to govern execution time in areas such as Authentication,
Connection Monitoring and Pooling, Server Discovery and Monitoring, CRUD, GridFS,
CSFLE, Transactions, Handshake, and Server Selection.
- Annotate CSOT API as Alpha, indicating that this public API is in
the early stages of development and may undergo incompatible changes.
- Centralize the setting of maxTimeMS just before sending commands to the server.
This optimization enhances performance and ensures precise enforcement of timeouts.
- Introduce TimeoutContext to centralize timeout-related logic, enhancing the
clarity and ease of maintenance for timeout management within the driver.
- Enable a new retry mode when CSOT is active, allowing operations to retry until the timeout is reached.
This improves resiliency compared to the previous behavior of retrying only once.
- Enhance MongoClient, MongoDatabase, MongoCollection, and ClientSession to support
setting and inheriting the operation timeout.
- Introduce MongoCluster, a new conceptual entity representing server deployments,
configurable with specific writeConcern, timeout, and read preference.
- Account for minimum Round Trip Time (RTT) for socket reads and writes when CSOT is enabled to ensure timeouts
are adjusted for network latency, avoiding connection churn.
- Standardize CSOT error handling by transforming timeout errors into the new `MongoOperationTimeoutException`.
---------
Co-authored-by: Ross Lawley <ross@mongodb.com>
Co-authored-by: Maxim Katcharov <maxim.katcharov@mongodb.com>
Co-authored-by: Jeff Yemin <jeff.yemin@mongodb.com>
Co-authored-by: Viacheslav Babanin <slav.babanin@mongodb.com>
Co-authored-by: Valentin Kovalenko <valentin.kovalenko@mongodb.com>
0 commit comments