diff --git a/storage/rocksdb/clone/donor.cc b/storage/rocksdb/clone/donor.cc index 88fcc4593a0d..ffe0326110ba 100644 --- a/storage/rocksdb/clone/donor.cc +++ b/storage/rocksdb/clone/donor.cc @@ -834,6 +834,9 @@ int donor::copy(const THD *thd, uint task_id, Ha_clone_cbk &cbk) { auto err = handle_any_error(thd); if (err != 0) return err; + // This loop can take a long time so make sure to yield. + thd_check_yield(nullptr); + #ifdef __APPLE__ if (use_direct_io && fcntl(fd, F_NOCACHE, 1) == -1) { const auto errn = my_errno(); @@ -890,6 +893,9 @@ int donor::copy(const THD *thd, uint task_id, Ha_clone_cbk &cbk) { return err; } + // This loop can take a long time so make sure to yield. + thd_check_yield(nullptr); + const auto chunk_size = metadata.chunk_size(buf_size); donor_chunk_metadata chunk{metadata.get_id(), chunk_size}; myrocks::Rdb_string_writer buf;