[SERVER-2125] unable to do show collections on slaves Created: 20/Nov/10  Updated: 30/Mar/12  Resolved: 20/Nov/10

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 1.6.3
Fix Version/s: None

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

Operating System: ALL
Participants:

 Description   

> rs.status()
{
"set" : "lp",
"date" : "Fri Nov 19 2010 16:31:19 GMT-0800 (PST)",
"myState" : 1,
"members" : [

{ "_id" : 0, "name" : "stage1.vpc3.estalea.net:4101", "health" : 1, "state" : 1, "self" : true }

,

{ "_id" : 1, "name" : "stage1.vpc3.estalea.net:4102", "health" : 1, "state" : 2, "uptime" : 1357, "lastHeartbeat" : "Fri Nov 19 2010 16:31:18 GMT-0800 (PST)" }

,

{ "_id" : 2, "name" : "stage1.vpc3.estalea.net:4103", "health" : 1, "state" : 2, "uptime" : 1235, "lastHeartbeat" : "Fri Nov 19 2010 16:31:17 GMT-0800 (PST)" }

],
"ok" : 1
}

> show dbs
admin
local
lp
mortgage
mortgagecache
purchase
refinance
refinancecash
> use lp
switched to db lp
> show collections
Fri Nov 19 16:35:58 uncaught exception: error:

{ "$err" : "not master", "code" : 10107 }

 Comments   
Comment by Joseph Wang [ 20/Nov/10 ]

Strange, I was able to do now. Please close the bug. Thank you.

[joseph.wang@stage1.vpc3 ~]$ /usr/local/mongodb-linux-x86_64-1.6.3/bin/mongo localhost:4102
MongoDB shell version: 1.6.3
connecting to: localhost:4103/test
> rs.slaveOk()
> use mortgage
switched to db mortgage
> show collections;
mortgage.armattributes
mortgage.armindex
mortgage.investorlender
mortgage.lenderfees
mortgage.lenderinfos
mortgage.ratedataupdate
mortgage.sellersubid
mortgage.srptable
system.indexes

Comment by Joseph Wang [ 20/Nov/10 ]

Doesn't work

[joseph.wang@stage1.vpc3 logs]$ /usr/local/mongodb-linux-x86_64-1.6.3/bin/mongo localhost:4101
MongoDB shell version: 1.6.3
connecting to: localhost:4101/test
> rs.slaveOk()
> rs.status()
{
"set" : "lp",
"date" : "Fri Nov 19 2010 16:42:49 GMT-0800 (PST)",
"myState" : 1,
"members" : [

{ "_id" : 0, "name" : "stage1.vpc3.estalea.net:4101", "health" : 1, "state" : 1, "self" : true }

,

{ "_id" : 1, "name" : "stage1.vpc3.estalea.net:4102", "health" : 1, "state" : 2, "uptime" : 2047, "lastHeartbeat" : "Fri Nov 19 2010 16:42:48 GMT-0800 (PST)" }

,

{ "_id" : 2, "name" : "stage1.vpc3.estalea.net:4103", "health" : 1, "state" : 2, "uptime" : 1925, "lastHeartbeat" : "Fri Nov 19 2010 16:42:48 GMT-0800 (PST)" }

],
"ok" : 1
}

[joseph.wang@stage1.vpc3 logs]$ /usr/local/mongodb-linux-x86_64-1.6.3/bin/mongo localhost:4102
MongoDB shell version: 1.6.3
connecting to: localhost:4102/test
> show dbs;
admin
local
lp
mortgage
mortgagecache
purchase
refinance
refinancecash
> use mortgage
switched to db mortgage
> show collections
Fri Nov 19 16:43:43 uncaught exception: error:

{ "$err" : "not master", "code" : 10107 }
Comment by Eliot Horowitz (Inactive) [ 20/Nov/10 ]

Some ops may now be allowed.
Not something we would backport though

Comment by Eliot Horowitz (Inactive) [ 20/Nov/10 ]

You need to do:

rs.slaveOk() shorthand for db.getMongo().setSlaveOk()

Comment by Joseph Wang [ 20/Nov/10 ]

1.7.2 doesn't have this issue.

[root@ip-10-166-59-166 ~]# mongodb-linux-x86_64-1.7.2/bin/mongo localhost:20000
MongoDB shell version: 1.7.2
connecting to: localhost:20000/test
> show dbs;
admin (empty)
local 6.2001953125GB
lp 5.951171875GB
mortagecache (empty)
mortgage 1.953125GB
mortgagecache 0.203125GB
purchase 1.953125GB
refinance 1.953125GB
refinancecash 0.953125GB
> use mortgage
switched to db mortgage
> show collections
mortgage.armattributes
mortgage.armindex
mortgage.investorlender
mortgage.lenderfees
mortgage.lenderinfos
mortgage.ratedataupdate
mortgage.sellersubid
mortgage.srptable
system.indexes

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