-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 2.4.5
-
Component/s: Replication
-
None
-
Minor Change
-
ALL
ISSUE SUMMARY
Indexes cannot be created on the internal system.indexes collection. Attempting to build an index on this collection responds with an error (code 13143), but still inserts a corresponding entry into the system.indexes collection. Secondary nodes that attempt to initial sync from a node with such an entry fail to create the index and abort the initial sync (after several retries).
USER IMPACT
This mostly affects users that create indexes dynamically on all collections and do not explicitly exclude the system.indexes collection. Furthermore, the error may not be noticed for some time, as the invalid index has no immediate effect on a replica set but only affects initial sync of a secondary.
SOLUTION
The fix is to explicitly check and throw an assertion if an index build on system.indexes is attempted. This assertion aborts the index build before the entry is inserted into the system.indexes collection.
WORKAROUNDS
Users should not build an index on the system.indexes collection. In environments with dynamic index creation, one should take precautionary steps to explicitly check and avoid building an index on system.indexes. To remove any accidentally-created index entries on system.indexes, use the following command: db.system.indexes.dropIndexes()
AFFECTED VERSIONS
All recent production releases up to version 2.4.9 are affected.
PATCHES
The fix is included in the 2.4.10 production release and the 2.5.3 development version, which will evolve into the 2.6.0 production release.
Original Description
It claims it isn't allowed, but it still gets inserted into system.indexes without actually creating the index.
> use breakMyDb switched to db breakMyDb > db.system.indexes.ensureIndex({_id:1}, {unique:true}) { "err" : "can't create index on system.indexes", "code" : 13143, "n" : 0, "connectionId" : 1, "ok" : 1 } > db.system.indexes.find() { "v" : 1, "key" : { "_id" : 1 }, "ns" : "breakMyDb.system.indexes", "name" : "_id_" }
- is related to
-
SERVER-14999 db.system.indexes.dropIndexes() crashes mongod
- Closed
- related to
-
SERVER-10230 Shouldn't be possible to create indexes on system.namespaces
- Closed