messaging_service: store the node's host ID

This commit is contained in:
Kamil Braun
2023-06-20 12:06:13 +02:00
parent a78cc17bd4
commit 87f65d01b8
6 changed files with 10 additions and 6 deletions

View File

@@ -1099,6 +1099,7 @@ To start the scylla server proper, simply invoke as: scylla server (or just scyl
netw::messaging_service::config mscfg;
mscfg.id = cfg->host_id;
mscfg.ip = utils::resolve(cfg->listen_address, family).get0();
mscfg.port = cfg->storage_port();
mscfg.ssl_port = cfg->ssl_storage_port();

View File

@@ -226,8 +226,9 @@ future<> messaging_service::unregister_handler(messaging_verb verb) {
return _rpc->unregister_handler(verb);
}
messaging_service::messaging_service(gms::inet_address ip, uint16_t port)
: messaging_service(config{std::move(ip), port}, scheduling_config{{{{}, "$default"}}, {}, {}}, nullptr)
messaging_service::messaging_service(locator::host_id id, gms::inet_address ip, uint16_t port)
: messaging_service(config{std::move(id), std::move(ip), port},
scheduling_config{{{{}, "$default"}}, {}, {}}, nullptr)
{}
static

View File

@@ -19,6 +19,7 @@
#include "range.hh"
#include "schema/schema_fwd.hh"
#include "streaming/stream_fwd.hh"
#include "locator/host_id.hh"
#include <list>
#include <vector>
@@ -261,6 +262,7 @@ public:
};
struct config {
locator::host_id id;
gms::inet_address ip;
uint16_t port;
uint16_t ssl_port = 0;
@@ -322,7 +324,7 @@ private:
public:
using clock_type = lowres_clock;
messaging_service(gms::inet_address ip, uint16_t port);
messaging_service(locator::host_id id, gms::inet_address ip, uint16_t port);
messaging_service(config cfg, scheduling_config scfg, std::shared_ptr<seastar::tls::credentials_builder>);
~messaging_service();

View File

@@ -716,7 +716,7 @@ public:
}
// don't start listening so tests can be run in parallel
ms.start(listen, std::move(7000)).get();
ms.start(cfg->host_id, listen, std::move(7000)).get();
auto stop_ms = defer([&ms] { ms.stop().get(); });
// Normally the auth server is already stopped in here,

View File

@@ -68,7 +68,7 @@ int main(int ac, char ** av) {
token_metadata.start([] () noexcept { return db::schema_tables::hold_merge_lock(); }, locator::token_metadata::config{}).get();
auto stop_token_mgr = defer([&] { token_metadata.stop().get(); });
messaging.start(listen, 7000).get();
messaging.start(locator::host_id{}, listen, 7000).get();
auto stop_messaging = deferred_stop(messaging);
gms::gossip_config gcfg;

View File

@@ -171,7 +171,7 @@ int main(int ac, char ** av) {
const gms::inet_address listen = gms::inet_address(config["listen-address"].as<std::string>());
utils::fb_utilities::set_broadcast_address(listen);
seastar::sharded<netw::messaging_service> messaging;
return messaging.start(listen, 7000).then([config, stay_alive, &messaging] () {
return messaging.start(locator::host_id{}, listen, 7000).then([config, stay_alive, &messaging] () {
auto testers = new distributed<tester>;
return testers->start(std::ref(messaging)).then([testers]{
auto port = testers->local().port();