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

cleanupOrphaned doesn't verify startingFromKey matches shard key spec

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Fixed
    • Affects Version/s: 2.5.2
    • Fix Version/s: 2.5.4
    • Component/s: Sharding
    • Labels:
      None
    • Operating System:
      ALL
    • Steps To Reproduce:
      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

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: