[SERVER-8814] Inserts into any namespace ending in ".system.indexes" are treated like inserts into "system.indexes" and actually build indexes. Created: 01/Mar/13  Updated: 11/Jul/16  Resolved: 01/Mar/13

Status: Closed
Project: Core Server
Component/s: Index Maintenance
Affects Version/s: 2.2.3, 2.4.0-rc1
Fix Version/s: 2.4.0-rc2

Type: Bug Priority: Major - P3
Reporter: Spencer Brody (Inactive) Assignee: Spencer Brody (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-8802 readWrite users can delete privilege ... Closed
Related
is related to SERVER-16751 Use prefix matching to detect system ... Closed
is related to SERVER-8816 Audit all uses of strstr in the code Closed
Backwards Compatibility: Minor Change
Operating System: ALL
Participants:

 Description   

> db.dropDatabase()
{ "dropped": "test", "ok": 1 }
test[13:4:8]> db.foo.insert({a:1})
Inserted 1 record(s) in 1057ms
test[13:4:14]> db.system.indexes.find()
{ "v": 1, "key": { "_id": 1 }, "ns": "test.foo", "name": "_id_" }
Fetched 1 record(s) in 1ms
test[13:4:21]> db.foo.find({a:1}).explain()
{
        "cursor": "BasicCursor",
        "isMultiKey": false,
        "n": 1,
        "nscannedObjects": 1,
        "nscanned": 1,
        "nscannedObjectsAllPlans": 1,
        "nscannedAllPlans": 1,
        "scanAndOrder": false,
        "indexOnly": false,
        "nYields": 0,
        "nChunkSkips": 0,
        "millis": 0,
        "indexBounds": {
 
        },
        "server": "ubuntu:54321"
}
test[13:4:27]> db.randomNS.system.indexes.insert({ns:"test.foo", key:{a:1}, name:"a_1"});
Inserted 1 record(s) in 1ms
test[13:4:41]> db.system.indexes.find()
{ "v": 1, "key": { "_id": 1 }, "ns": "test.foo", "name": "_id_" }
Fetched 1 record(s) in 1ms
test[13:4:55]> db.randomNS.system.indexes.find()
{ "v": 1, "key": { "a": 1 }, "ns": "test.foo", "name": "a_1" }
Fetched 1 record(s) in 1ms
test[13:5:3]> db.system.namespaces.find()
{ "name": "test.system.indexes" }
{ "name": "test.foo.$_id_" }
{ "name": "test.foo" }
{ "name": "test.randonNS.system.indexes" }
{ "name": "test.foo.$a_1" }
Fetched 5 record(s) in 1ms
test[13:5:10]> db.foo.find({a:1}).explain()
{
        "cursor": "BtreeCursor a_1",
        "isMultiKey": false,
        "n": 1,
        "nscannedObjects": 1,
        "nscanned": 1,
        "nscannedObjectsAllPlans": 1,
        "nscannedAllPlans": 1,
        "scanAndOrder": false,
        "indexOnly": false,
        "nYields": 0,
        "nChunkSkips": 0,
        "millis": 0,
        "indexBounds": {
                "a": [
                        [
                                1,
                                1
                        ]
                ]
        },
        "server": "ubuntu:54321"
}



 Comments   
Comment by auto [ 02/Mar/13 ]

Author:

{u'date': u'2013-03-02T13:51:46Z', u'name': u'Tad Marshall', u'email': u'tad@10gen.com'}

Message: SERVER-8814 SERVER-8802 Do not change 'db' in test

Do not change the 'db' variable in indexOtherNamespace.js. When run as part
of sharding_passthrough.js, this breaks downstream tests (rename.js was one).
Branch: master
https://github.com/mongodb/mongo/commit/c8fea053358994f98cd8e4112ae90e90ce207d9a

Comment by auto [ 01/Mar/13 ]

Author:

{u'date': u'2013-03-01T19:01:34Z', u'name': u'Spencer T Brody', u'email': u'spencer@10gen.com'}

Message: SERVER-8802 SERVER-8814 Don't build indexes from inserts into collection names ending in ".system.indexes"
Branch: master
https://github.com/mongodb/mongo/commit/28c49b3882ccca72971270fcebc438c593aa6ede

Generated at Thu Feb 08 03:18:31 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.