From ac83df4875069e48ad984e09f8ef2f475c0160ff Mon Sep 17 00:00:00 2001 From: Benny Halevy Date: Sat, 10 Feb 2024 11:51:48 +0200 Subject: [PATCH 1/2] transport: controller: do_start_server: do not set_cql_read for maintenance port RPC is not ready yet at this point, so we should not set this application state yet. This is indicated by the following warning from `gossiper::add_local_application_state`: ``` WARN 2024-01-22 23:40:53,978 [shard 0:stmt] gossip - Fail to apply application_state: std::runtime_error (endpoint_state_map does not contain endpoint = 127.227.191.13, application_states = {{RPC_READY -> Value(1,1)}}) ``` That should really be an internal error, but it can't because of this bug. Fixes #16932 Signed-off-by: Benny Halevy --- transport/controller.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/transport/controller.cc b/transport/controller.cc index 8b9ac261da..9882dcaa00 100644 --- a/transport/controller.cc +++ b/transport/controller.cc @@ -212,7 +212,9 @@ future<> controller::do_start_server() { }); }).get(); - set_cql_ready(true).get(); + if (!_used_by_maintenance_socket) { + set_cql_ready(true).get(); + } on_error.cancel(); on_error_unsub.cancel(); From f86a5072d6e4ba221e25b5dccb7fe50977af9305 Mon Sep 17 00:00:00 2001 From: Benny Halevy Date: Sun, 11 Feb 2024 13:33:26 +0200 Subject: [PATCH 2/2] gossiper: add_local_application_state: drop internae error After 1d07a596bf23432326dadd74eb5b2857955fe15b that dropped before_change notifications there is no sense in getting the local endpoint_state_ptr twice: before and after the notifications and call on_internal_error if the state isn't found after the notifications. Just throw the runtime_error if the endpoint state is not found, otherwise, use it. Signed-off-by: Benny Halevy --- gms/gossiper.cc | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/gms/gossiper.cc b/gms/gossiper.cc index e64b107b55..ca6add1aac 100644 --- a/gms/gossiper.cc +++ b/gms/gossiper.cc @@ -2217,12 +2217,7 @@ future<> gossiper::add_local_application_state(application_state_map states) { co_await coroutine::return_exception(std::runtime_error(err)); } - auto es = gossiper.get_endpoint_state_ptr(ep_addr); - if (!es) { - on_internal_error(logger, format("endpoint_state_map does not contain endpoint = {}", ep_addr)); - } - - auto local_state = *es; + auto local_state = *ep_state_before; for (auto& p : states) { auto& state = p.first; auto& value = p.second;