db/view/view.cc: rate limit view update error messages

When propagating a view update to a paired view
replica fails, there is an error message.
This message is printed for every mutation,
which causes log spam when some node goes down.

This isn't a fatal error - it's normal that
a remote view replica goes down, it'll hopefully
receive the updates later through hints.

I'm unsure if the error message should
be printed at all, but for now we can
just rate limit it and that will improve
the situation with log spamming.

Signed-off-by: Jan Ciolek <jan.ciolek@scylladb.com>

Closes #13175
This commit is contained in:
Jan Ciolek
2023-03-14 18:40:39 +01:00
committed by Botond Dénes
parent b0a5769d92
commit a1c86786ca

View File

@@ -1722,8 +1722,12 @@ future<> mutate_MV(
auto ep = f.get_exception();
tracing::trace(tr_state, "Failed to apply view update for {} and {} remote endpoints",
*target_endpoint, updates_pushed_remote);
vlogger.error("Error applying view update to {} (view: {}.{}, base token: {}, view token: {}): {}",
*target_endpoint, s->ks_name(), s->cf_name(), base_token, view_token, ep);
// Printing an error on every failed view mutation would cause log spam, so a rate limit is needed.
static thread_local logger::rate_limit view_update_error_rate_limit(std::chrono::seconds(4));
vlogger.log(log_level::error, view_update_error_rate_limit,
"Error applying view update to {} (view: {}.{}, base token: {}, view token: {}): {}",
*target_endpoint, s->ks_name(), s->cf_name(), base_token, view_token, ep);
return apply_update_synchronously ? make_exception_future<>(std::move(ep)) : make_ready_future<>();
}
tracing::trace(tr_state, "Successfully applied view update for {} and {} remote endpoints",