When sharding a collection with a hashed shard key, and specifying numInitialChunks, some of these initial chunks are unable to be moved immediately afterwards.
jstests are attached.
In 2.4.9, the characterisation is:
- Only chunks on the last shard are affected.
- All but the final chunk are affected.
- Before a successful chunk move, attempting to move problem chunks gives errors such as:
- After a successful chunk move, attempting to move a problem chunk gives a different error:
In 2.5.1+, the characterisation is:
- All shards are affected.
- All chunks are affected.
- Attempting to move a chunk gives errors such as:
The chunks look fine in config.chunks. Restarting the affected shard server between shardCollection and moveChunk allows the chunks to be moved sucessfully, so this is likely to be a bug in ChunkManager that causes it to get confused about chunk bounds. Specifically, it looks like the upper bound is not being set properly.