[SERVER-11591] "show collections" only checks the primary shard Created: 06/Nov/13  Updated: 06/Nov/13  Resolved: 06/Nov/13

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

Type: Bug Priority: Major - P3
Reporter: Joanna Cheng Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File tag_showcolls.js    
Issue Links:
Duplicate
duplicates SERVER-4232 `show collections` on mongos doesn't ... Closed
Operating System: ALL
Steps To Reproduce:

mongos> sh.enableSharding("test")
{ "ok" : 1 }
mongos> sh.shardCollection("test.foo", {_id:1})
{ "collectionsharded" : "test.foo", "ok" : 1 }
mongos> sh.addShardTag("shard0001", "a")
mongos> sh.addTagRange("test.foo", {_id: MinKey}, {_id: MaxKey}, "a")

At this point log into the mongod behind "shard0000" and delete the foo collection – there is a stub there from when you first created it.

Then if you connect back to your mongos, you can get the output as in the Description field

Participants:

 Description   

mongos> sh.status()
--- Sharding Status --- 
  sharding version: {
	"_id" : 1,
	"version" : 3,
	"minCompatibleVersion" : 3,
	"currentVersion" : 4,
	"clusterId" : ObjectId("5279b89763d68b8d4364b20c")
}
  shards:
	{  "_id" : "shard0000",  "host" : "Joannas-MacBook-Pro.local:27017" }
	{  "_id" : "shard0001",  "host" : "Joannas-MacBook-Pro.local:27018",  "tags" : [ 	"a" ] }
  databases:
	{  "_id" : "admin",  "partitioned" : false,  "primary" : "config" }
	{  "_id" : "test",  "partitioned" : true,  "primary" : "shard0000" }
		test.foo
			shard key: { "_id" : 1 }
			chunks:
				shard0001	1
			{ "_id" : { "$minKey" : 1 } } -->> { "_id" : { "$maxKey" : 1 } } on : shard0001 Timestamp(2, 0) 
			 tag: a  { "_id" : { "$minKey" : 1 } } -->> { "_id" : { "$maxKey" : 1 } }

I have a collection foo in database test, sharded, primary shard for the db is shard0000, but the collection has a tag range set so it lives on shard0001.

I can work with this collection, but it does not show up in show collections:

mongos> db.foo.save({a:1})
mongos> db.foo.find()
{ "_id" : ObjectId("5279b9e2972221f9a6cf650b"), "a" : 1 }
mongos> show collections
system.indexes
mongos> 

Turning on profiling for both mongoD's backing the shards, when issuing the show collections command I can see queries against test.system.namespaces on the primary shard

{ "op" : "query", "ns" : "test.system.namespaces", "query" : {  }, "ntoreturn" : 0, "ntoskip" : 0, "nscanned" : 2, "keyUpdates" : 0, "numYield" : 0, "lockStats" : { "timeLockedMicros" : { "r" : NumberLong(55), "w" : NumberLong(0) }, "timeAcquiringMicros" : { "r" : NumberLong(6), "w" : NumberLong(4) } }, "nreturned" : 2, "responseLength" : 123, "millis" : 0, "ts" : ISODate("2013-11-06T05:25:04.283Z"), "client" : "127.0.0.1", "allUsers" : [ ], "user" : "" }
{ "op" : "query", "ns" : "test.system.namespaces", "query" : {  }, "ntoreturn" : 0, "ntoskip" : 0, "nscanned" : 2, "keyUpdates" : 0, "numYield" : 0, "lockStats" : { "timeLockedMicros" : { "r" : NumberLong(50), "w" : NumberLong(0) }, "timeAcquiringMicros" : { "r" : NumberLong(6), "w" : NumberLong(3) } }, "nreturned" : 2, "responseLength" : 123, "millis" : 0, "ts" : ISODate("2013-11-06T05:25:05.650Z"), "client" : "127.0.0.1", "allUsers" : [ ], "user" : "" }
{ "op" : "query", "ns" : "test.system.namespaces", "query" : {  }, "ntoreturn" : 0, "ntoskip" : 0, "nscanned" : 2, "keyUpdates" : 0, "numYield" : 0, "lockStats" : { "timeLockedMicros" : { "r" : NumberLong(53), "w" : NumberLong(0) }, "timeAcquiringMicros" : { "r" : NumberLong(6), "w" : NumberLong(3) } }, "nreturned" : 2, "responseLength" : 123, "millis" : 0, "ts" : ISODate("2013-11-06T05:25:07.002Z"), "client" : "127.0.0.1", "allUsers" : [ ], "user" : "" }

But no queries on the other shard.

I have attached a jstest tag_showcolls.js



 Comments   
Comment by Scott Hernandez (Inactive) [ 06/Nov/13 ]

dup of SERVER-4232

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