[SERVER-44051] getShardDistribution() does not report "Collection XYZ is not sharded" on dropped but previously sharded collections Created: 16/Oct/19 Updated: 29/Oct/23 Resolved: 14/Apr/20 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Shell |
| Affects Version/s: | None |
| Fix Version/s: | 4.0.20, 4.2.8, 4.4.0-rc10, 4.2.9, 4.7.0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | James Kovacs | Assignee: | Kevin Pulo |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | sharding-wfbf-day | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||||||||||
| Operating System: | ALL | ||||||||||||||||||||||||
| Backport Requested: |
v4.4, v4.2, v4.0
|
||||||||||||||||||||||||
| Sprint: | Sharding 2019-10-21, Sharding 2019-11-04, Sharding 2019-11-18, Sharding 2020-04-20 | ||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||
| Case: | (copied to CRM) | ||||||||||||||||||||||||
| Linked BF Score: | 0 | ||||||||||||||||||||||||
| Description |
|
Once a sharded collection has been successfully dropped, operations on it should be identical to if it had never existed, and to if it was to be implicitly re-created as a new unsharded collection. However, after a sharded collection has been dropped, db.coll.getShardDistribution() reports the error "Unable to retrieve storageStats in $collStats stage: Collection [test.test] not found." instead of the expected message "Collection test.test is not sharded." (which is the message obtained if the collection had never previously existed, or had previously existed but unsharded). Original summary: getShardDistribution() erroneously reports "Collection XYZ is not sharded"
The stats.sharded property doesn't exist if stats contains an error message, which is why getShardDistribution() reports a collection as unsharded if its shard metadata causes the collStats command to fail. |
| Comments |
| Comment by Githook User [ 11/Jun/20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Author: {'name': 'Kevin Pulo', 'email': 'kevin.pulo@mongodb.com', 'username': 'devkev'}Message: (cherry picked from commit f32f2f906f8c37145ed2bf64cd8db99d35671a41) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Githook User [ 11/Jun/20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Author: {'name': 'Kevin Pulo', 'email': 'kevin.pulo@mongodb.com', 'username': 'devkev'}Message: (cherry picked from commit f32f2f906f8c37145ed2bf64cd8db99d35671a41) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Githook User [ 11/Jun/20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Author: {'name': 'Kevin Pulo', 'email': 'kevin.pulo@mongodb.com', 'username': 'devkev'}Message: (cherry picked from commit f32f2f906f8c37145ed2bf64cd8db99d35671a41) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Githook User [ 14/Apr/20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Author: {'name': 'Kevin Pulo', 'email': 'kevin.pulo@mongodb.com', 'username': 'devkev'}Message: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Kevin Pulo [ 09/Apr/20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
This was almost completely handled by
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Randolph Tan [ 22/Oct/19 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
collStats command is versioned, so shards should throw an error if it knows that it is in fact sharded when mongos thinks otherwise. However, because of |