Introduce a commitChunkMigration command, only available on the config server, with the following arguments:
- migratedChunk (bson) - complete description of a chunk, which is being migrated.
- controlChunk (bson, optional) - complete description of a chunk owned by the same shard as the migrated chunk, but which does not move. This value will be missing if the migrateChunk is the last chunk being moved off a given shard.
- newShard (string) - name of a shard to which the migratedChunk is being moved.
This command internally, using a centralized version generation source will produce a new chunk version to be used for the migrated and control chunks, similarly to the logic that is currently used, and updates the config.chunks collection with the new versions, encompassing the writes performs as part of ‘applyOps’ today. Additionally it will return a bson response with the following contents:
- migratedChunkVersion - newly generated version for the migrated chunk
- controlChunkVersion - newly generated version for the control chunk
One thing to be considered is whether this command should only be made available if the server is running in config server mode.