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

cleanupOrphaned doesn't verify startingFromKey matches shard key spec

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.5.4
    • Affects Version/s: 2.5.2
    • Component/s: 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' } }));

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

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

              Created:
              Updated:
              Resolved: