Details
-
Bug
-
Resolution: Done
-
Minor - P4
-
None
-
3.1.8
-
None
-
Sharding
-
ALL
Description
if the command has a read preference setting even if they are all up.
Attached sccc.js that demonstrates this issue.
The problem appears to be coming from the _lockType helper:
https://github.com/mongodb/mongo/blob/r3.1.9/src/mongo/client/syncclusterconnection.cpp#L621
where it tries to determine if the command is a write-type command. It does this by getting the name of the command and appending the help: 1 field.
The problem comes in when there is a read preference setting and triggers the ServerSelectionMetadata::downconvert code here:
https://github.com/mongodb/mongo/blob/r3.1.9/src/mongo/client/syncclusterconnection.cpp#L253
This will result in the command being wrapped around the 'query' field; causing the _lockType helper to run the "query" command and fail. The command will fail on all 3 config servers and will ultimately make mongos return the error "all servers down/unreachable when querying".