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

Dropping an index named "*" is ambiguous because createIndexes permits an index to be named "*"

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 3.5.10
    • 3.5.5
    • Querying, Replication
    • None
    • Fully Compatible
    • ALL
    • Hide

      python buildscripts/resmoke.py --executor=jstestfuzz_replication repro_server29191.js
      

      repro_server29191.js

      var rst = new ReplSetTest({nodes: 2});
      rst.startSet();
      rst.initiate();
       
      var primaryDB = rst.getPrimary().getDB("test");
      var secondaryDB = rst.getSecondary().getDB("test");
       
      assert.commandWorked(primaryDB.mycoll.createIndex({x: 1}));
      assert.commandWorked(primaryDB.mycoll.createIndex({y: 1}, "*"));
      assert.commandWorked(primaryDB.mycoll.dropIndex({y: 1}));
       
      rst.awaitReplication();
       
      var indexes = primaryDB.mycoll.getIndexes();
      assert.eq(2, indexes.length, tojson(indexes));
       
      indexes = secondaryDB.mycoll.getIndexes();
      assert.eq(2, indexes.length, tojson(indexes));
       
      rst.stopSet();
      

      Show
      python buildscripts/resmoke.py --executor=jstestfuzz_replication repro_server29191.js repro_server29191.js var rst = new ReplSetTest({nodes: 2}); rst.startSet(); rst.initiate();   var primaryDB = rst.getPrimary().getDB( "test" ); var secondaryDB = rst.getSecondary().getDB( "test" );   assert.commandWorked(primaryDB.mycoll.createIndex({x: 1})); assert.commandWorked(primaryDB.mycoll.createIndex({y: 1}, "*" )); assert.commandWorked(primaryDB.mycoll.dropIndex({y: 1}));   rst.awaitReplication();   var indexes = primaryDB.mycoll.getIndexes(); assert.eq(2, indexes.length, tojson(indexes));   indexes = secondaryDB.mycoll.getIndexes(); assert.eq(2, indexes.length, tojson(indexes));   rst.stopSet();
    • Repl 2017-07-10
    • 0

    Description

      Prior to the changes from 6fd95f8 as part of SERVER-28200, the oplog entry for the "dropIndexes" command represented the index using its key pattern rather than its name. Dropping an index named "*" is interpreted by the replication subsystem as dropping all indexes and can cause the primary and secondaries not to have the same set of indexes.

      CC judah.schvimer

      Attachments

        Activity

          People

            matthew.russotto@mongodb.com Matthew Russotto
            max.hirschhorn@mongodb.com Max Hirschhorn
            Votes:
            0 Vote for this issue
            Watchers:
            12 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: