Skip to content

Commit

Permalink
Add yields to myrocks clone
Browse files Browse the repository at this point in the history
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
  • Loading branch information
george-reynya authored and facebook-github-bot committed Sep 5, 2024
1 parent 7c087d2 commit adcb023
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions storage/rocksdb/clone/donor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit adcb023

Please sign in to comment.