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 <xemul@scylladb.com>

Closes #13622
This commit is contained in:
Pavel Emelyanov
2023-04-21 20:11:44 +03:00
committed by Nadav Har'El
parent bd0b299322
commit 5e201b9120
9 changed files with 16 additions and 8 deletions

View File

@@ -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;

View File

@@ -7,6 +7,7 @@
*/
#include "compaction/task_manager_module.hh"
#include "compaction/compaction_manager.hh"
#include "replica/database.hh"
namespace compaction {

View File

@@ -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"

View File

@@ -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;

View File

@@ -2330,6 +2330,14 @@ future<> database::truncate_table_on_all_shards(sharded<database>& 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<compaction_manager::compaction_reenabler> cres;
bool did_flush;
};
future<> database::truncate_table_on_all_shards(sharded<database>& sharded_db, const std::vector<foreign_ptr<lw_shared_ptr<table>>>& table_shards, std::optional<db_clock::time_point> truncated_at_opt, bool with_snapshot, std::optional<sstring> snapshot_name_opt) {
auto& cf = *table_shards[this_shard_id()];
auto s = cf.schema();

View File

@@ -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<std::vector<foreign_ptr<lw_shared_ptr<table>>>> get_table_on_all_shards(sharded<database>& 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<compaction_manager::compaction_reenabler> cres;
bool did_flush;
};
struct table_truncate_state;
static future<> truncate_table_on_all_shards(sharded<database>& db, const std::vector<foreign_ptr<lw_shared_ptr<table>>>&, std::optional<db_clock::time_point> truncated_at_opt, bool with_snapshot, std::optional<sstring> snapshot_name_opt);
future<> truncate(column_family& cf, const table_truncate_state&, db_clock::time_point truncated_at);

View File

@@ -6,6 +6,7 @@
#include "database.hh" // for memtable_list
#include <seastar/core/metrics_api.hh>
#include <seastar/util/later.hh>
#include <seastar/core/sleep.hh>
#include <seastar/core/with_scheduling_group.hh>
#include <seastar/coroutine/maybe_yield.hh>
#include "seastarx.hh"

View File

@@ -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;

View File

@@ -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"