[SERVER-4232] `show collections` on mongos doesn't include sharded collections which are not present on the primary shard Created: 08/Nov/11  Updated: 06/Dec/22  Resolved: 08/Mar/18

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

Type: Bug Priority: Minor - P4
Reporter: Greg Studer Assignee: [DO NOT USE] Backlog - Sharding Team
Resolution: Duplicate Votes: 5
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Duplicate
duplicates SERVER-32847 Make copyDb transfer over UUIDs when ... Closed
duplicates SERVER-33514 send dbVersion on listCollections and... Closed
is duplicated by SERVER-11591 "show collections" only checks the pr... Closed
Related
related to SERVER-15213 MongoS concurrency problem with dropD... Closed
Assigned Teams:
Sharding
Operating System: ALL
Participants:

 Description   

See title.



 Comments   
Comment by Asya Kamsky [ 23/Apr/18 ]

Figured it out. It's not sufficient for the collection not to have any chunks on the primary shard to be omitted from results of show collections. It looks like there has to be a "movePrimary" command done then to another shard that has no chunks for the collections, then the collection is missing from show collections.

#delayedComment (confirmed empirically what Esha had already posted)

Comment by Esha Maharishi (Inactive) [ 19/Apr/18 ]

Note that pre-4.0, it could also arise if movePrimary had been called to a shard that never owned chunks for the sharded collection, because as Kal said, movePrimary did not transfer the collection definitions + indexes for sharded collections.

Comment by Kaloian Manassiev [ 19/Apr/18 ]

This is correct. Manually deleting an empty collection by connecting to the shard primary or (like you suggested in person) moving a primary to a shard which has never seen chunks for a particular sharded collection.

This has been fixed in 4.0 where movePrimary will copy the definitions (options, indexes, etc) for all collections under that database, regardless of whether they are sharded or not, so the primary would be authoritative for listCollections.

Comment by Asya Kamsky [ 19/Apr/18 ]

kaloian.manassiev what does manually deleted include? Not moving chunk away, I assume but something like doing drop collection on primary mongod directly?

Comment by Esha Maharishi (Inactive) [ 08/Mar/18 ]

Closing as duplicate of SERVER-33514, which will cause listCollections to start sending dbVersion so that it gets re-routed to the new primary shard if the primary shard has changed, and SERVER-32847, which will ensure the collection options and indexes are copied for sharded collections on movePrimary.

Comment by Kaloian Manassiev [ 13/Nov/17 ]

For the record, currently this situation can only arise if the sharded collection's part on the primary shard are manually deleted, so it is not a problem in practice.

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