From ca2bb89180d75a7396aeadd342bbfd580996cfbb Mon Sep 17 00:00:00 2001 From: Benny Halevy Date: Sun, 12 Sep 2021 12:48:07 +0300 Subject: [PATCH] compaction_manager: maybe_stop_on_error: sync return value with error message. It is misleading to set retry to true in the following statement and return it later on when the `will_stop` parameter is true. Signed-off-by: Benny Halevy --- compaction/compaction_manager.cc | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/compaction/compaction_manager.cc b/compaction/compaction_manager.cc index f15569c7ec..d719d6a403 100644 --- a/compaction/compaction_manager.cc +++ b/compaction/compaction_manager.cc @@ -534,9 +534,6 @@ inline future<> compaction_manager::put_task_to_sleep(lw_shared_ptr& task) inline bool compaction_manager::maybe_stop_on_error(future<> f, stop_iteration will_stop) { bool retry = false; - const char* stop_msg = "stopping"; - const char* retry_msg = "retrying"; - const char* decision_msg = will_stop ? stop_msg : retry_msg; try { f.get(); @@ -550,8 +547,8 @@ inline bool compaction_manager::maybe_stop_on_error(future<> f, stop_iteration w do_stop(); } catch (...) { _stats.errors++; - cmlog.error("compaction failed: {}: {}", std::current_exception(), decision_msg); - retry = true; + retry = (will_stop == stop_iteration::no); + cmlog.error("compaction failed: {}: {}", std::current_exception(), retry ? "retrying" : "stopping"); } return retry; }