jstests/sharding/index_operations_abort_concurrent_outgoing_migrations.js runs a migration after an earlier one with the same donor and recipient is aborted because of an index operation, which is susceptible to failing with ConflictingOperationInProgress if the following sequence occurs:
- Migration m1 begins from shard0 to shard1
- m1 is interrupted when an index build applies on shard0
- Shard0 returns an error to the client immediately without notifying shard1 of the failure (shard1 will eventually discover the migration aborted when it contacts shard0 as part of the recipient protocol)
- The test begins another migration m2 from shard0 to shard1
- m2 fails because shard0 is unable to begin a migration on shard1 because shard1 has yet to discover m1 failed (a shard can only receive one chunk at a time)
- Shard0 returns ConflictingOperationInProgress
Eventually the recipient shard should clean up state from the failed migration and allow new migrations involving it to succeed, so to handle this, the test should retry its migrations on ConflictingOperationInProgress.