-
Type: Task
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
Use Case
As a... user of the Node.js driver
I want... the new bulk write API to respect the CSOT timeoutMS
So that... I can consistently rely on the CSOT feature for all operations
User Experience
- New bulk write respects timeoutMS
Dependencies
- None
Risks/Unknowns
- What could go wrong while implementing this change? (e.g., performance, inadvertent behavioral changes in adjacent functionality, existing tech debt, etc)
- What does it mean for client.bulkWrite to be available and CSOT to be available, but a feature release makes bulkWrite start respecting a timeoutMS without code changes?
- We are not going to take this approach; timeoutMS will need to be explicitly opt-in later if we don't implement CSOT for it right away (i.e., remove the option from new bulk write).
- Does the spec have language about how client.bulkWrite works with CSOT? How are batches meant to be timed out, how is the cursor supposed to be configured?
- timeoutMS will bound the total execution time for all the batches and the lifetime of all cursors
- Are there spec tests for CSOT and client.bulkWrite specifically?
- Yes, one prose test
- What does it mean for client.bulkWrite to be available and CSOT to be available, but a feature release makes bulkWrite start respecting a timeoutMS without code changes?
- Is there an opportunity for better cross-driver alignment or testing in this area?
- Yes, we should capture relevant clarifications in a DRIVERS ticket, and add more spec testing
- Is there an opportunity to improve existing documentation on this subject?
- N/A
Acceptance Criteria
Implementation Requirements
- Implement support for timeoutMS in the new bulk write
Testing Requirements
- Unskip CSOT prose test 11
Test Scenarios
when CSOT is enabled, acknowledged writes:
- If the bulkWrite command takes longer than timeoutMS, the operation fails with a timeout error.
- If the bulkWrite command + iterating the result cursor takes longer than timeoutMS, the operation fails with a timeout error.
- If the cursor errors, the cursor refreshes the timeout with a full timeoutMS for the killCursors command.
- If the cursor errors and the timeout must be refreshed, the global timeout must not be impacted and subsequent batches must still be governed by the initial timeoutMS value. (i.e., `cursor.cleanup()` does not mutate the provided timeout context when refreshing the timeout)
when CSOT is enabled, unacknowledged writes:
- If the bulkWrite command takes longer than timeoutMS, the operation fails with a timeout error.
- For multi-batch writes, if executing all batches takes longer than timeoutMS, the operation fails with a timeout error.
Documentation Requirements
- API docs
Follow Up Requirements
- N/A