[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: |
|
||||||||||||||||||||||||||||
| 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 |
| 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. |