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

Make createIndex a no-op on a cluster key if the collection exists

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 5.3.0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
    • Fully Compatible
    • Execution Team 2021-11-15, Execution Team 2021-11-29, Execution Team 2021-12-13, Execution Team 2021-12-27
    • 15

      createIndex( { key: <clusterKey>, 'clustered': true}) should behave as follows
      (1) no-op if the collection is already clustered by 'cluster key'
      (2) implicitly create the collection on clusterKey provided the collection does not yet exist.
      (3) Throw if the collection is already clustered, but not on the clusterKey provided in the command

      Old Description:
      There are several places in the code where listIndexes results are assumed to be standard indexes (non-clustered).

      Since the 'clustered' index for a clustered collection is also outputted in listIndexes, we want to prevent trying to build it / handle it as a standard index.

      eg) SERVER-60979

            haley.connelly@mongodb.com Haley Connelly
            haley.connelly@mongodb.com Haley Connelly
            0 Vote for this issue
            3 Start watching this issue