[CDRIVER-1448] private generic command function that supports writeConcern Created: 04/Aug/16  Updated: 10/Aug/16  Resolved: 05/Aug/16

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

Type: Bug Priority: Major - P3
Reporter: Fiona Rowan Assignee: Fiona Rowan
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on CDRIVER-1322 Support sending writeConcern for comm... Closed
is depended on by CDRIVER-1460 on writeConcernError, parse wc err an... Closed
Backwards Compatibility: Fully Compatible

 Description   

The following functions have been implemented in CDRIVER-1322:

mongoc_collection_drop_with_write_concern
mongoc_database_drop_with_write_concern
mongoc_collection_drop_index_with_write_concern
mongoc_database_create_collection_with_write_concern

When max_wire_version >=5, these functions need to return false (or some other indication of failure) on writeConcernError and parse the error.

Create a new function: _mongoc_client_command_with_write_concern. Its code is just like mongoc_client_command_simple, except that, just before it calls _mongoc_client_command_with_stream:

if (server_stream->sd->max_wire_version >= WIRE_VERSION_CMD_WRITE_CONCERN &&
    write_concern &&
    !_mongoc_write_concern_is_default (write_concern))

...then it copies the command and appends the write concern to it.

Call this new private function from all the "_with_write_concern" public functions.



 Comments   
Comment by Githook User [ 05/Aug/16 ]

Author:

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

Message: Merge pull request #382 from fionaRowan/CDRIVER-1448

CDRIVER-1448: _mongoc_client_command_with_write_concern
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/5662841c60072b35b299c7e9275ef0dc1dbf7f60

Comment by Githook User [ 05/Aug/16 ]

Author:

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

Message: Merge pull request #382 from fionaRowan/CDRIVER-1448

CDRIVER-1448: _mongoc_client_command_with_write_concern
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/5662841c60072b35b299c7e9275ef0dc1dbf7f60

Comment by Githook User [ 05/Aug/16 ]

Author:

{u'name': u'Fiona Rowan', u'email': u'fiona.rowan@10gen.com'}

Message: CDRIVER-1448: _mongoc_client_command_with_write_concern
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/37ff60fc7103748cc3e4de28cd88f98aafd8c8c8

Comment by A. Jesse Jiryu Davis [ 04/Aug/16 ]

I propose a new private function:

_mongoc_client_command_with_write_concern (
                              mongoc_client_t           *client,
                              const char                *db_name,
                              const bson_t              *command,
                              const mongoc_read_prefs_t *read_prefs,
                              mongoc_write_concern_t *write_concern,
                              bson_t                    *reply,
                              bson_error_t              *error)

Since it's private we're not violating the decision from SPEC-619. Its code is just like mongoc_client_command_simple, except that, just before it calls _mongoc_client_command_with_stream, then

if (server_stream->sd->max_wire_version >= WIRE_VERSION_CMD_WRITE_CONCERN &&
    write_concern &&
    !_mongoc_write_concern_is_default (write_concern))

... it copies the command and appends the write concern to it.

Call this new private function from all the "_with_write_concern" public functions.

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