[CDRIVER-431] Allow getting hint for node from failed bulk write operations Created: 25/Sep/14  Updated: 10/Aug/16  Resolved: 23/Feb/16

Status: Closed
Project: C Driver
Component/s: None
Affects Version/s: 1.0.0
Fix Version/s: 1.4.0

Type: Improvement Priority: Minor - P4
Reporter: Jeremy Mikola 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
is depended on by PHPC-66 WriteExceptions with a WriteResult sh... Closed
Epic Link: Public API for PHP drivers

 Description   

The PHP prototype is currently using mongoc_bulk_operation_execute() exclusively for write operations. This function returns an integer hint for the node servicing the write on success; however, no hint is returned if an error occurs. That's fine for client-side errors such as empty batches, but I think it'd be helpful to report the hint for server-side errors.

I understand we can't change the function signature, but can the hint be made accessible on the reply bson_t without breaking BC? Alternatively, is there another way that I can extract the hint immediately after an unsuccessful call to mongoc_bulk_operation_execute() (perhaps something similar to how mongoc_collection_get_last_error() works)?



 Comments   
Comment by Githook User [ 23/Feb/16 ]

Author:

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

Message: CDRIVER-431 mongoc_bulk_operation_get_hint

Also document mongoc_bulk_operation_set_hint.
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/f90014490ff752aa3a4223857d11a6ecda1ea9e8

Comment by A. Jesse Jiryu Davis [ 17/Aug/15 ]

Let's put the info into the "reply" bson_t where all the other stats like "nInserted" go.

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