database/storage_proxy: Use "is_timeout_exception" instead of catch match
Might miss cases otherwise. v2: Fix broken control flow v3: Avoid throw - use make_exception_future instead.
This commit is contained in:
@@ -1824,13 +1824,11 @@ Future database::update_write_metrics(Future&& f) {
|
||||
return f.then_wrapped([this, s = _stats] (auto f) {
|
||||
if (f.failed()) {
|
||||
++s->total_writes_failed;
|
||||
try {
|
||||
f.get();
|
||||
} catch (const timed_out_error&) {
|
||||
auto ep = f.get_exception();
|
||||
if (is_timeout_exception(ep)) {
|
||||
++s->total_writes_timedout;
|
||||
throw;
|
||||
}
|
||||
assert(0 && "should not reach");
|
||||
return futurize<Future>::make_exception_future(std::move(ep));
|
||||
}
|
||||
++s->total_writes;
|
||||
return f;
|
||||
|
||||
@@ -4999,14 +4999,10 @@ void storage_proxy::init_messaging_service(shared_ptr<migration_manager> mm) {
|
||||
});
|
||||
}).handle_exception([reply_to, shard, &p, &errors] (std::exception_ptr eptr) {
|
||||
seastar::log_level l = seastar::log_level::warn;
|
||||
try {
|
||||
std::rethrow_exception(eptr);
|
||||
} catch (timed_out_error&) {
|
||||
if (is_timeout_exception(eptr)) {
|
||||
// ignore timeouts so that logs are not flooded.
|
||||
// database total_writes_timedout counter was incremented.
|
||||
l = seastar::log_level::debug;
|
||||
} catch (...) {
|
||||
// ignore
|
||||
}
|
||||
slogger.log(l, "Failed to apply mutation from {}#{}: {}", reply_to, shard, eptr);
|
||||
errors++;
|
||||
|
||||
Reference in New Issue
Block a user