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 "*"

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.5.10
    • Affects Version/s: 3.5.5
    • Component/s: 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

      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

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

              Created:
              Updated:
              Resolved: