[CDRIVER-710] Wrong writeConcernErrors format Created: 18/Jun/15  Updated: 15/Sep/20  Resolved: 16/Sep/15

Status: Closed
Project: C Driver
Component/s: Bulk API, libmongoc
Affects Version/s: None
Fix Version/s: 1.2-rc0

Type: Bug Priority: Major - P3
Reporter: A. Jesse Jiryu Davis Assignee: A. Jesse Jiryu Davis
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on CDRIVER-845 Documents in array sent with insert c... Closed
is depended on by PHPC-436 Handle new writeConcernErrors array i... Closed
Related
related to PHPC-1683 Collect error labels from writeConcer... Closed
is related to CDRIVER-492 mongoc never reports WriteConcern error Closed
is related to CDRIVER-901 _mongoc_write_result_complete() does ... Closed

 Description   

I think the driver is just appending write concern errors from bulk ops to the same subdocument instead of appending subdocuments to an array of writeConcern errors:

{ "nInserted" : 3,
"nMatched" : 0,
"nModified" : 0,
"nRemoved" : 0,
"nUpserted" : 2,
"upserted" : [ { "index" : 2,
"_id" : { "$oid" : "55823de64c976b58533705d7" } }, { "index" : 3,
"_id" : { "$oid" : "55823de64c976b58533705d8" } } ],
"writeErrors" : [  ],
"writeConcernError" : { "code" : 64,
"errInfo" : { "wtimeout" : true },
"errmsg" : "waiting for replication timed out",
"code" : 64,
"errInfo" : { "wtimeout" : true },
"errmsg" : "waiting for replication timed out",
"code" : 64,
"errInfo" : { "wtimeout" : true },
"errmsg" : "waiting for replication timed out" } }

Besides, the field should be "writeConcernErrors" plural, only "code" and "errmsg" should be in each subdocument (not "errInfo"), and the bson_error_t should be filled out with a domain, code, and message.

https://github.com/mongodb/specifications/blob/master/source/driver-bulk-update.rst#handling-write-concern-errors



 Comments   
Comment by Githook User [ 11/Jan/16 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}

Message: CDRIVER-710 fix writeConcernErrors format

Write operations' replies should contain an array, writeConcernErrors.
The driver had called this writeConcernError and catenated all such
errors into the same subdocument, causing multiple duplicate field
names.

This fixes the format for modern write commands. Legacy operations still
ignore write concern errors entirely, see CDRIVER 707.
Branch: 1.3.0-dev
https://github.com/mongodb/mongo-c-driver/commit/2d8dd0c5aaa74a27c91881f3358d40630230e708

Comment by Githook User [ 26/Oct/15 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}

Message: CDRIVER-710 fix writeConcernErrors format

Write operations' replies should contain an array, writeConcernErrors.
The driver had called this writeConcernError and catenated all such
errors into the same subdocument, causing multiple duplicate field
names.

This fixes the format for modern write commands. Legacy operations still
ignore write concern errors entirely, see CDRIVER 707.
Branch: debian
https://github.com/mongodb/mongo-c-driver/commit/2d8dd0c5aaa74a27c91881f3358d40630230e708

Comment by Githook User [ 16/Sep/15 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}

Message: CDRIVER-710 fix writeConcernErrors format

Write operations' replies should contain an array, writeConcernErrors.
The driver had called this writeConcernError and catenated all such
errors into the same subdocument, causing multiple duplicate field
names.

This fixes the format for modern write commands. Legacy operations still
ignore write concern errors entirely, see CDRIVER 707.
Branch: 1.2.0-dev
https://github.com/mongodb/mongo-c-driver/commit/2d8dd0c5aaa74a27c91881f3358d40630230e708

Comment by A. Jesse Jiryu Davis [ 16/Sep/15 ]

Tests for this bug can't pass until CDRIVER-845 ensures that "insert" commands are properly formatted.

Comment by Githook User [ 18/Jun/15 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}

Message: CDRIVER-686 more info on bulk "reply"

The writeConcernErrors shown are not yet implemented, see CDRIVER-710.
Branch: 1.2.0-dev
https://github.com/mongodb/mongo-c-driver/commit/b9089660a39928472d91164341bfae28ff653902

Generated at Wed Feb 07 21:10:24 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.