-
Type: Bug
-
Resolution: Done
-
Priority: Blocker - P1
-
Affects Version/s: 2.0.5
-
Component/s: Sharded Cluster
-
None
-
Environment:OS X Mavericks
We host our database with ObjectRocket, which gives us a single connection string to our database. They use a load balancer in front of multiple mongoS's. The driver thinks this is a single topology and therefore always sends queries with slave_ok. For example, here's a connection to a 30 shard cluster:
2.2.1 :002 > c = Mongo::Client.new(['iad-mongos3.objectrocket.com:XXX'], :database => 'XXX', :user => 'XXX', :password => 'XXX') D, [2015-06-19T16:19:27.933053 #31436] DEBUG -- : MONGODB | Adding iad-mongos3.objectrocket.com:XXX to the cluster. | runtime: 0.0410ms D, [2015-06-19T16:19:27.976995 #31436] DEBUG -- : MONGODB | COMMAND | namespace=admin.$cmd selector={:ismaster=>1} flags=[] limit=-1 skip=0 project=nil | runtime: 43.7379ms => #<Mongo::Client:0x70197300834160 cluster=iad-mongos3.objectrocket.com:XXX> 2.2.1 :003 > c.database[:apps].find({}).count D, [2015-06-19T16:19:31.620223 #31436] DEBUG -- : MONGODB | COMMAND | namespace=XXX.$cmd selector={:getnonce=>1} flags=[] limit=-1 skip=0 project=nil | runtime: 10.2561ms D, [2015-06-19T16:19:31.631823 #31436] DEBUG -- : MONGODB | COMMAND | namespace=XXX.$cmd selector={:authenticate=>1, :user=>"XXX", :nonce=>"XXX", :key=>"XXX"} flags=[] limit=-1 skip=0 project=nil | runtime: 11.3409ms D, [2015-06-19T16:19:31.642889 #31436] DEBUG -- : MONGODB | COMMAND | namespace=XXX.$cmd selector={:count=>"apps", :query=>{}} flags=[:slave_ok] limit=-1 skip=0 project=nil | runtime: 43.0880ms
You can see that slave_ok is passed in the query. If I create my client with :connect => :sharded, then the slave_ok is not sent.