From a67efb031c24f5bb0a63d59a4cbc83cc74737d15 Mon Sep 17 00:00:00 2001 From: Yaniv Michael Kaul Date: Thu, 16 Apr 2026 18:19:19 +0300 Subject: [PATCH] db: break heavy include chain from config.hh by extracting replication_strategy_type Extract replication_strategy_type enum from locator/abstract_replication_strategy.hh into a new lightweight header locator/replication_strategy_type.hh, and use it in db/config.hh instead of the full abstract_replication_strategy.hh. abstract_replication_strategy.hh pulls in a large transitive dependency tree (schema.hh, mutation serializers, etc.) costing ~1.7s per file. With this change, config.hh's incremental parse cost drops from 1.7s to 0.6s. Since ~85 files include config.hh without also including database.hh (which would bring in these deps anyway), this saves ~93s total CPU. Speedup: part of a series measured at -5.8% wall-clock improvement (same-session A/B: 16m14s -> 15m17s at -j16, 16 cores). --- db/config.hh | 2 +- locator/abstract_replication_strategy.hh | 8 +------- locator/replication_strategy_type.hh | 20 ++++++++++++++++++++ 3 files changed, 22 insertions(+), 8 deletions(-) create mode 100644 locator/replication_strategy_type.hh diff --git a/db/config.hh b/db/config.hh index 24a572664c..ed9e7a0bc6 100644 --- a/db/config.hh +++ b/db/config.hh @@ -15,7 +15,7 @@ #include #include -#include "locator/abstract_replication_strategy.hh" +#include "locator/replication_strategy_type.hh" #include "seastarx.hh" #include "utils/config_file.hh" #include "utils/enum_option.hh" diff --git a/locator/abstract_replication_strategy.hh b/locator/abstract_replication_strategy.hh index 02ab3a638f..6d0d156b80 100644 --- a/locator/abstract_replication_strategy.hh +++ b/locator/abstract_replication_strategy.hh @@ -19,6 +19,7 @@ #include "utils/sequenced_set.hh" #include "utils/simple_hashers.hh" #include "tablets.hh" +#include "locator/replication_strategy_type.hh" #include "data_dictionary/consistency_config_options.hh" // forward declaration since replica/database.hh includes this file @@ -38,13 +39,6 @@ extern logging::logger rslogger; using inet_address = gms::inet_address; using token = dht::token; -enum class replication_strategy_type { - simple, - local, - network_topology, - everywhere_topology, -}; - using replication_strategy_config_option = std::variant; using replication_strategy_config_options = std::map; diff --git a/locator/replication_strategy_type.hh b/locator/replication_strategy_type.hh new file mode 100644 index 0000000000..e0997eb55f --- /dev/null +++ b/locator/replication_strategy_type.hh @@ -0,0 +1,20 @@ +/* + * Copyright (C) 2015-present ScyllaDB + */ + +/* + * SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.1 + */ + +#pragma once + +namespace locator { + +enum class replication_strategy_type { + simple, + local, + network_topology, + everywhere_topology, +}; + +} // namespace locator