message_service: add sanity check that rpc connections are not created in the maintenance mode
In maintenance mode, a node shouldn't be able to communicate with other nodes. To make sure this does not happen, the sanity check is added.
This commit is contained in:
1
main.cc
1
main.cc
@@ -1246,6 +1246,7 @@ To start the scylla server proper, simply invoke as: scylla server (or just scyl
|
||||
if (snitch.local()->prefer_local()) {
|
||||
mscfg.preferred_ips = sys_ks.local().get_preferred_ips().get0();
|
||||
}
|
||||
mscfg.maintenance_mode = maintenance_mode_enabled{cfg->maintenance_mode()};
|
||||
|
||||
const auto& seo = cfg->server_encryption_options();
|
||||
auto encrypt = utils::get_or_default(seo, "internode_encryption", "none");
|
||||
|
||||
@@ -802,6 +802,9 @@ gms::inet_address messaging_service::get_public_endpoint_for(const gms::inet_add
|
||||
|
||||
shared_ptr<messaging_service::rpc_protocol_client_wrapper> messaging_service::get_rpc_client(messaging_verb verb, msg_addr id) {
|
||||
assert(!_shutting_down);
|
||||
if (_cfg.maintenance_mode) {
|
||||
on_internal_error(mlogger, "This node is in maintenance mode, it shouldn't contact other nodes");
|
||||
}
|
||||
auto idx = get_rpc_client_idx(verb);
|
||||
auto it = _clients[idx].find(id);
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "db/config.hh"
|
||||
#include "messaging_service_fwd.hh"
|
||||
#include "msg_addr.hh"
|
||||
#include <seastar/core/seastar.hh>
|
||||
@@ -22,6 +23,7 @@
|
||||
#include "streaming/stream_fwd.hh"
|
||||
#include "locator/host_id.hh"
|
||||
#include "service/session.hh"
|
||||
#include "service/maintenance_mode.hh"
|
||||
|
||||
#include <list>
|
||||
#include <vector>
|
||||
@@ -281,6 +283,7 @@ public:
|
||||
bool listen_on_broadcast_address = false;
|
||||
size_t rpc_memory_limit = 1'000'000;
|
||||
std::unordered_map<gms::inet_address, gms::inet_address> preferred_ips;
|
||||
maintenance_mode_enabled maintenance_mode = maintenance_mode_enabled::no;
|
||||
};
|
||||
|
||||
struct scheduling_config {
|
||||
|
||||
Reference in New Issue
Block a user