treewide: remove #includes not use directly

for faster build times and clear inter-module dependencies, we
should not #includes headers not directly used. instead, we should
only #include the headers directly used by a certain compilation
unit.

in this change, the source files under "/compaction" directories
are checked using clangd, which identifies the cases where we have
an #include which is not directly used. all the #includes identified
by clangd are removed. because some source files rely on the incorrectly
included header file, those ones are updated to #include the header
file they directly use.

if a forward declaration suffice, the declaration is added instead.

see also https://clangd.llvm.org/guides/include-cleaner#unused-include-warning

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
This commit is contained in:
Kefu Chai
2023-07-18 17:28:39 +08:00
parent 58302ab145
commit bab16eb30e
11 changed files with 6 additions and 17 deletions

View File

@@ -29,31 +29,26 @@
#include <seastar/core/shared_ptr.hh>
#include "dht/i_partitioner.hh"
#include "sstables/exceptions.hh"
#include "sstables/sstables.hh"
#include "sstables/sstable_writer.hh"
#include "sstables/progress_monitor.hh"
#include "sstables/sstables_manager.hh"
#include "compaction.hh"
#include "compaction_manager.hh"
#include "schema/schema.hh"
#include "db/system_keyspace.hh"
#include "db_clock.hh"
#include "mutation/mutation_compactor.hh"
#include "leveled_manifest.hh"
#include "dht/token.hh"
#include "dht/partition_filter.hh"
#include "mutation_writer/shard_based_splitting_writer.hh"
#include "mutation_writer/partition_based_splitting_writer.hh"
#include "mutation/mutation_source_metadata.hh"
#include "mutation/mutation_fragment_stream_validator.hh"
#include "utils/UUID_gen.hh"
#include "utils/utf8.hh"
#include "utils/fmt-compat.hh"
#include "utils/error_injection.hh"
#include "readers/multi_range.hh"
#include "readers/compacting.hh"
#include "tombstone_gc.hh"
#include "keys.hh"
#include "replica/database.hh"
namespace sstables {

View File

@@ -12,7 +12,6 @@
#include <memory>
#include <seastar/core/shared_ptr.hh>
#include "sstables/shared_sstable.hh"
#include "sstables/progress_monitor.hh"
#include "timestamp.hh"
class compaction_backlog_manager;

View File

@@ -18,7 +18,6 @@
#include "sstables/sstable_set.hh"
#include "utils/UUID.hh"
#include "dht/i_partitioner.hh"
#include "compaction_weight_registration.hh"
#include "compaction_fwd.hh"
namespace sstables {

View File

@@ -11,7 +11,6 @@
#pragma once
#include "sstables/sstables.hh"
#include "compaction.hh"
#include "size_tiered_compaction_strategy.hh"
#include "range.hh"
#include "log.hh"

View File

@@ -11,10 +11,8 @@
#pragma once
#include "compaction_strategy_impl.hh"
#include "compaction.hh"
#include "size_tiered_compaction_strategy.hh"
#include "timestamp.hh"
#include "exceptions/exceptions.hh"
#include "sstables/shared_sstable.hh"
namespace sstables {

View File

@@ -23,7 +23,6 @@
#include "keys.hh"
#include "position_in_partition.hh"
#include "atomic_cell_or_collection.hh"
#include "query-result.hh"
#include "hashing_partition_visitor.hh"
#include "range_tombstone_list.hh"
#include "utils/intrusive_btree.hh"

View File

@@ -16,6 +16,7 @@
#include <utility>
#include "reader_concurrency_semaphore.hh"
#include "query-result.hh"
#include "readers/flat_mutation_reader_v2.hh"
#include "utils/exceptions.hh"
#include "schema/schema.hh"

View File

@@ -38,6 +38,7 @@
#include "db/snapshot-ctl.hh"
#include "memtable.hh"
#include "row_cache.hh"
#include "query-result.hh"
#include "compaction/compaction_strategy.hh"
#include "utils/estimated_histogram.hh"
#include <seastar/core/metrics_registration.hh>
@@ -63,13 +64,13 @@
#include "db/operation_type.hh"
#include "utils/serialized_action.hh"
#include "compaction/compaction_fwd.hh"
#include "utils/disk-error-handler.hh"
class cell_locker;
class cell_locker_stats;
class locked_cell;
class mutation;
class compaction_manager;
class frozen_mutation;
class reconcilable_result;

View File

@@ -11,6 +11,7 @@
#include "utils/UUID_gen.hh"
#include "service/paxos/proposal.hh"
#include "inet_address_vectors.hh"
#include "query-result.hh"
namespace service {

View File

@@ -25,13 +25,13 @@
#include <seastar/rpc/rpc_types.hh>
#include "storage_proxy_stats.hh"
#include "service_permit.hh"
#include "query-result.hh"
#include "cdc/stats.hh"
#include "locator/abstract_replication_strategy.hh"
#include "db/hints/host_filter.hh"
#include "utils/small_vector.hh"
#include "service/endpoint_lifecycle_subscriber.hh"
#include <seastar/core/circular_buffer.hh>
#include "exceptions/exceptions.hh"
#include "exceptions/coordinator_result.hh"
#include "replica/exceptions.hh"
#include "locator/host_id.hh"

View File

@@ -18,10 +18,8 @@
#include <exception>
#include <seastar/core/print.hh>
#include "types/types.hh"
#include "utils/exceptions.hh"
#include "utils/serialization.hh"
#include "vint-serialization.hh"
#include "combine.hh"
#include <cmath>
#include <chrono>
#include <sstream>
@@ -47,7 +45,6 @@
#include "utils/ascii.hh"
#include "utils/fragment_range.hh"
#include "utils/managed_bytes.hh"
#include "mutation/mutation_partition.hh"
#include "types/user.hh"
#include "types/tuple.hh"