[SERVER-11104] cleanupOrphaned doesn't verify startingFromKey matches shard key spec Created: 09/Oct/13  Updated: 11/Jul/16  Resolved: 13/Nov/13

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 2.5.2
Fix Version/s: 2.5.4

Type: Bug Priority: Minor - P4
Reporter: A. Jesse Jiryu Davis Assignee: Greg Studer
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-8598 Add command to cleanup orphaned data ... Closed
Operating System: ALL
Steps To Reproduce:

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'}
}));

Participants:

 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.



 Comments   
Comment by auto [ 23/Oct/13 ]

Author:

{u'username': u'gregstuder', u'name': u'Greg Studer', u'email': u'greg@10gen.com'}

Message: SERVER-11104 make sure orphaned data command uses valid shard key
Branch: master
https://github.com/mongodb/mongo/commit/34c1b5b421f05feb3d3772a0d582a79fb2665221

Generated at Thu Feb 08 03:24:54 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.