1 // Copyright (c) 2011-present, Facebook, Inc.  All rights reserved.
2 //  This source code is licensed under both the GPLv2 (found in the
3 //  COPYING file in the root directory) and Apache 2.0 License
4 //  (found in the LICENSE.Apache file in the root directory).
5 
6 #pragma once
7 
8 #include <string>
9 #include <vector>
10 
11 #include "rocksdb/options.h"
12 
13 namespace ROCKSDB_NAMESPACE {
14 
15 struct ImmutableDBOptions {
16   ImmutableDBOptions();
17   explicit ImmutableDBOptions(const DBOptions& options);
18 
19   void Dump(Logger* log) const;
20 
21   bool create_if_missing;
22   bool create_missing_column_families;
23   bool error_if_exists;
24   bool paranoid_checks;
25   Env* env;
26   std::shared_ptr<FileSystem> fs;
27   std::shared_ptr<RateLimiter> rate_limiter;
28   std::shared_ptr<SstFileManager> sst_file_manager;
29   std::shared_ptr<Logger> info_log;
30   InfoLogLevel info_log_level;
31   int max_file_opening_threads;
32   std::shared_ptr<Statistics> statistics;
33   bool use_fsync;
34   std::vector<DbPath> db_paths;
35   std::string db_log_dir;
36   std::string wal_dir;
37   uint32_t max_subcompactions;
38   int max_background_flushes;
39   size_t max_log_file_size;
40   size_t log_file_time_to_roll;
41   size_t keep_log_file_num;
42   size_t recycle_log_file_num;
43   uint64_t max_manifest_file_size;
44   int table_cache_numshardbits;
45   uint64_t wal_ttl_seconds;
46   uint64_t wal_size_limit_mb;
47   uint64_t max_write_batch_group_size_bytes;
48   size_t manifest_preallocation_size;
49   bool allow_mmap_reads;
50   bool allow_mmap_writes;
51   bool use_direct_reads;
52   bool use_direct_io_for_flush_and_compaction;
53   bool allow_fallocate;
54   bool is_fd_close_on_exec;
55   bool advise_random_on_open;
56   size_t db_write_buffer_size;
57   std::shared_ptr<WriteBufferManager> write_buffer_manager;
58   DBOptions::AccessHint access_hint_on_compaction_start;
59   bool new_table_reader_for_compaction_inputs;
60   size_t random_access_max_buffer_size;
61   bool use_adaptive_mutex;
62   std::vector<std::shared_ptr<EventListener>> listeners;
63   bool enable_thread_tracking;
64   bool enable_pipelined_write;
65   bool unordered_write;
66   bool allow_concurrent_memtable_write;
67   bool enable_write_thread_adaptive_yield;
68   uint64_t write_thread_max_yield_usec;
69   uint64_t write_thread_slow_yield_usec;
70   bool skip_stats_update_on_db_open;
71   bool skip_checking_sst_file_sizes_on_db_open;
72   WALRecoveryMode wal_recovery_mode;
73   bool allow_2pc;
74   std::shared_ptr<Cache> row_cache;
75 #ifndef ROCKSDB_LITE
76   WalFilter* wal_filter;
77 #endif  // ROCKSDB_LITE
78   bool fail_if_options_file_error;
79   bool dump_malloc_stats;
80   bool avoid_flush_during_recovery;
81   bool allow_ingest_behind;
82   bool preserve_deletes;
83   bool two_write_queues;
84   bool manual_wal_flush;
85   bool atomic_flush;
86   bool avoid_unnecessary_blocking_io;
87   bool persist_stats_to_disk;
88   bool write_dbid_to_manifest;
89   size_t log_readahead_size;
90   std::shared_ptr<FileChecksumGenFactory> file_checksum_gen_factory;
91   bool best_efforts_recovery;
92 };
93 
94 struct MutableDBOptions {
95   MutableDBOptions();
96   explicit MutableDBOptions(const MutableDBOptions& options) = default;
97   explicit MutableDBOptions(const DBOptions& options);
98 
99   void Dump(Logger* log) const;
100 
101   int max_background_jobs;
102   int base_background_compactions;
103   int max_background_compactions;
104   bool avoid_flush_during_shutdown;
105   size_t writable_file_max_buffer_size;
106   uint64_t delayed_write_rate;
107   uint64_t max_total_wal_size;
108   uint64_t delete_obsolete_files_period_micros;
109   unsigned int stats_dump_period_sec;
110   unsigned int stats_persist_period_sec;
111   size_t stats_history_buffer_size;
112   int max_open_files;
113   uint64_t bytes_per_sync;
114   uint64_t wal_bytes_per_sync;
115   bool strict_bytes_per_sync;
116   size_t compaction_readahead_size;
117 };
118 
119 }  // namespace ROCKSDB_NAMESPACE
120