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 <bhalevy@scylladb.com>
This commit is contained in:
Benny Halevy
2021-09-12 12:48:07 +03:00
parent a1fe40278b
commit ca2bb89180

View File

@@ -534,9 +534,6 @@ inline future<> compaction_manager::put_task_to_sleep(lw_shared_ptr<task>& 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;
}