[SERVER-32615] Disallow implicit collection creation for user write ops in sharded cluster Created: 09/Jan/18  Updated: 30/Oct/23  Resolved: 07/Mar/18

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

Type: Task Priority: Major - P3
Reporter: Randolph Tan Assignee: Randolph Tan
Resolution: Fixed Votes: 0
Labels: pm-1051-legacy-tickets
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: Sharding 2018-02-12, Sharding 2018-02-26, Sharding 2018-03-12
Participants:

 Description   

The “allowImplicitCollectionCreation” field on the OperationShardingState (decoration on OperationContext), which defaulted to “true” in 3.6, will now default to “false”. Only the explicit “create” command on mongod will set “allowImplicitCollectionCreation” to “true”. This means any paths on shards that would have implicitly created a collection will now throw CannotImplicitlyCreateCollection.

Shards will catch “CannotImplicitlyCreateCollection” at the same place they currently catch “StaleShardVersion.” At this point, they will send _configsvrCreateCollection to the config server (see _configsvrCreateCollection logic below). The config server will create the collection on the primary shard (most likely, the same shard that sent the _configsvrCreateCollection, though it’s possible movePrimary ran between when the shard checked mongos’s databaseVersion and when the config server took the distlock for _configsvrCreateCollection).

The shard will return the “CannotImplicitlyCreateCollection” error to mongos. This error code will be added to ErrorCodes::isStaleShardingError(), so that mongos also refreshes and retries the request.



 Comments   
Comment by Githook User [ 07/Mar/18 ]

Author:

{'email': 'randolph@10gen.com', 'name': 'Randolph Tan', 'username': 'renctan'}

Message: SERVER-32615 Make most outgoing mongos user commands that can write set implicit create flag to false
Branch: master
https://github.com/mongodb/mongo/commit/4b02c3e3ca7d377714535deeeaff24be8eb51feb

Comment by Githook User [ 23/Feb/18 ]

Author:

{'email': 'randolph@10gen.com', 'name': 'Randolph Tan', 'username': 'renctan'}

Message: SERVER-32615 Make user write commands in sharded cluster go through _configCreate
Branch: master
https://github.com/mongodb/mongo/commit/f6007fbc72791a1752edb502894e33ee831e4ace

Generated at Thu Feb 08 04:30:46 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.