compaction: request abort only once in compaction_data::stop

compaction_manager::task (and thus compaction_data) can be stopped
because of many different reasons. Thus, abort can be requested more
than once on compaction_data abort source causing a crash.

To prevent this before each request_abort() we check whether an abort
was requested before.

Closes #12004
This commit is contained in:
Aleksandra Martyniuk
2022-11-16 16:15:57 +01:00
committed by Avi Kivity
parent 1e2741d2fe
commit 7ead1a7857

View File

@@ -80,8 +80,10 @@ struct compaction_data {
}
void stop(sstring reason) {
stop_requested = std::move(reason);
abort.request_abort();
if (!abort.abort_requested()) {
stop_requested = std::move(reason);
abort.request_abort();
}
}
};