[SERVER-83788] Insert-only bulkWrite sent from mongos to mongod should use errorsOnly:true Created: 01/Dec/23  Updated: 07/Dec/23  Resolved: 07/Dec/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Vishnu Kaushik Assignee: Backlog - Replication Team
Resolution: Won't Fix Votes: 0
Labels: milestone-2
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Replication
Participants:

 Description   

For insert-only bulkWrite commands, errorsOnly:false doesn't provide any additional information compared to errorsOnly:true (summary mode). Therefore, any insert-only bulkWrite should always use errorsOnly:true as responses are much cheaper to produce in summary mode. This should be possible because inserts either succeed with n: 1, or fail with an error. It isn't possible for an insert to produce n: 0 while not having an associated error.

This is not true for updates / deletes because 1) they can no-op without an error and 2) touch more than one document when multi:true. Because of this we won't be able to figure out which update / delete contributed how much to the totals nModified and nDeleted. For example, for two updates [u1, u2] if we receive a single number nModified: 1 in summary mode, from this we cannot figure out whether u1 or u2 produced the modification.

The point of this work is to make the insert-only code path more performant. If somehow there is a way to make this work for updates and deletes as well, then that is great: we can completely get rid of errorsOnly:false.

Ideally, the driver itself will send errorsOnly:true when it sees that it is sending an insert-only bulkWrite.



 Comments   
Comment by Sean Zimmerman [ 07/Dec/23 ]

We decided this would be too complex to implement and not give enough benefit to warrant doing it

Generated at Thu Feb 08 06:53:09 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.