stream_session: Do not print banign exceptions with error level

Handler of STREAM_MUTATION_FRAGMENTS verb creates and starts reader. The
resulting future is then checked for being exceptional and an error
message is printed in logs.

However, if reader fails because of socket being closed by peer, the
error looks excessive. In that case the exception is just regular
handling of the socket/stream closure and can be demoted down to debug
level.

fixes: #15891

Similar cherry-picking of log level exists in e.g. storage proxy, see
for example 56bd9b5d (service: storage_proxy: do not report abort
    requests in handle_write )

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>

Closes scylladb/scylladb#15892
This commit is contained in:
Pavel Emelyanov
2023-10-31 10:43:55 +03:00
committed by Botond Dénes
parent 2cd804b8e5
commit b974d8ca1b

View File

@@ -178,8 +178,13 @@ void stream_manager::init_messaging_service_handler(abort_source& as) {
int32_t status = 0;
uint64_t received_partitions = 0;
if (f.failed()) {
sslog.error("[Stream #{}] Failed to handle STREAM_MUTATION_FRAGMENTS (receive and distribute phase) for ks={}, cf={}, peer={}: {}",
plan_id, s->ks_name(), s->cf_name(), from.addr, f.get_exception());
auto ex = f.get_exception();
auto level = seastar::log_level::error;
if (try_catch<seastar::rpc::stream_closed>(ex)) {
level = seastar::log_level::debug;
}
sslog.log(level, "[Stream #{}] Failed to handle STREAM_MUTATION_FRAGMENTS (receive and distribute phase) for ks={}, cf={}, peer={}: {}",
plan_id, s->ks_name(), s->cf_name(), from.addr, ex);
status = -1;
} else {
received_partitions = f.get0();
@@ -192,7 +197,11 @@ void stream_manager::init_messaging_service_handler(abort_source& as) {
return sink.close();
});
}).handle_exception([s, plan_id, from, sink] (std::exception_ptr ep) {
sslog.error("[Stream #{}] Failed to handle STREAM_MUTATION_FRAGMENTS (respond phase) for ks={}, cf={}, peer={}: {}",
auto level = seastar::log_level::error;
if (try_catch<seastar::rpc::closed_error>(ep)) {
level = seastar::log_level::debug;
}
sslog.log(level, "[Stream #{}] Failed to handle STREAM_MUTATION_FRAGMENTS (respond phase) for ks={}, cf={}, peer={}: {}",
plan_id, s->ks_name(), s->cf_name(), from.addr, ep);
});
} catch (...) {