snitch, storage service: Gossip snitch info once
Nowadays snitch states are put into gossiper via .gossiper_starting() call by gossiper. This, in turn, happens in two places -- on node ring join code and on re-enabling gossiper via the API call. The former can be performed by the ring joining code with the help of recently introduced snitch.get_app_states() helper. The latter call is in fact not needed. Re-gossiped are DC, RACK and for some drivers the INTERNAL_IP states that don't change throughout snitch lifetime and are preserved in the gossiper pre-loaded states. Thus, once the snitch states are applied by storage service ring join code, the respective states udpate can be removed from the snitch gossiper_starting() implementations. Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
This commit is contained in:
@@ -98,18 +98,12 @@ future<> ec2_multi_region_snitch::gossiper_starting() {
|
||||
// this function will be executed on CPU0 only.
|
||||
//
|
||||
|
||||
using namespace gms;
|
||||
auto& g = get_local_gossiper();
|
||||
|
||||
return gossip_snitch_info({
|
||||
{ application_state::INTERNAL_IP, versioned_value::internal_ip(_local_private_address) }
|
||||
}).then([this] {
|
||||
if (!_gossip_started) {
|
||||
gms::get_local_gossiper().register_(::make_shared<reconnectable_snitch_helper>(_my_dc));
|
||||
_gossip_started = true;
|
||||
}
|
||||
});
|
||||
|
||||
return make_ready_future<>();
|
||||
}
|
||||
|
||||
std::list<std::pair<gms::application_state, gms::versioned_value>> ec2_multi_region_snitch::get_app_states() const {
|
||||
|
||||
@@ -103,25 +103,12 @@ void gossiping_property_file_snitch::periodic_reader_callback() {
|
||||
}
|
||||
|
||||
future<> gossiping_property_file_snitch::gossiper_starting() {
|
||||
using namespace gms;
|
||||
using namespace service;
|
||||
//
|
||||
// Note: currently gossiper "main" instance always runs on CPU0 therefore
|
||||
// this function will be executed on CPU0 only.
|
||||
//
|
||||
auto& g = get_local_gossiper();
|
||||
|
||||
auto local_internal_addr = g.get_local_messaging().listen_address();
|
||||
std::ostringstream ostrm;
|
||||
|
||||
ostrm<<local_internal_addr<<std::flush;
|
||||
|
||||
return gossip_snitch_info({
|
||||
{ application_state::INTERNAL_IP, versioned_value::internal_ip(ostrm.str()) },
|
||||
}).then([this] {
|
||||
_gossip_started = true;
|
||||
return reload_gossiper_state();
|
||||
});
|
||||
}
|
||||
|
||||
std::list<std::pair<gms::application_state, gms::versioned_value>> gossiping_property_file_snitch::get_app_states() const {
|
||||
|
||||
@@ -93,7 +93,7 @@ public:
|
||||
*/
|
||||
virtual future<> gossiper_starting() {
|
||||
_gossip_started = true;
|
||||
return gossip_snitch_info({});
|
||||
return make_ready_future<>();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -346,6 +346,10 @@ void storage_service::prepare_to_join(
|
||||
app_states.emplace(gms::application_state::SHARD_COUNT, versioned_value::shard_count(smp::count));
|
||||
app_states.emplace(gms::application_state::IGNORE_MSB_BITS, versioned_value::ignore_msb_bits(_db.local().get_config().murmur3_partitioner_ignore_msb_bits()));
|
||||
|
||||
for (auto&& s : snitch->get_app_states()) {
|
||||
app_states.emplace(s.first, std::move(s.second));
|
||||
}
|
||||
|
||||
slogger.info("Starting up server gossip");
|
||||
|
||||
auto generation_number = db::system_keyspace::increment_and_get_generation().get0();
|
||||
|
||||
Reference in New Issue
Block a user