Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-32615

Disallow implicit collection creation for user write ops in sharded cluster

    XMLWordPrintable

Details

    • Fully Compatible
    • Sharding 2018-02-12, Sharding 2018-02-26, Sharding 2018-03-12

    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.

      Attachments

        Activity

          People

            randolph@mongodb.com Randolph Tan
            randolph@mongodb.com Randolph Tan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: