[CDRIVER-704] $readPreference sent to non-mongos Created: 14/Jun/15 Updated: 19/Oct/16 Resolved: 08/Sep/15 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | 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: |
|
||||||||||||||||||||
| Description |
|
Revealed testing
to a replica set secondary. Uncomment the query pattern in _test_kill_cursors to reproduce. To match Server Selection, the driver must send $readPreference only to mongos: Verify the rest of $readPreference and slaveOkay-bit handling, too. |
| 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: The driver sends $readPreference to mongods and mongoses, but it should | |||||||
| 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: The driver sends $readPreference to mongods and mongoses, but it should | |||||||
| Comment by Githook User [ 05/Oct/15 ] | |||||||
|
Author: {u'username': u'jmikola', u'name': u'Jeremy Mikola', u'email': u'jmikola@gmail.com'}Message: Fixed by | |||||||
| Comment by Githook User [ 08/Sep/15 ] | |||||||
|
Author: {u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}Message: The driver sends $readPreference to mongods and mongoses, but it should | |||||||
| Comment by Hannes Magnusson [ 11/Aug/15 ] | |||||||
|
It appears we are also sending $readPreference to a primary when a command is re-routed to a primary while readpreference would otherwise direct the command elsewhere:
| |||||||
| Comment by A. Jesse Jiryu Davis [ 16/Jul/15 ] | |||||||
|
It seems like the driver does not set SlaveOkay. These two wrongs make a right, when combined with a bizarre quirk in mongod. A secondary considers a query like this:
... to be the same as a query with the SlaveOkay bit set. mongos has had special handling of $readPreference since version 2.2 ( It doesn't matter what the $readPreference contains:
|