Skip to content

Commit

Permalink
Cleanup includes in dbformat.h (facebook#8930)
Browse files Browse the repository at this point in the history
Summary:
This header file was including everything and the kitchen sink when it did not need to.  This resulted in many places including this header when they needed other pieces instead.

Cleaned up this header to only include what was needed and fixed up the remaining code to include what was now missing.

Hopefully, this sort of code hygiene cleanup will speed up the builds...

Pull Request resolved: facebook#8930

Reviewed By: pdillinger

Differential Revision: D31142788

Pulled By: mrambacher

fbshipit-source-id: 6b45de3f300750c79f751f6227dece9cfd44085d
  • Loading branch information
mrambacher authored and facebook-github-bot committed Sep 29, 2021
1 parent 559943c commit 13ae16c
Show file tree
Hide file tree
Showing 88 changed files with 109 additions and 44 deletions.
1 change: 0 additions & 1 deletion db/arena_wrapped_db_iter.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include <string>
#include "db/db_impl/db_impl.h"
#include "db/db_iter.h"
#include "db/dbformat.h"
#include "db/range_del_aggregator.h"
#include "memory/arena.h"
#include "options/cf_options.h"
Expand Down
1 change: 0 additions & 1 deletion db/builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

#include "db/blob/blob_file_builder.h"
#include "db/compaction/compaction_iterator.h"
#include "db/dbformat.h"
#include "db/event_helpers.h"
#include "db/internal_stats.h"
#include "db/merge_helper.h"
Expand Down
1 change: 1 addition & 0 deletions db/column_family.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "db/version_set.h"
#include "db/write_controller.h"
#include "file/sst_file_manager_impl.h"
#include "logging/logging.h"
#include "monitoring/thread_status_util.h"
#include "options/options_helper.h"
#include "port/port.h"
Expand Down
1 change: 1 addition & 0 deletions db/compaction/compaction_iterator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "db/blob/blob_file_builder.h"
#include "db/blob/blob_index.h"
#include "db/snapshot_checker.h"
#include "logging/logging.h"
#include "port/likely.h"
#include "rocksdb/listener.h"
#include "table/internal_iterator.h"
Expand Down
1 change: 0 additions & 1 deletion db/compaction/compaction_job.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include "db/blob/blob_file_completion_callback.h"
#include "db/column_family.h"
#include "db/compaction/compaction_iterator.h"
#include "db/dbformat.h"
#include "db/flush_scheduler.h"
#include "db/internal_stats.h"
#include "db/job_context.h"
Expand Down
2 changes: 2 additions & 0 deletions db/compaction/compaction_picker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@
#include <string>
#include <utility>
#include <vector>

#include "db/column_family.h"
#include "file/filename.h"
#include "logging/log_buffer.h"
#include "logging/logging.h"
#include "monitoring/statistics.h"
#include "test_util/sync_point.h"
#include "util/random.h"
Expand Down
2 changes: 2 additions & 0 deletions db/compaction/compaction_picker_fifo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
#include <cinttypes>
#include <string>
#include <vector>

#include "db/column_family.h"
#include "logging/log_buffer.h"
#include "logging/logging.h"
#include "util/string_util.h"

namespace ROCKSDB_NAMESPACE {
Expand Down
2 changes: 2 additions & 0 deletions db/compaction/compaction_picker_universal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@
#include <queue>
#include <string>
#include <utility>

#include "db/column_family.h"
#include "file/filename.h"
#include "logging/log_buffer.h"
#include "logging/logging.h"
#include "monitoring/statistics.h"
#include "test_util/sync_point.h"
#include "util/random.h"
Expand Down
3 changes: 3 additions & 0 deletions db/db_filesnapshot.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@
#ifndef ROCKSDB_LITE

#include <stdint.h>

#include <algorithm>
#include <cinttypes>
#include <string>

#include "db/db_impl/db_impl.h"
#include "db/job_context.h"
#include "db/version_set.h"
#include "file/file_util.h"
#include "file/filename.h"
#include "logging/logging.h"
#include "port/port.h"
#include "rocksdb/db.h"
#include "rocksdb/env.h"
Expand Down
1 change: 1 addition & 0 deletions db/db_impl/compacted_db_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include "db/db_impl/db_impl.h"
#include "db/version_set.h"
#include "logging/logging.h"
#include "table/get_context.h"
#include "util/cast_util.h"

Expand Down
1 change: 0 additions & 1 deletion db/db_impl/db_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include "db/column_family.h"
#include "db/compaction/compaction_iterator.h"
#include "db/compaction/compaction_job.h"
#include "db/dbformat.h"
#include "db/error_handler.h"
#include "db/event_helpers.h"
#include "db/external_sst_file_ingestion_job.h"
Expand Down
1 change: 1 addition & 0 deletions db/db_impl/db_impl_compaction_flush.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "db/error_handler.h"
#include "db/event_helpers.h"
#include "file/sst_file_manager_impl.h"
#include "logging/logging.h"
#include "monitoring/iostats_context_imp.h"
#include "monitoring/perf_context_imp.h"
#include "monitoring/thread_status_updater.h"
Expand Down
1 change: 1 addition & 0 deletions db/db_impl/db_impl_experimental.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "db/db_impl/db_impl.h"
#include "db/job_context.h"
#include "db/version_set.h"
#include "logging/logging.h"
#include "rocksdb/status.h"
#include "util/cast_util.h"

Expand Down
1 change: 1 addition & 0 deletions db/db_impl/db_impl_files.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "file/file_util.h"
#include "file/filename.h"
#include "file/sst_file_manager_impl.h"
#include "logging/logging.h"
#include "port/port.h"
#include "util/autovector.h"

Expand Down
1 change: 1 addition & 0 deletions db/db_impl/db_impl_open.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "file/read_write_util.h"
#include "file/sst_file_manager_impl.h"
#include "file/writable_file_writer.h"
#include "logging/logging.h"
#include "monitoring/persistent_stats_history.h"
#include "options/options_helper.h"
#include "rocksdb/table.h"
Expand Down
1 change: 1 addition & 0 deletions db/db_impl/db_impl_readonly.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "db/db_impl/db_impl.h"
#include "db/db_iter.h"
#include "db/merge_context.h"
#include "logging/logging.h"
#include "monitoring/perf_context_imp.h"
#include "util/cast_util.h"

Expand Down
1 change: 1 addition & 0 deletions db/db_impl/db_impl_secondary.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "db/arena_wrapped_db_iter.h"
#include "db/merge_context.h"
#include "logging/auto_roll_logger.h"
#include "logging/logging.h"
#include "monitoring/perf_context_imp.h"
#include "rocksdb/configurable.h"
#include "util/cast_util.h"
Expand Down
2 changes: 2 additions & 0 deletions db/db_impl/db_impl_secondary.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@

#include <string>
#include <vector>

#include "db/db_impl/db_impl.h"
#include "logging/logging.h"

namespace ROCKSDB_NAMESPACE {

Expand Down
1 change: 1 addition & 0 deletions db/db_impl/db_impl_write.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "db/db_impl/db_impl.h"
#include "db/error_handler.h"
#include "db/event_helpers.h"
#include "logging/logging.h"
#include "monitoring/perf_context_imp.h"
#include "options/options_helper.h"
#include "test_util/sync_point.h"
Expand Down
1 change: 0 additions & 1 deletion db/db_iter.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include <string>

#include "db/db_impl/db_impl.h"
#include "db/dbformat.h"
#include "db/range_del_aggregator.h"
#include "memory/arena.h"
#include "options/cf_options.h"
Expand Down
1 change: 0 additions & 1 deletion db/db_test_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <vector>

#include "db/db_impl/db_impl.h"
#include "db/dbformat.h"
#include "file/filename.h"
#include "rocksdb/cache.h"
#include "rocksdb/compaction_filter.h"
Expand Down
3 changes: 3 additions & 0 deletions db/dbformat.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
#include "db/dbformat.h"

#include <stdio.h>

#include <cinttypes>

#include "db/lookup_key.h"
#include "monitoring/perf_context_imp.h"
#include "port/port.h"
#include "util/coding.h"
Expand Down
9 changes: 2 additions & 7 deletions db/dbformat.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,14 @@

#pragma once
#include <stdio.h>

#include <memory>
#include <string>
#include <utility>
#include "db/lookup_key.h"
#include "db/merge_context.h"
#include "logging/logging.h"
#include "monitoring/perf_context_imp.h"

#include "rocksdb/comparator.h"
#include "rocksdb/db.h"
#include "rocksdb/filter_policy.h"
#include "rocksdb/slice.h"
#include "rocksdb/slice_transform.h"
#include "rocksdb/table.h"
#include "rocksdb/types.h"
#include "util/coding.h"
#include "util/user_comparator_wrapper.h"
Expand Down
1 change: 1 addition & 0 deletions db/external_sst_file_ingestion_job.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "db/version_edit.h"
#include "file/file_util.h"
#include "file/random_access_file_reader.h"
#include "logging/logging.h"
#include "table/merging_iterator.h"
#include "table/scoped_arena_iterator.h"
#include "table/sst_file_writer_collectors.h"
Expand Down
1 change: 0 additions & 1 deletion db/external_sst_file_ingestion_job.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include <vector>

#include "db/column_family.h"
#include "db/dbformat.h"
#include "db/internal_stats.h"
#include "db/snapshot_impl.h"
#include "env/file_system_tracer.h"
Expand Down
1 change: 0 additions & 1 deletion db/flush_job.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

#include "db/blob/blob_file_completion_callback.h"
#include "db/column_family.h"
#include "db/dbformat.h"
#include "db/flush_scheduler.h"
#include "db/internal_stats.h"
#include "db/job_context.h"
Expand Down
1 change: 0 additions & 1 deletion db/forward_iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <vector>
#include <queue>

#include "db/dbformat.h"
#include "memory/arena.h"
#include "rocksdb/db.h"
#include "rocksdb/iterator.h"
Expand Down
1 change: 1 addition & 0 deletions db/import_column_family_job.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "db/version_edit.h"
#include "file/file_util.h"
#include "file/random_access_file_reader.h"
#include "logging/logging.h"
#include "table/merging_iterator.h"
#include "table/scoped_arena_iterator.h"
#include "table/sst_file_writer_collectors.h"
Expand Down
1 change: 0 additions & 1 deletion db/import_column_family_job.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include <vector>

#include "db/column_family.h"
#include "db/dbformat.h"
#include "db/external_sst_file_ingestion_job.h"
#include "db/snapshot_impl.h"
#include "options/db_options.h"
Expand Down
1 change: 0 additions & 1 deletion db/lookup_key.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#pragma once
#include <string>
#include <utility>
#include "rocksdb/db.h"
#include "rocksdb/slice.h"
#include "rocksdb/types.h"

Expand Down
1 change: 1 addition & 0 deletions db/memtable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "db/pinned_iterators_manager.h"
#include "db/range_tombstone_fragmenter.h"
#include "db/read_callback.h"
#include "logging/logging.h"
#include "memory/arena.h"
#include "memory/memory_usage.h"
#include "monitoring/perf_context_imp.h"
Expand Down
1 change: 1 addition & 0 deletions db/memtable_list.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "db/range_tombstone_fragmenter.h"
#include "db/version_set.h"
#include "logging/log_buffer.h"
#include "logging/logging.h"
#include "monitoring/thread_status_util.h"
#include "rocksdb/db.h"
#include "rocksdb/env.h"
Expand Down
1 change: 0 additions & 1 deletion db/memtable_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include <string>
#include <vector>

#include "db/dbformat.h"
#include "db/logs_with_prep_tracker.h"
#include "db/memtable.h"
#include "db/range_del_aggregator.h"
Expand Down
3 changes: 2 additions & 1 deletion db/merge_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
#include <string>
#include <vector>

#include "db/dbformat.h"
#include "db/merge_context.h"
#include "db/range_del_aggregator.h"
#include "db/snapshot_checker.h"
#include "rocksdb/compaction_filter.h"
#include "rocksdb/env.h"
#include "rocksdb/merge_operator.h"
#include "rocksdb/slice.h"
#include "util/stop_watch.h"

Expand All @@ -26,6 +26,7 @@ class Logger;
class MergeOperator;
class Statistics;
class SystemClock;
class Version;

class MergeHelper {
public:
Expand Down
3 changes: 3 additions & 0 deletions db/output_validator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
//
#include "db/output_validator.h"

#include "test_util/sync_point.h"
#include "util/hash.h"

namespace ROCKSDB_NAMESPACE {
Status OutputValidator::Add(const Slice& key, const Slice& value) {
if (enable_hash_) {
Expand Down
3 changes: 1 addition & 2 deletions db/output_validator.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
//
#pragma once
#include "db/dbformat.h"
#include "rocksdb/slice.h"
#include "rocksdb/status.h"
#include "test_util/sync_point.h"
#include "util/hash.h"

namespace ROCKSDB_NAMESPACE {
// A class that validates key/value that is inserted to an SST file.
Expand Down
2 changes: 2 additions & 0 deletions db/repair.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
#ifndef ROCKSDB_LITE

#include <cinttypes>

#include "db/builder.h"
#include "db/db_impl/db_impl.h"
#include "db/dbformat.h"
Expand All @@ -73,6 +74,7 @@
#include "db/write_batch_internal.h"
#include "file/filename.h"
#include "file/writable_file_writer.h"
#include "logging/logging.h"
#include "options/cf_options.h"
#include "rocksdb/comparator.h"
#include "rocksdb/db.h"
Expand Down
1 change: 1 addition & 0 deletions db/transaction_log_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "db/log_reader.h"
#include "db/version_set.h"
#include "file/filename.h"
#include "logging/logging.h"
#include "options/db_options.h"
#include "port/port.h"
#include "rocksdb/env.h"
Expand Down
1 change: 1 addition & 0 deletions db/version_edit_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

#include "db/blob/blob_file_cache.h"
#include "db/blob/blob_file_reader.h"
#include "logging/logging.h"
#include "monitoring/persistent_stats_history.h"

namespace ROCKSDB_NAMESPACE {
Expand Down
1 change: 1 addition & 0 deletions db/version_set.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include "file/random_access_file_reader.h"
#include "file/read_write_util.h"
#include "file/writable_file_writer.h"
#include "logging/logging.h"
#include "monitoring/file_read_sample.h"
#include "monitoring/perf_context_imp.h"
#include "monitoring/persistent_stats_history.h"
Expand Down
1 change: 1 addition & 0 deletions db_stress_tool/db_stress_test_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "db_stress_tool/db_stress_driver.h"
#include "db_stress_tool/db_stress_table_properties_collector.h"
#include "rocksdb/convenience.h"
#include "rocksdb/filter_policy.h"
#include "rocksdb/secondary_cache.h"
#include "rocksdb/sst_file_manager.h"
#include "rocksdb/types.h"
Expand Down
Loading

0 comments on commit 13ae16c

Please sign in to comment.