From 3b1e56ea303de00f7e2f7e5fb4b1195738d27b54 Mon Sep 17 00:00:00 2001 From: John Spray Date: Wed, 25 May 2022 12:02:07 +0100 Subject: [PATCH] cluster: wait between config set_status RPCs On a healthy system, we do want to send set_status RPCs as soon as we're ready. However, if the controller log updates are not being seen promptly, this would lead to the follower spamming the controller leader with very many set_status RPCs in a tight loop. Nodes will still send their status immediately when a config change occurs: this change only effects the behaviour if _another_ config change occurs while it is reporting status from the first change: in this case the follower will wait 5 seconds before sending its next status RPC. Related https://github.com/redpanda-data/redpanda/issues/4923 --- src/v/cluster/config_manager.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/v/cluster/config_manager.cc b/src/v/cluster/config_manager.cc index 14e3670b851b..756e929ea2bc 100644 --- a/src/v/cluster/config_manager.cc +++ b/src/v/cluster/config_manager.cc @@ -516,12 +516,14 @@ ss::future<> config_manager::reconcile_status() { } try { - if (failed) { - // If we were dirty & failed to send our update, sleep until retry + if (failed || should_send_status()) { + // * we were dirty & failed to send our update, sleep until retry + // OR + // * our status updated while we were sending, wait a short time + // before sending our next update to avoid spamming the leader + // with too many set_status RPCs if we are behind on seeing + // updates to the controller log. co_await ss::sleep_abortable(status_retry, _as.local()); - } else if (should_send_status()) { - // Our status updated while we were sending, proceed - // immediately to next iteration of loop. } else { // We are clean: sleep until signalled. co_await _reconcile_wait.wait();