If migration_manager::get_schema_for_write is called after migration_manager::drain, it throws abort_requested_exception. This exception is not present in replica::exception_variant, which means that RPC doesn't preserve information about its type. If it is thrown on the replica side, it is deserialized as std::runtime_error on the coordinator. Therefore, abstract_read_resolver::error logs information about this exception, even though we don't want it (aborts are triggered on shutdown and timeouts). To solve this issue, we add abort_requested_exception to replica::exception_variant and, in the next commits, refactor storage_proxy::handle_read so that abort_requested_exception thrown in migration_manager::get_schema_for_write is properly serialized. Thanks to this change, unchanged abstract_read_resolver::error correctly handles abort_requested_exception thrown on the replica side by not reporting it.
45 lines
1.1 KiB
C++
45 lines
1.1 KiB
C++
/*
|
|
* Copyright 2022-present ScyllaDB
|
|
*/
|
|
|
|
/*
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*/
|
|
|
|
#include <concepts>
|
|
#include <sstream>
|
|
#include <stdexcept>
|
|
#include <type_traits>
|
|
|
|
#include "replica/exceptions.hh"
|
|
#include "utils/exceptions.hh"
|
|
|
|
|
|
namespace replica {
|
|
|
|
exception_variant try_encode_replica_exception(std::exception_ptr eptr) {
|
|
try {
|
|
std::rethrow_exception(std::move(eptr));
|
|
} catch (rate_limit_exception&) {
|
|
return rate_limit_exception();
|
|
} catch (const stale_topology_exception& e) {
|
|
return e;
|
|
} catch (abort_requested_exception&) {
|
|
return abort_requested_exception();
|
|
} catch (...) {
|
|
return no_exception{};
|
|
}
|
|
}
|
|
|
|
std::exception_ptr exception_variant::into_exception_ptr() noexcept {
|
|
return std::visit([] <typename Ex> (Ex&& ex) {
|
|
if constexpr (std::is_same_v<Ex, unknown_exception>) {
|
|
return std::make_exception_ptr(std::runtime_error("unknown exception"));
|
|
} else {
|
|
return std::make_exception_ptr(std::move(ex));
|
|
}
|
|
}, std::move(reason));
|
|
}
|
|
|
|
}
|