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

prevent shards from implicitly creating a collection on createIndexes

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 3.5.10
    • Fix Version/s: 3.6.0-rc0
    • Component/s: Sharding
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Backport Requested:
      v3.4
    • Sprint:
      Sharding 2017-07-31, Sharding 2017-08-21, Sharding 2017-09-11, Sharding 2017-10-02
    • Case:

      Description

      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

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              esha.maharishi Esha Maharishi
              Reporter:
              esha.maharishi Esha Maharishi
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: