Details
Description
As part of stepping up to primary, a node recovers migrations that were active on the previous primary. This involves synchronously scanning every document in config.migrationCoordinators and clearing the metadata for each corresponding namespace, which requires taking a collection X lock. This happens after the primary restores the locks of active prepared transactions (through MongoDSessionCatalog::onStepUp() called here), so if a prepared transaction has a lock on a namespace that had an active migration, taking the collection X lock on that namespace in migration recovery will block, preventing the step up from succeeding.