From 5e201b91201c3b309d3d71aea9fd233a1f3bf14b Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Fri, 21 Apr 2023 20:11:44 +0300 Subject: [PATCH] database: Remove compaction_manager.hh inclusion into database.hh The only reason why it's there (right next to compaction_fwd.hh) is because the database::table_truncate_state subclass needs the definition of compaction_manager::compaction_reenabler subclass. However, the former sub is not used outside of database.cc and can be defined in .cc. Keeping it outside of the header allows dropping the compaction_manager.hh from database.hh thus greatly reducing its fanout over the code (from ~180 indirect inclusions down to ~20). Signed-off-by: Pavel Emelyanov Closes #13622 --- api/column_family.cc | 1 + compaction/task_manager_module.cc | 1 + db/view/view.cc | 1 + repair/row_level.cc | 1 + replica/database.cc | 8 ++++++++ replica/database.hh | 9 +-------- replica/dirty_memory_manager.cc | 1 + test/boost/database_test.cc | 1 + tombstone_gc.cc | 1 + 9 files changed, 16 insertions(+), 8 deletions(-) diff --git a/api/column_family.cc b/api/column_family.cc index 03c07dc6fb..c951527992 100644 --- a/api/column_family.cc +++ b/api/column_family.cc @@ -17,6 +17,7 @@ #include "db/system_keyspace.hh" #include "db/data_listeners.hh" #include "storage_service.hh" +#include "compaction/compaction_manager.hh" #include "unimplemented.hh" extern logging::logger apilog; diff --git a/compaction/task_manager_module.cc b/compaction/task_manager_module.cc index 9275832faf..9923bb1a58 100644 --- a/compaction/task_manager_module.cc +++ b/compaction/task_manager_module.cc @@ -7,6 +7,7 @@ */ #include "compaction/task_manager_module.hh" +#include "compaction/compaction_manager.hh" #include "replica/database.hh" namespace compaction { diff --git a/db/view/view.cc b/db/view/view.cc index b9ca86e869..adfbcc8498 100644 --- a/db/view/view.cc +++ b/db/view/view.cc @@ -48,6 +48,7 @@ #include "mutation/mutation_partition.hh" #include "service/migration_manager.hh" #include "service/storage_proxy.hh" +#include "compaction/compaction_manager.hh" #include "utils/small_vector.hh" #include "view_info.hh" #include "view_update_checks.hh" diff --git a/repair/row_level.cc b/repair/row_level.cc index 63ae38978b..f24c92946a 100644 --- a/repair/row_level.cc +++ b/repair/row_level.cc @@ -55,6 +55,7 @@ #include "repair/decorated_key_with_hash.hh" #include "repair/row.hh" #include "repair/writer.hh" +#include "compaction/compaction_manager.hh" #include "utils/xx_hasher.hh" extern logging::logger rlogger; diff --git a/replica/database.cc b/replica/database.cc index de9281751e..2acc90bb71 100644 --- a/replica/database.cc +++ b/replica/database.cc @@ -2330,6 +2330,14 @@ future<> database::truncate_table_on_all_shards(sharded& sharded_db, s co_return co_await truncate_table_on_all_shards(sharded_db, table_shards, truncated_at_opt, with_snapshot, std::move(snapshot_name_opt)); } +struct database::table_truncate_state { + gate::holder holder; + db_clock::time_point low_mark_at; + db::replay_position low_mark; + std::vector cres; + bool did_flush; +}; + future<> database::truncate_table_on_all_shards(sharded& sharded_db, const std::vector>>& table_shards, std::optional truncated_at_opt, bool with_snapshot, std::optional snapshot_name_opt) { auto& cf = *table_shards[this_shard_id()]; auto s = cf.schema(); diff --git a/replica/database.hh b/replica/database.hh index c072770b84..41074233b0 100644 --- a/replica/database.hh +++ b/replica/database.hh @@ -64,7 +64,6 @@ #include "db/operation_type.hh" #include "utils/serialized_action.hh" #include "compaction/compaction_fwd.hh" -#include "compaction/compaction_manager.hh" #include "utils/disk-error-handler.hh" #include "rust/wasmtime_bindings.hh" @@ -1672,13 +1671,7 @@ private: static future>>> get_table_on_all_shards(sharded& db, table_id uuid); - struct table_truncate_state { - gate::holder holder; - db_clock::time_point low_mark_at; - db::replay_position low_mark; - std::vector cres; - bool did_flush; - }; + struct table_truncate_state; static future<> truncate_table_on_all_shards(sharded& db, const std::vector>>&, std::optional truncated_at_opt, bool with_snapshot, std::optional snapshot_name_opt); future<> truncate(column_family& cf, const table_truncate_state&, db_clock::time_point truncated_at); diff --git a/replica/dirty_memory_manager.cc b/replica/dirty_memory_manager.cc index 356a1ab97f..ce37ab7f2c 100644 --- a/replica/dirty_memory_manager.cc +++ b/replica/dirty_memory_manager.cc @@ -6,6 +6,7 @@ #include "database.hh" // for memtable_list #include #include +#include #include #include #include "seastarx.hh" diff --git a/test/boost/database_test.cc b/test/boost/database_test.cc index e2d1eacd8d..17bc81a1a0 100644 --- a/test/boost/database_test.cc +++ b/test/boost/database_test.cc @@ -37,6 +37,7 @@ #include "db/data_listeners.hh" #include "multishard_mutation_query.hh" #include "transport/messages/result_message.hh" +#include "compaction/compaction_manager.hh" #include "db/snapshot-ctl.hh" using namespace std::chrono_literals; diff --git a/tombstone_gc.cc b/tombstone_gc.cc index c894fb4698..41e53492ed 100644 --- a/tombstone_gc.cc +++ b/tombstone_gc.cc @@ -17,6 +17,7 @@ #include "exceptions/exceptions.hh" #include "locator/abstract_replication_strategy.hh" #include "replica/database.hh" +#include "compaction/compaction_manager.hh" #include "data_dictionary/data_dictionary.hh" #include "gms/feature_service.hh"