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

Initial sync creates _id index even if collection does not have one

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.3.10
    • Component/s: Replication
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Backport Requested:
      v3.2
    • Steps To Reproduce:
      Hide

      var name = 'initial_sync_index_creation';
      var replSet = new ReplSetTest({
          name: name,
          nodes: 1,
      });
       
      replSet.startSet();
      replSet.initiate();
      var primary = replSet.getPrimary();
       
      primary.getDB('test').runCommand({create:'foo', autoIndexId:false})
      primary.getDB('test').foo.insert({a:1})
      assert.eq(primary.getDB('test').foo.getIndexes().length, 0);
       
      // Add a secondary node but make it hang before copying databases.
      var secondary = replSet.add();
      secondary.setSlaveOk();
      replSet.reInitiate();
      replSet.awaitSecondaryNodes(200 * 1000);
       
      assert.eq(primary.getDB('test').foo.getIndexes().length, 0);
      assert.eq(primary.getDB('test').foo.count(), 1);
      assert.eq(secondary.getDB('test').foo.count(), 1);
      assert.eq(secondary.getDB('test').foo.getIndexes().length, 0);
      

      Show
      var name = 'initial_sync_index_creation'; var replSet = new ReplSetTest({ name: name, nodes: 1, });   replSet.startSet(); replSet.initiate(); var primary = replSet.getPrimary();   primary.getDB('test').runCommand({create:'foo', autoIndexId:false}) primary.getDB('test').foo.insert({a:1}) assert.eq(primary.getDB('test').foo.getIndexes().length, 0);   // Add a secondary node but make it hang before copying databases. var secondary = replSet.add(); secondary.setSlaveOk(); replSet.reInitiate(); replSet.awaitSecondaryNodes(200 * 1000);   assert.eq(primary.getDB('test').foo.getIndexes().length, 0); assert.eq(primary.getDB('test').foo.count(), 1); assert.eq(secondary.getDB('test').foo.count(), 1); assert.eq(secondary.getDB('test').foo.getIndexes().length, 0);
    • Sprint:
      Repl 17 (07/15/16)

      Description

      If you create an index with autoIdIndex: false and then initial sync a node off of that it will still create the _id index.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              judah.schvimer Judah Schvimer
              Reporter:
              judah.schvimer Judah Schvimer
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: