-
Type: Spec Change
-
Resolution: Unresolved
-
Priority: Minor - P4
-
None
-
Component/s: CRUD
-
Needed
-
This reverts DRIVERS-991, which instructed drivers to raise a client-side error when the hint option is provided with an unacknowledged write issued against any server version.
When the the server is known to support hint (i.e. 4.2+ for update, 4.4+ for delete), drivers should allow the option to be specified. They should only report an error for earlier server versions where the server is known to not support the option and an error would otherwise not be returned because of the nature of unacknowledged writes.
Previous arguments relating hint to existing treatment of arrayFilters and collation aren't relevant, because their documentation refers to "unacknowledged writes using OP_UPDATE" (where the option cannot be expressed). Those options don't refer to OP_MSG at all, because they were both supported by all server versions that support OP_MSG. hint can retain the language about OP_UPDATE, but its OP_MSG language should be revised to only mandate an error on unsupported server versions.
Lastly, the following Q&A should be revised:
Q: Why are client-side errors raised when options are provided for unacknowledged write operations, even on server versions that support those options?
Even if the server supports an option, that option could be incorrectly formatted or contain outdated information (e.g. a "hint" option referencing an index that no longer exists). This is a problem during unacknowledged writes because the server cannot return an error response to alert the client of an incorrect option. By always raising a client-side error when options are specified for unacknowledged writes, users are prevented from performing operations with options that do not work.
This is a poor argument as incorrectly formatted options can just as easily apply to the filter or update/replacement arguments (e.g. using an invalid query operator). It's one thing to raise a client-error when the driver knows for certain that a server option is not supported, but the current strategy is presumptive.
We should also update the language for findAndModify in the CRUD spec (since it does refer to behavior of unacknowledged write concerns). findAndModify support for hint requires 4.4+ (see: SERVER-42099, SERVER-44367). Although findAndModify always returns a response, an unacknowledged write concern seems to force an {{
}} response, which hides any error if hint is unsupported or invalid (e.g. no such index). With respect to this issue, we need only concern ourselves with whether hint is supported, so raising an error if hint is used on a pre-4.4 server with an unacknowledged write concern is sufficient.
Summary
This issue was originally reported after starting work on language tickets for DRIVERS-991, which asked drivers to raise client-side errors for any use of hint with unacknowledged writes. This ticket seeks to revert that change and make an allowance for cases where drivers know that the server does support the hint option. Since DRIVERS-991 was filed, libmongoc and dependent drivers have chosen not to implement that ticket and are instead waiting on this ticket to be resolved. This ticket has languished for more than a year since and remains outstanding.
Motivation
Who is the affected end user?
Applications that would like to utilize hint options with unacknowledged writes.
How does this affect the end user?
The behavior is currently prohibited by our specifications despite being possible to implement. In hindsight, it was premature to add the blanket prohibition.
How likely is it that this problem or use case will occur?
A minority of applications make individual use of hint and unacknowledged writes. The intersection of applications using both features together is even rarer.
If the problem does occur, what are the consequences and how severe are they?
Inability to execute a supported operation.
Is this issue urgent?
No.
Is this ticket required by a downstream team?
No.
Is this ticket only for tests?
This ticket affects both driver functionality and our spec tests.
- depends on
-
DRIVERS-681 Allow passing hint to findAndModify update and replace operations
- Development Complete
-
DRIVERS-751 support ability to pass hint to update
- Closed
- is related to
-
DRIVERS-790 Raise error if hint specified for unacknowledged update using OP_MSG or OP_UPDATE
- Closed
- related to
-
DRIVERS-1899 Write results should be optional to accommodate unacknowledged write concerns
- Closed
- split to
-
NODE-3541 Allow hint for unacknowledged writes using OP_MSG when supported by the server
- Backlog
-
JAVA-4275 Allow hint for unacknowledged writes using OP_MSG when supported by the server
- Closed
-
PHPLIB-712 Allow hint for unacknowledged writes using OP_MSG when supported by the server
- Closed
-
CSHARP-3791 Allow hint for unacknowledged writes using OP_MSG when supported by the server
- Backlog
-
GODRIVER-2125 Allow hint for unacknowledged writes using OP_MSG when supported by the server
- Backlog
-
CDRIVER-4127 Allow hint for unacknowledged writes using OP_MSG when supported by the server
- Closed
-
CXX-2347 Allow hint for unacknowledged writes using OP_MSG when supported by the server
- Closed
-
MOTOR-806 Allow hint for unacknowledged writes using OP_MSG when supported by the server
- Closed
-
PYTHON-2863 Allow hint for unacknowledged writes using OP_MSG when supported by the server
- Closed
-
RUBY-2766 Allow hint for unacknowledged writes using OP_MSG when supported by the server
- Closed
-
RUST-974 Allow hint for unacknowledged writes using OP_MSG when supported by the server
- Closed