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

cleanupOrphaned doesn't verify startingFromKey matches shard key spec

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor - P4 Minor - P4
    • 2.5.4
    • 2.5.2
    • Sharding
    • None
    • ALL
    • Hide

      var st = new ShardingTest({
          other: {
              rs: true,
              rsOptions: {nodes: 2}
          }
      });
       
      var mongos = st.s0;
      var coll = mongos.getCollection('foo.bar');
      var shardAdmin = st.shard0.getDB('admin');
       
      mongosAdmin.runCommand({
          enableSharding: coll.getDB().getName()
      });
       
      mongosAdmin.runCommand({
          shardCollection: coll.getFullName(),
          key: {_id: 1}
      });
       
      // Doesn't match number of keys.
      assert.commandFailed(shardAdmin.runCommand({
          cleanupOrphaned: coll.getFullName(),
          startingFromKey: {someKey: 'someValue', someOtherKey: 1}
      }));
       
      // Matches number of keys but not key name. This will succeed but should fail.
      assert.commandFailed(shardAdmin.runCommand({
          cleanupOrphaned: coll.getFullName(),
          startingFromKey: {someKey: 'someValue'}
      }));

      Show
      var st = new ShardingTest({ other: { rs: true, rsOptions: {nodes: 2} } });   var mongos = st.s0; var coll = mongos.getCollection('foo.bar'); var shardAdmin = st.shard0.getDB('admin');   mongosAdmin.runCommand({ enableSharding: coll.getDB().getName() });   mongosAdmin.runCommand({ shardCollection: coll.getFullName(), key: {_id: 1} });   // Doesn't match number of keys. assert.commandFailed(shardAdmin.runCommand({ cleanupOrphaned: coll.getFullName(), startingFromKey: {someKey: 'someValue', someOtherKey: 1} }));   // Matches number of keys but not key name. This will succeed but should fail. assert.commandFailed(shardAdmin.runCommand({ cleanupOrphaned: coll.getFullName(), startingFromKey: {someKey: 'someValue'} }));

    Description

      The cleanupOrphaned command only checks that the startingFromKey parameter has the same number of fields as the shard key, not that the fields match.

      Attachments

        Activity

          People

            greg_10gen Greg Studer
            jesse@mongodb.com A. Jesse Jiryu Davis
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: