From: Pavel Emelyanov <
xe...@scylladb.com>
Committer: Pavel Emelyanov <
xe...@scylladb.com>
Branch: next
compaction_manager: Swallow ENOSPCs in ::stop()
When being stopped compaction manager may step on ENOSPC. This is not a
reason to fail stopping process with abort, better to warn this fact in
logs and proceed as if nothing happened
refs: #11245
Signed-off-by: Pavel Emelyanov <
xe...@scylladb.com>
---
diff --git a/compaction/compaction_manager.cc b/compaction/compaction_manager.cc
--- a/compaction/compaction_manager.cc
+++ b/compaction/compaction_manager.cc
@@ -848,14 +848,31 @@ future<> compaction_manager::really_do_stop() {
cmlog.info("Stopped");
}
+template <typename Ex>
+requires std::is_base_of_v<std::exception, Ex> &&
+requires (const Ex& ex) {
+ { ex.code() } noexcept -> std::same_as<const std::error_code&>;
+}
+auto swallow_enospc(const Ex& ex) noexcept {
+ if (ex.code().value() != ENOSPC) {
+ return make_exception_future<>(std::make_exception_ptr(ex));
+ }
+
+ cmlog.warn("Got ENOSPC on stop, ignoring...");
+ return make_ready_future<>();
+}
+
void compaction_manager::do_stop() noexcept {
if (_state == state::none || _state == state::stopped) {
return;
}
try {
_state = state::stopped;
- _stop_future = really_do_stop();
+ _stop_future = really_do_stop()
+ .handle_exception_type([] (const std::system_error& ex) { return swallow_enospc(ex); })
+ .handle_exception_type([] (const storage_io_error& ex) { return swallow_enospc(ex); })
+ ;
} catch (...) {
cmlog.error("Failed to stop the manager: {}", std::current_exception());
}