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

createIndexes should confirm that index options are valid in respect to the underlying collection

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major - P3
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 4.5 Required
    • Component/s: Indexing
    • Labels:
      None
    • Operating System:
      ALL
    • Steps To Reproduce:
      Hide

      > db.createCollection("test", {capped:true, size: 102400})
      { "ok" : 1 }
      > db.test.ensureIndex({foo:1}, {expireAfterSeconds: 10})
      {
              "createdCollectionAutomatically" : false,
              "numIndexesBefore" : 1,
              "numIndexesAfter" : 2,
              "ok" : 1
      }
      > db.test.insert({foo:new Date()})
      WriteResult({ "nInserted" : 1 })
      

      2016-01-19T18:17:11.210+1100 I STORAGE  [TTLMonitor] failing remove on a capped ns test.test
      2016-01-19T18:17:11.210+1100 E INDEX    [TTLMonitor] Error processing ttl index: { v: 1, key: { foo: 1.0 }, name: "foo_1", ns: "test.test", expireAfterSeconds: 10.0 } -- 10089 cannot remove from a capped collection
      

      Show
      > db.createCollection("test", {capped:true, size: 102400}) { "ok" : 1 } > db.test.ensureIndex({foo:1}, {expireAfterSeconds: 10}) { "createdCollectionAutomatically" : false, "numIndexesBefore" : 1, "numIndexesAfter" : 2, "ok" : 1 } > db.test.insert({foo:new Date()}) WriteResult({ "nInserted" : 1 }) 2016-01-19T18:17:11.210+1100 I STORAGE [TTLMonitor] failing remove on a capped ns test.test 2016-01-19T18:17:11.210+1100 E INDEX [TTLMonitor] Error processing ttl index: { v: 1, key: { foo: 1.0 }, name: "foo_1", ns: "test.test", expireAfterSeconds: 10.0 } -- 10089 cannot remove from a capped collection

      Description

      As reported in SERVER-769, it is possible to create a TTL index on a capped collection. This results in failed TTL document deletion once expiration is hit.

      We should audit which index options are invalid for specific collection options and add validation so that createIndexes will fail if specified.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              backlog-server-execution Backlog - Execution Team
              Reporter:
              james.wahlin James Wahlin
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated: