diff --git a/disk-error-handler.hh b/disk-error-handler.hh index 09b74be7e8..1693d0f0af 100644 --- a/disk-error-handler.hh +++ b/disk-error-handler.hh @@ -36,6 +36,8 @@ extern thread_local disk_error_signal_type sstable_read_error; extern thread_local disk_error_signal_type sstable_write_error; extern thread_local disk_error_signal_type general_disk_error; +bool should_stop_on_system_error(const std::system_error& e); + template std::enable_if_t>::value, std::result_of_t> @@ -44,7 +46,7 @@ do_io_check(disk_error_signal_type& signal, Func&& func, Args&&... args) { // calling function return func(std::forward(args)...); } catch (std::system_error& e) { - if (is_system_error_errno(EIO)) { + if (should_stop_on_system_error(e)) { signal(); throw storage_io_error(e); } @@ -62,7 +64,7 @@ auto do_io_check(disk_error_signal_type& signal, Func&& func, Args&&... args) { try { std::rethrow_exception(ep); } catch (std::system_error& sys_err) { - if (is_system_error_errno(EIO)) { + if (should_stop_on_system_error(sys_err)) { signal(); throw storage_io_error(sys_err); } @@ -70,7 +72,7 @@ auto do_io_check(disk_error_signal_type& signal, Func&& func, Args&&... args) { return futurize>::make_exception_future(ep); }); } catch (std::system_error& e) { - if (is_system_error_errno(EIO)) { + if (should_stop_on_system_error(e)) { signal(); throw storage_io_error(e); } diff --git a/utils/exceptions.cc b/utils/exceptions.cc index a4c15529d4..99af919ceb 100644 --- a/utils/exceptions.cc +++ b/utils/exceptions.cc @@ -49,3 +49,9 @@ bool is_system_error_errno(int err_no) code.category() == std::system_category(); }); } + +bool should_stop_on_system_error(const std::system_error& e) { + // We may whitelist transient errors in the future, but for now, + // be conservative. + return true; +}