-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Adding timeoutMS for explain helpers #1770
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
base: main
Are you sure you want to change the base?
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.
@nhachicha - looks like some tests are failing:
com.mongodb.reactivestreams.client.ExplainTest.testExplainWithMaxTimeMS - 5 Failed
com.mongodb.client.ExplainTest.testExplainWithMaxTimeMS - 3 Failed
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 adds timeout support to the MongoDB driver's explain operations for find and aggregate queries. The implementation adds new overloaded methods that accept a timeoutMS
parameter, allowing developers to specify custom timeouts for explain operations rather than relying on global timeout settings.
Key changes include:
- Addition of four new explain method overloads accepting
timeoutMS
parameter for both FindIterable and AggregateIterable interfaces - Implementation of timeout-aware execute methods that create specialized timeout executors
- Comprehensive test coverage verifying timeout behavior and command structure
Reviewed Changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
AbstractExplainTest.java | Adds functional test for explain timeout behavior with fail point testing |
FindIterable.java / AggregateIterable.java | Interface definitions for new timeout-aware explain methods |
FindIterableImpl.java / AggregateIterableImpl.java | Core implementation of timeout-aware explain execution |
Various driver adapters | Implementation of new methods across Scala, Kotlin, and reactive streams adapters |
...reactive-streams/src/main/com/mongodb/reactivestreams/client/internal/FindPublisherImpl.java
Outdated
Show resolved
Hide resolved
* | ||
* @param timeoutMS the timeout in milliseconds for the explain operation | ||
* @return the execution plan | ||
* @since 5.2 |
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.
All these should be 5.6
.
* @mongodb.driver.manual reference/command/explain/ | ||
* @mongodb.server.release 3.2 | ||
*/ | ||
Document explain(long timeoutMS); |
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.
I'm not clear why all these overloads are needed. For the rest of CSOT, applications specify the timeout via MongoCluster/MongoDatabase/MongoCollection#withTimeout
. Would that suffice for specifying the timeout for explain
?
The changes covered by this ticket were already implemented in JAVA-5580, where we also decided not to introduce any new knobs on explain helpers (during one of the catch-ups). According to the existing CSOT specification, Our API supports this model via
In that case, This approach aligns with our existing API design, which already includes We've documented this design approach, along with the reasoning and tradeoffs, here: To clarify:
Regarding
|
Fixes JAVA-5579