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

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • 3.3.10
    • Replication
    • None
    • Fully Compatible
    • ALL
    • v3.2
    • 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);
    • 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

              judah.schvimer@mongodb.com Judah Schvimer
              judah.schvimer@mongodb.com Judah Schvimer
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: