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

autoIndexId cannot be false when createCollection

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.0.9, 3.2.3
    • Component/s: Internal Code
    • None
    • ALL
    • Hide

      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

      Show
      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

      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)

            Assignee:
            ramon.fernandez@mongodb.com Ramon Fernandez Marina
            Reporter:
            zyd_com@126.com Zhang Youdong
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: