org.elasticsearch.indices.recovery.RecoveryTarget#restoreFileFromSnapshot does not check for cancellation during the download of a file. This means that if a recovery is cancelled mid-way, we will still not release the store/shard-lock until the file is fully downloaded.
For large files or slow downloads this can lead to problems when the shard is (re-)allocated to a node that is still executing such an interrupted recovery.

-> we need to add some checks for cancellation here like we have for other recovery modes.
server/src/main/java/org/elasticsearch/indices/recovery/PeerRecoveryTargetService.java
localNode,
            metadataSnapshot,
            recoveryTarget.state().getPrimary(),
            recoveryTarget.recoveryId(),
            startingSeqNo,
            recoveryTarget.hasPermitToDownloadSnapshotFiles()
        );
        return request;
    }
    private static void logListingLocalFilesWarning(Logger logger, long startingSeqNo, IOException e) {
        logger.warn(
            () -> format(
                "error while listing local files, resetting the starting sequence number from %s "
                    + "to unassigned and recovering as if there are none",
                startingSeqNo
            ),
            e
        );
    }
    private static void logGlobalCheckpointWarning(Logger logger, long startingSeqNo, Exception e) {
        logger.warn(
            () -> format(
                "error while reading global checkpoint from translog, "
                    + "resetting the starting sequence number from %s to unassigned and recovering as if there are none",
                startingSeqNo
            ),
            e
        );
    }
    public interface RecoveryListener {