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

autoIndexId cannot be false when createCollection

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Duplicate
    • Affects Version/s: 3.0.9, 3.2.3
    • Fix Version/s: None
    • Component/s: Internal Code
    • Labels:
      None
    • Operating System:
      ALL
    • Steps To Reproduce:
      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

      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)

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: