From 96503904829a28b4afca4bf013e45daa3e70bd47 Mon Sep 17 00:00:00 2001 From: Yaniv Michael Kaul Date: Thu, 16 Apr 2026 23:27:55 +0300 Subject: [PATCH] db: extract loaded_endpoint_state into a lightweight header Move loaded_endpoint_state from gossiper.hh to gms/loaded_endpoint_state.hh so db/system_keyspace.hh no longer needs the full gossiper header. Add direct gossiper includes at the remaining users that still need it. --- db/system_keyspace.hh | 9 +++++++-- db/view/view.cc | 1 + db/view/view_building_coordinator.cc | 1 + db/virtual_tables.cc | 1 + gms/gossiper.hh | 6 +----- gms/loaded_endpoint_state.hh | 23 +++++++++++++++++++++++ service/storage_service.hh | 1 + tools/load_system_tablets.cc | 1 + 8 files changed, 36 insertions(+), 7 deletions(-) create mode 100644 gms/loaded_endpoint_state.hh diff --git a/db/system_keyspace.hh b/db/system_keyspace.hh index eb9a631d83..1cf567b618 100644 --- a/db/system_keyspace.hh +++ b/db/system_keyspace.hh @@ -15,10 +15,11 @@ #include #include #include "db/view/view_build_status.hh" -#include "gms/gossiper.hh" +#include "gms/inet_address.hh" +#include "gms/generation-number.hh" +#include "gms/loaded_endpoint_state.hh" #include "schema/schema_fwd.hh" #include "utils/UUID.hh" -#include "query/query-result-set.hh" #include "db_clock.hh" #include "mutation_query.hh" #include "system_keyspace_view_types.hh" @@ -36,6 +37,10 @@ namespace netw { class shared_dict; }; +namespace query { + class result_set; +} + namespace sstables { struct entry_descriptor; class generation_type; diff --git a/db/view/view.cc b/db/view/view.cc index 79f17b0f86..3cb6c52a7d 100644 --- a/db/view/view.cc +++ b/db/view/view.cc @@ -29,6 +29,7 @@ #include "db/config.hh" #include "db/view/base_info.hh" +#include "query/query-result-set.hh" #include "db/view/view_build_status.hh" #include "db/view/view_consumer.hh" #include "mutation/canonical_mutation.hh" diff --git a/db/view/view_building_coordinator.cc b/db/view/view_building_coordinator.cc index 879fd887b6..f94a89f0eb 100644 --- a/db/view/view_building_coordinator.cc +++ b/db/view/view_building_coordinator.cc @@ -13,6 +13,7 @@ #include #include #include +#include "gms/gossiper.hh" #include "db/view/view_building_coordinator.hh" #include "db/view/view_build_status.hh" #include "locator/tablets.hh" diff --git a/db/virtual_tables.cc b/db/virtual_tables.cc index 076aad9a6e..bb8aa247f1 100644 --- a/db/virtual_tables.cc +++ b/db/virtual_tables.cc @@ -20,6 +20,7 @@ #include "cdc/metadata.hh" #include "db/config.hh" #include "db/system_keyspace.hh" +#include "query/query-result-set.hh" #include "db/virtual_table.hh" #include "partition_slice_builder.hh" #include "db/virtual_tables.hh" diff --git a/gms/gossiper.hh b/gms/gossiper.hh index 9f128beffb..979b1c6edb 100644 --- a/gms/gossiper.hh +++ b/gms/gossiper.hh @@ -34,6 +34,7 @@ #include "locator/token_metadata.hh" #include "locator/types.hh" #include "gms/gossip_address_map.hh" +#include "gms/loaded_endpoint_state.hh" namespace gms { @@ -71,11 +72,6 @@ struct gossip_config { utils::updateable_value recovery_leader; }; -struct loaded_endpoint_state { - gms::inet_address endpoint; - std::optional opt_dc_rack; -}; - /** * This module is responsible for Gossiping information for the local endpoint. This abstraction * maintains the list of live and dead endpoints. Periodically i.e. every 1 second this module diff --git a/gms/loaded_endpoint_state.hh b/gms/loaded_endpoint_state.hh new file mode 100644 index 0000000000..12b7dd3695 --- /dev/null +++ b/gms/loaded_endpoint_state.hh @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2025-present ScyllaDB + */ + +/* + * SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.1 + */ + +#pragma once + +#include + +#include "gms/inet_address.hh" +#include "locator/types.hh" + +namespace gms { + +struct loaded_endpoint_state { + inet_address endpoint; + std::optional opt_dc_rack; +}; + +} // namespace gms diff --git a/service/storage_service.hh b/service/storage_service.hh index 8f70697d4e..91dcee6c8d 100644 --- a/service/storage_service.hh +++ b/service/storage_service.hh @@ -15,6 +15,7 @@ #include #include "absl-flat_hash_map.hh" #include "gms/endpoint_state.hh" +#include "gms/gossiper.hh" #include "gms/i_endpoint_state_change_subscriber.hh" #include "schema/schema_fwd.hh" #include "service/client_routes.hh" diff --git a/tools/load_system_tablets.cc b/tools/load_system_tablets.cc index 01ddc5411d..324af1a3b9 100644 --- a/tools/load_system_tablets.cc +++ b/tools/load_system_tablets.cc @@ -9,6 +9,7 @@ #include "tools/load_system_tablets.hh" #include +#include "query/query-result-set.hh" #include #include "locator/abstract_replication_strategy.hh"