[SERVER-3962] Trying to do slaveOk queries through mongos on a one-node replica set causes excessive calls to isMaster and replSetGetStatus Created: 27/Sep/11  Updated: 11/Jul/16  Resolved: 06/Oct/11

Status: Closed
Project: Core Server
Component/s: Performance, Replication, Sharding
Affects Version/s: 2.0.0
Fix Version/s: 2.0.1, 2.1.0

Type: Bug Priority: Major - P3
Reporter: Spencer Brody (Inactive) Assignee: Spencer Brody (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Operating System: ALL
Participants:

 Description   

If you only have one member in the replica set and try to do a slaveOk query, the mongos will look for a slave to send the query to, and when it cant find one it will call isMaster and replSetGetStatus to try and update its view of the state of the replSet to see if a secondary came online. However as long as there is only one node in the set, there is no chance of that happening. It should probably either just return the connection to the primary and log a warning, or it should throw an error and not process the query.



 Comments   
Comment by auto [ 09/Oct/11 ]

Author:

{u'login': u'dwight', u'name': u'dwight', u'email': u'dwight@10gen.com'}

Message: SERVER-3962 previous commit wasnt right. backport.
Branch: v2.0
https://github.com/mongodb/mongo/commit/41ff2157a3fa5b0d722043f4db2ec947481897fe

Comment by auto [ 09/Oct/11 ]

Author:

{u'login': u'dwight', u'name': u'dwight', u'email': u'dwight@10gen.com'}

Message: finish SERVER-3962
Branch: v2.0
https://github.com/mongodb/mongo/commit/a7796c9c09b1868bf72a28811059d448995e501c

Comment by auto [ 09/Oct/11 ]

Author:

{u'login': u'dwight', u'name': u'dwight', u'email': u'dwight@10gen.com'}

Message: SERVER-3962 very high extraneous ismaster type commands from mongos to repl set if slaveok and no pure secondary is up
Branch: v2.0
https://github.com/mongodb/mongo/commit/8814b71b260805dd6afc0cea13acce37cf328e15

Comment by auto [ 29/Sep/11 ]

Author:

{u'login': u'dwight', u'name': u'dwight', u'email': u'dwight@10gen.com'}

Message: SERVER-3962 previous commit wasnt right. backport.
Branch: master
https://github.com/mongodb/mongo/commit/a18dcc76ff649274799f5cbdb008fa023f49bcb3

Comment by auto [ 28/Sep/11 ]

Author:

{u'login': u'dwight', u'name': u'dwight', u'email': u'dwight@10gen.com'}

Message: finish SERVER-3962
Branch: master
https://github.com/mongodb/mongo/commit/77a43260c11679209f677efe30828aafc50b3e30

Comment by auto [ 28/Sep/11 ]

Author:

{u'login': u'dwight', u'name': u'dwight', u'email': u'dwight@10gen.com'}

Message: SERVER-3962 very high extraneous ismaster type commands from mongos to repl set if slaveok and no pure secondary is up
Branch: master
https://github.com/mongodb/mongo/commit/19058fad75e1136e32b86936e496fb000bec1089

Comment by Spencer Brody (Inactive) [ 27/Sep/11 ]

The relevant code is in the getSlave() method in dbclient_rs.cpp. If it can't find a secondary connection to return, it calls check(false), which calls _checkConnection which ultimately leads to the calls to isMaster and replSetGetStatus.

Generated at Thu Feb 08 03:04:33 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.