[CSHARP-3791] Allow hint for unacknowledged writes using OP_MSG when supported by the server Created: 11/Aug/21 Updated: 22/Jun/22 |
|
| Status: | Backlog |
| Project: | C# Driver |
| Component/s: | Write Operations |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Spec Change | Priority: | Major - P3 |
| Reporter: | Backlog - Core Eng Program Management Team | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Upstream Changes Summary: | DRIVERS-1340: Drivers (like Java, for example) that ignore unacknowledged write concern for findOneAndReplace/Update/Delete helpers should skip the following tests:
because those tests are assuming that the driver includes writeConcern: {w : 0 } in the findAndModify command and that, as a result, the server response with only ok: 1 and therefore value is unset. |
||||||||
| Description |
|
Downstream changes: Drivers should no longer prohibit using hint with an unacknowledged write concern for update, delete, and findAndModify commands (issued via OP_MSG) and related helpers (e.g. UpdateOne, bulkWrite, findOneAndDelete) if hint is known to be supported by the server executing the operation (i.e. 4.2+ for update commands, 4.4+ for delete and findAndModify). Drivers should sync unified CRUD tests with mongodb/specifications@59a5dad 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:
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: }} 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. SummaryThis 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. MotivationWho 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. |