[SERVER-30403] NotAllowedOnShardedCollectionCmd should be versioned Created: 28/Jul/17 Updated: 30/Oct/23 Resolved: 23/Aug/17 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Sharding |
| Affects Version/s: | 3.5.10 |
| Fix Version/s: | 3.5.13 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Esha Maharishi (Inactive) | Assignee: | Hugh Han |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Backwards Compatibility: | Fully Compatible |
| Operating System: | ALL |
| Sprint: | Sharding 2017-08-21, Sharding 2017-09-11 |
| Participants: |
| Description |
|
Despite intending to prevent commands that extend it from running on sharded collections, NotAllowedOnShardedCollectionCmd can run concurrently (i.e. race) with shardCollection. To counter this, it should take the same (dist)lock as shardCollection. Particularly, this will prevent convertToCapped (which, notably, changes the collection's UUID because it uses cloneCollectionAsCapped (which creates a cloned collection with a different UUID) + renameCollection under the hood) and group from running on sharded collections. |
| Comments |
| Comment by Ramon Fernandez Marina [ 24/Aug/17 ] |
|
Author: {'username': u'hughhan1', 'name': u'Hugh Han', 'email': u'hughhan1@gmail.com'}Message: |
| Comment by Hugh Han [ 16/Aug/17 ] |
|
Commenting as a note that we should solve this by making requests forwarded by NotAllowedOnShardedCollectionCmd versioned, as opposed to having it take a distributed lock. A distributed lock would in fact not work if we were to have two mongos nodes, the first of which successfully shards a collection, and the second of which tries to run a NotAllowedOnShardedCollectionCmd after the collection becomes sharded but before it realizes that the collection is sharded. Because mongos currently checks whether a collection is sharded by looking at its ChunkManager, the second mongos could still send NotAllowedOnShardedCollectionCmd to sharded collections. Hence, we should attach ChunkVersion::UNSHARDED(). |
| Comment by Esha Maharishi (Inactive) [ 14/Aug/17 ] |
|
Another way to do this might just be to make the requests forwarded by NotAllowedOnShardedCollectionCmd versioned (i.e., attach ChunkVersion::UNSHARDED()). |