The configsvrCommitMovePrimary command throws ShardNotFound if the destination shard is found as draining. Because it does this prior to checking if the command had previously succeeded, this can cause the following problematic scenario:
- Start movePrimary from shard0 to shard1
- Commit the movePrimary to the config server via configsvrCommitMovePrimary (success)
- Hit a retriable error on the coordinator (for example, a stepdown or a network error when committing to the shard authoritative catalog)
- Retry the coordinator pass after this check
- Mark the destination shard (shard1) as draining (startShardDraining or removeShard)
- configsvrCommitMovePrimary is retried and hits ShardNotFound
- We abort the coordinator leaving the shard authoritative metadata not updated