[CDRIVER-2224] mongoc_collection_read_write_command_with_opts obeys read preference Created: 26/Jul/17  Updated: 28/Oct/23  Resolved: 27/Jul/17

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

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

Issue Links:
Problem/Incident
causes CDRIVER-2678 Remove unused read preferences parameter Backlog

 Description   

In 1.5.0 we released a set of generic command methods that let the user declare if she was reading, writing, or reading and writing. This excused libmongoc from maintaining a list of commands that required special logic for applying read preference, read concern, and write concern. For example, mongoc_collection_read_command_with_opts applies read concern from the client, but mongoc_collection_write_command_with_opts does not. See CDRIVER-1527.

The bug is, mongoc_collection_read_write_command_with_opts obeys read preference: it selects a secondary when connected to a replica set, or sends $readPreference and sets slaveOk when talking to a mongos. Same for mongoc_database_read_write_command_with_opts and mongoc_client_read_write_command_with_opts.



 Comments   
Comment by Githook User [ 28/Jul/17 ]

Author:

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

Message: CDRIVER-2224 read_write_command funcs must ignore read prefs

The command functions mongoc_client_read_write_command_with_opts,
mongoc_database_read_write_command_with_opts, and
mongoc_collection_read_write_command_with_opts now ignore the read_prefs
parameter.

The read prefs parameter was included by mistake in libmongoc 1.5.
A command that writes must not obey a read preference.
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/b1450d176c3456031f41658f646ef9daadcf7179

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