[SERVER-22902] autoIndexId cannot be false when createCollection Created: 01/Mar/16  Updated: 15/Nov/21  Resolved: 03/Mar/16

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: 3.0.9, 3.2.3
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Zhang Youdong Assignee: Ramon Fernandez Marina
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-8237 autoIndexId:false should be disabled Closed
Operating System: ALL
Steps To Reproduce:

In a replicaset, create a collection

db.createCollecion("test", {autoIndexId: false});

then insert documents to collection

for (var i = 0; i < 100000; i++) {
    db.test.insert({x: i})
}

monitor the cpu usage on secondary node

Participants:

 Description   

In my environment(Replica set), when I create collection with { autoIndexId : false}. After insert happened in primary, the secondary bares very high load to replay the oplog, becaure secondary need to do an upsert based on _id field which need a full COLLSCAN without id index.

In MongoDB's docuentment(https://docs.mongodb.org/manual/reference/command/create/#dbcmd.create), a tips said:

IMPORTANT
For replica sets, all collections must have autoIndexId set to true.

but MongoDB did allow autoIndexId option set to false in Replica Set, it's unreasonable, so I suggest the fix this issue, forbid autoIndexId set to false when createCollection in all cases. (because single instance may change to replica set in the future)



 Comments   
Comment by Ramon Fernandez Marina [ 03/Mar/16 ]

Thanks for the pull request zyd_com. There's already a ticket to remove autoIndexId:false altogether, not only on replica sets: SERVER-8237. I'm going to mark this ticket as a duplicate and link your pull request to that ticket.

Cheers,
Ramón.

Comment by Zhang Youdong [ 01/Mar/16 ]

see https://github.com/mongodb/mongo/pull/1071

Generated at Thu Feb 08 04:01:45 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.