[SERVER-31511] AllowPartialResults not working when sharded cluster is backed by replica set Created: 11/Oct/17 Updated: 08/Jan/24 Resolved: 02/Oct/19 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying, Sharding |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | John Gibbons | Assignee: | Backlog - Query Team (Inactive) |
| Resolution: | Duplicate | Votes: | 3 |
| Labels: | former-quick-wins, query-44-grooming | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Assigned Teams: |
Query
|
||||||||||||
| Operating System: | ALL | ||||||||||||
| Participants: | |||||||||||||
| Case: | (copied to CRM) | ||||||||||||
| Description |
|
The AllowPartialResults cursor method (DBQuery.Option.partial) does not have the desired effect when a shard backed by a REPLICA SET becomes unavailable. In first example below I have set up a sharded cluster where each shard is backed by a single MONGOD. AllowPartialResults works as expected - if I kill on MONGOD I get results back from the other MONGOD. In the second example below, I have set up exact same cluster except I have backed each shard with a [single mongod] replica set. AllowPartialResults now does not work, in the sense that if I kill the mongod that forms the replica set, the db.collection.find().allowPartialResults() fails reporting an error saying "could not find host matching read preference { mode: \"primary\", tags: [ {} ] } for set shard1". |
| Comments |
| Comment by Esha Maharishi (Inactive) [ 02/Oct/19 ] | |||||||||||||||||||||||||||||||||||
|
This was fixed (establishCursors was made to swallow FailedToSatisfyReadPreference errors from trying to find a particular host within a targeted shard) under | |||||||||||||||||||||||||||||||||||
| Comment by Ramon Fernandez Marina [ 16/Nov/18 ] | |||||||||||||||||||||||||||||||||||
|
Thanks for your report jg1 – this ticket has been sent to the Query team for evaluation. We'll post updates to the ticket as we find out more details about what's causing this behavior. Regards, | |||||||||||||||||||||||||||||||||||
| Comment by John Gibbons [ 11/Oct/17 ] | |||||||||||||||||||||||||||||||||||
|
I suspect the issue arises because the query does not get sent at all. Rather, the ReplicaSetMonitor (replica_set_monitor.cpp) fails in getHostOrRefresh (or possibly async_requests_sender.cpp) fails to connect to replica set before even the find gets sent. | |||||||||||||||||||||||||||||||||||
| Comment by John Gibbons [ 11/Oct/17 ] | |||||||||||||||||||||||||||||||||||
|
THIS ONE PRETTY MUCH SAME EXCEPT SETS UP 2 SHARDS BACKED BY [single mongod] REPLICA SETS. partial DOES NOT HAVE DESIRED EFFECT IF ONE MONGOD KILLED.
[mongod@BLAH PartialTest2]$ mongo localhost:40002/partial --quiet --eval 'db.test.find()' { "_id" : ObjectId("59dcc375f955bba2a5b15850"), "key" : "B" } { "_id" : ObjectId("59dcc375f90654100e5edb0e"), "key" : "Y" }[mongod@BLAH PartialTest2]$ mongo localhost:40002/partial --quiet --eval 'db.test.find().addOption(DBQuery.Option.partial)' { "_id" : ObjectId("59dcc375f955bba2a5b15850"), "key" : "B" } { "_id" : ObjectId("59dcc375f90654100e5edb0e"), "key" : "Y" }[mongod@BLAH PartialTest2]$ kill -2 $(pgrep -a mongo | grep "40011" | awk ' {print $1}') [mongod@BLAHPartialTest2]$ mongo localhost:40002/partial --quiet --eval 'db.test.find().addOption(DBQuery.Option.partial)' Error: error: { "ok" : 0, "errmsg" : "could not find host matching read preference { mode: \"primary\", tags: [ {} ] } for set shard1", "code" : 133, "codeName" : "FailedToSatisfyReadPreference" } | |||||||||||||||||||||||||||||||||||
| Comment by John Gibbons [ 11/Oct/17 ] | |||||||||||||||||||||||||||||||||||
|
THIS ONE SETS UP 2 SHARDS BACKED DIRECTLY BY SINGLE MONGODS
Results: mongos> exit bye [mongod@BLAH PartialTest]$ kill -2 $(pgrep -a mongo | grep "30011" | awk ' {print $1}') [mongod@BLAH PartialTest]$ mongo localhost:30002/partial --quiet --eval 'db.test.find().addOption(DBQuery.Option.partial)' #should return 1 { "_id" : ObjectId("59dcb0f37950b2dc5ff66fd5"), "key" : "Y" }[mongod@BLAH PartialTest]$ mongo localhost:30002/partial --quiet --eval 'db.test.find()' #should error because no partial Error: error: { "ok" : 0, "errmsg" : "Connection refused", "code" : 6, "codeName" : "HostUnreachable" } |