From adcb0233b3949c3ff6d7fa492cb83823eb9bb7f2 Mon Sep 17 00:00:00 2001 From: George Reynya Date: Wed, 4 Sep 2024 18:12:36 -0700 Subject: [PATCH] Add yields to myrocks clone Summary: After adding yields for chunks in the main loop, this is the only yield stack remaining on the clone path: https://fburl.com/scuba/mysql_thread_pool_stalls/jibfj8qd. To address them this change adds yields to the loops found in `donor::copy()`. Differential Revision: D62220291 fbshipit-source-id: 63132134baf1749bb44df56b07e51390ac152143 --- storage/rocksdb/clone/donor.cc | 6 ++++++ 1 file changed, 6 insertions(+) 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;