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

prevent shards from implicitly creating a collection on createIndexes

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.6.0-rc0
    • Affects Version/s: 3.5.10
    • Component/s: Sharding
    • None
    • Fully Compatible
    • v3.4
    • Sharding 2017-07-31, Sharding 2017-08-21, Sharding 2017-09-11, Sharding 2017-10-02

      createIndexes on mongos is currently broadcast to all shards rather than only targeting shards which own data for the collection, since listIndexes expects the primary shard to have all the indexes for the collection (and the primary shard might not own any chunks for the collection at some particular time) (SERVER-16273).

      However, this means the collection is implicitly created on shards which don't own chunks for the collection AND don't have an entry for the collection in their storage engine (e.g., any shard that has never owned chunks for the collection). The collection is implicitly created on these shards without the collection options, including the collection's UUID.

      To prevent this,

      1) mongods running as --shardsvr should fail createIndexes with NamespaceNotFound rather than implicitly create the collection with the wrong options
      2) for createIndexes on a sharded collection, mongos should ignore NamespaceNotFound errors from shards
      3) for createIndexes on an unsharded collection, mongos should check if the collection exists on the primary shard, and explicitly create it if not before sending createIndexes to the primary shard

            Assignee:
            esha.maharishi@mongodb.com Esha Maharishi (Inactive)
            Reporter:
            esha.maharishi@mongodb.com Esha Maharishi (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: