[SERVER-74390] Add numErrors to bulkWrite command responses Created: 27/Feb/23  Updated: 29/Oct/23  Resolved: 20/Apr/23

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

Type: Task Priority: Major - P3
Reporter: Lingzhi Deng Assignee: Kaitlin Mahar
Resolution: Fixed Votes: 0
Labels: milestone-1
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-76267 Populate numErrors in mongos command ... Closed
Assigned Teams:
Replication
Backwards Compatibility: Fully Compatible
Sprint: Repl 2023-04-17, Repl 2023-05-01
Participants:

 Description   

The bulkWrite command should return an numErrors field indicating the number of errors in its cursor response. So this will look something like:

{
    ok: 1,
    numErrors: NumberInt(...),
    cursor: {
        id: NumberLong(...),
        firstBatch: [
            { ok: 1, idx: 0, n: NumberInt(...), nModified: NumberInt(...), upserted: any, value: { ... } },
            { ok: 0, idx: 1, code: NumberInt(...), codeName: " ... ", errmsg: " ... " },
            ...
        ]
    },
    ...
}

Based on the numErrors, users can decide if they would like to iterate through the cursor responses to consume the response for each individual operation. If the users/drivers decide not to exhaust the returned cursor, it is expected that a killCursors command is sent to kill the cursor on the server side.

 

Note this ticket also covers updating existing tests in jstests/core/write/bulk/bulk_write_*_cursor.js to properly test the number of errors returned and add any new required tests to cover multiple errors being counted correctly.



 Comments   
Comment by Githook User [ 20/Apr/23 ]

Author:

{'name': 'Kaitlin Mahar', 'email': 'kaitlin.mahar@mongodb.com', 'username': 'kmahar'}

Message: SERVER-74390 Add numErrors to bulkWrite response
Branch: master
https://github.com/mongodb/mongo/commit/032c7f7d75006a6530639a80842afdd3ac13e5f6

Comment by Kaitlin Mahar [ 19/Apr/23 ]

Note for future readers: this ticket covered adding numErrors to the IDL response and populating it correctly on mongod. For now on mongos it is always set to 0; SERVER-76267 will cover correctly calculating it there.

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