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

2.6 secondaries abort when replicated index spec contains a dollar-sign field

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Major - P3 Major - P3
    • None
    • 2.6.0-rc2
    • Index Maintenance
    • ALL
    • Hide

      var replSet = new ReplSetTest({
          name: 'mixedVersionIndexes',
          nodes: 3,
          nodeOptions: {
              smallfiles: '',
              binVersion: MongoRunner.versionIterator(['2.4', '2.6'])
          }
      });
       
      replSet.startSet();
      replSet.initiate();
      replSet.awaitSecondaryNodes();
       
      // make a 2.4 node the primary
      assert.soon(function() {
          var primary = replSet.getPrimary();
       
          if (primary.getDB('admin').version().startsWith('2.4') === false) {
              try {
                  primary.getDB('admin').runCommand({replSetStepDown: 60});
              } catch(e) {
                  jsTest.log(e);
              }
              return false;
          }
       
          return true;
      }, 'failed to elect 2.4 node as primary', 60000, 30000);
       
      // create an invalid 2.6 index on the 2.4 primary
      var coll = replSet.getPrimary().getDB('foo').bar;
      coll.ensureIndex({$foo:1});
       
      replSet.awaitReplication();
       
      jsTest.log('available nodes:\n' + tojson(replSet.liveNodes));

      Show
      var replSet = new ReplSetTest({ name: 'mixedVersionIndexes', nodes: 3, nodeOptions: { smallfiles: '', binVersion: MongoRunner.versionIterator(['2.4', '2.6']) } });   replSet.startSet(); replSet.initiate(); replSet.awaitSecondaryNodes();   // make a 2.4 node the primary assert.soon(function() { var primary = replSet.getPrimary();   if (primary.getDB('admin').version().startsWith('2.4') === false) { try { primary.getDB('admin').runCommand({replSetStepDown: 60}); } catch(e) { jsTest.log(e); } return false; }   return true; }, 'failed to elect 2.4 node as primary', 60000, 30000);   // create an invalid 2.6 index on the 2.4 primary var coll = replSet.getPrimary().getDB('foo').bar; coll.ensureIndex({$foo:1});   replSet.awaitReplication();   jsTest.log('available nodes:\n' + tojson(replSet.liveNodes));

    Description

      A 2.6 secondary will abort if a replicated index spec contains a field with a dollar sign. This bug is similar to SERVER-13206, which had a fairly narrow fix and may be missing other CannotCreateIndex scenarios.

      Output on secondaries:

       m31000| 2014-03-28T15:20:27.384-0400 [repl writer worker 1] ERROR: writer worker caught exception:  :: caused by :: 67 bad index key pattern { $foo: 1.0 }: Index key contains an illegal field name: field name starts with '$'. on: { ts: Timestamp 1396034426000|1, h: -8749786978335064046, v: 2, op: "i", ns: "foo.system.indexes", o: { _id: ObjectId('5335cb7ad7a2aa0c289a8882'), ns: "foo.bar", key: { $foo: 1.0 }, name: "$foo_1" } }
       m31000| 2014-03-28T15:20:27.384-0400 [repl writer worker 1] Fatal Assertion 16360
       m31000| 2014-03-28T15:20:27.384-0400 [repl writer worker 1] 
       m31000| 
       m31000| ***aborting after fassert() failure
       m31000| 


      Version: 6412fa7eca5c834f29490ab6cdd1cb13b3d99c97

      Attachments

        Activity

          People

            Unassigned Unassigned
            kamran.khan Kamran K.
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: