Right now when you call moveChunk on mongos, you specify a chunk to move via a "find", e.g.
> db.adminCommand({moveChunk : "test.foo" , find : {a : 5} , to : "shard0001"})
The semantics of this are "find the chunk that contains the doc
{a : 5}, and move it to shard0001."
With hashed shard keys, the chunks are ranges of hashes, so a single chunk might be from say
{ "a" : NumberLong("8234") }-->>
{ "a" : NumberLong("9543") }. Right now there's no way to specify this particular chunk unless you use a doc whose 'a' value hashes to somewhere in the range [8234,9543).
As alternative to the "find" syntax, moveChunk should also allow you to specify a chunk via its upper and lower bounds, as with the following syntax:
> db.adminCommand({moveChunk : "test.foo" , bounds : [ {a : NumberLong("8234")} , { "a" : NumberLong("9543") } ] , to : "shard0001"})
This allows the user to be very explicit about which chunk they want to move (the command would just return an error if no chunk with those upper and lower bounds exists).
- related to
-
SERVER-2001 option to hash shard key
- Closed