Support sending writeConcern for commands that write
(CDRIVER-1322)
|
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | libmongoc |
| Affects Version/s: | None |
| Fix Version/s: | 1.4.0 |
| Type: | Sub-task | Priority: | Major - P3 |
| Reporter: | A. Jesse Jiryu Davis | Assignee: | Fiona Rowan |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
I'm accepting Pull Request 358, which adds mongoc_collection_aggregate_with_write_concern, but I noticed a problem. The algorithm there is:
Then, as always, when the user runs mongoc_cursor_next, its algorithm is:
But the two selections may select different members of the replica set or different mongos servers in a sharded cluster, and these servers may have different wire versions! Instead, let's add a mongoc_write_concern_t to mongoc_cursor_t, similar to the read prefs and read concern it has already. Whenever a cursor is created, if and only if it's created by one of the command helpers whose names end in _with_write_concern, set the cursor's write concern. Don't append it to the command document yet. Then, when the user calls mongoc_cursor_next it calls _mongoc_cursor_cursorid_refresh_from_command which calls _mongoc_cursor_run_command. In there we get a server stream and know its wire version for certain. If it's 5+ and cursor->write_concern is not NULL or the default, append the write concern to the command before the call to mongoc_cluster_run_command_monitored. |
| Comments |
| Comment by Githook User [ 02/Aug/16 ] |
|
Author: {u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@emptysquare.net'}Message: Merge pull request #380 from fionaRowan/C-1414
|
| Comment by Githook User [ 02/Aug/16 ] |
|
Author: {u'name': u'Fiona Rowan', u'email': u'fiona.rowan@10gen.com'}Message: |
| Comment by Githook User [ 30/Jul/16 ] |
|
Author: {u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@emptysquare.net'}Message: Merge pull request #372 from fionaRowan/
|
| Comment by Githook User [ 30/Jul/16 ] |
|
Author: {u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@emptysquare.net'}Message: Merge pull request #372 from fionaRowan/
|
| Comment by Githook User [ 30/Jul/16 ] |
|
Author: {u'name': u'Fiona Rowan', u'email': u'fiona.rowan@10gen.com'}Message: |