[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: |
|
||||
| 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: |
| Comment by auto [ 09/Oct/11 ] |
|
Author: {u'login': u'dwight', u'name': u'dwight', u'email': u'dwight@10gen.com'}Message: finish |
| Comment by auto [ 09/Oct/11 ] |
|
Author: {u'login': u'dwight', u'name': u'dwight', u'email': u'dwight@10gen.com'}Message: |
| Comment by auto [ 29/Sep/11 ] |
|
Author: {u'login': u'dwight', u'name': u'dwight', u'email': u'dwight@10gen.com'}Message: |
| Comment by auto [ 28/Sep/11 ] |
|
Author: {u'login': u'dwight', u'name': u'dwight', u'email': u'dwight@10gen.com'}Message: finish |
| Comment by auto [ 28/Sep/11 ] |
|
Author: {u'login': u'dwight', u'name': u'dwight', u'email': u'dwight@10gen.com'}Message: |
| 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. |