]>
Commit | Line | Data |
---|---|---|
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 | class SystemClock; | |
15 | ||
16 | struct ImmutableDBOptions { | |
17 | static const char* kName() { return "ImmutableDBOptions"; } | |
18 | ImmutableDBOptions(); | |
19 | explicit ImmutableDBOptions(const DBOptions& options); | |
20 | ||
21 | void Dump(Logger* log) const; | |
22 | ||
23 | bool create_if_missing; | |
24 | bool create_missing_column_families; | |
25 | bool error_if_exists; | |
26 | bool paranoid_checks; | |
27 | bool flush_verify_memtable_count; | |
28 | bool track_and_verify_wals_in_manifest; | |
29 | bool verify_sst_unique_id_in_manifest; | |
30 | Env* env; | |
31 | std::shared_ptr<RateLimiter> rate_limiter; | |
32 | std::shared_ptr<SstFileManager> sst_file_manager; | |
33 | std::shared_ptr<Logger> info_log; | |
34 | InfoLogLevel info_log_level; | |
35 | int max_file_opening_threads; | |
36 | std::shared_ptr<Statistics> statistics; | |
37 | bool use_fsync; | |
38 | std::vector<DbPath> db_paths; | |
39 | std::string db_log_dir; | |
40 | // The wal_dir option from the file. To determine the | |
41 | // directory in use, the GetWalDir or IsWalDirSameAsDBPath | |
42 | // methods should be used instead of accessing this variable directly. | |
43 | std::string wal_dir; | |
44 | size_t max_log_file_size; | |
45 | size_t log_file_time_to_roll; | |
46 | size_t keep_log_file_num; | |
47 | size_t recycle_log_file_num; | |
48 | uint64_t max_manifest_file_size; | |
49 | int table_cache_numshardbits; | |
50 | uint64_t WAL_ttl_seconds; | |
51 | uint64_t WAL_size_limit_MB; | |
52 | uint64_t max_write_batch_group_size_bytes; | |
53 | size_t manifest_preallocation_size; | |
54 | bool allow_mmap_reads; | |
55 | bool allow_mmap_writes; | |
56 | bool use_direct_reads; | |
57 | bool use_direct_io_for_flush_and_compaction; | |
58 | bool allow_fallocate; | |
59 | bool is_fd_close_on_exec; | |
60 | bool advise_random_on_open; | |
61 | size_t db_write_buffer_size; | |
62 | std::shared_ptr<WriteBufferManager> write_buffer_manager; | |
63 | DBOptions::AccessHint access_hint_on_compaction_start; | |
64 | size_t random_access_max_buffer_size; | |
65 | bool use_adaptive_mutex; | |
66 | std::vector<std::shared_ptr<EventListener>> listeners; | |
67 | bool enable_thread_tracking; | |
68 | bool enable_pipelined_write; | |
69 | bool unordered_write; | |
70 | bool allow_concurrent_memtable_write; | |
71 | bool enable_write_thread_adaptive_yield; | |
72 | uint64_t write_thread_max_yield_usec; | |
73 | uint64_t write_thread_slow_yield_usec; | |
74 | bool skip_stats_update_on_db_open; | |
75 | bool skip_checking_sst_file_sizes_on_db_open; | |
76 | WALRecoveryMode wal_recovery_mode; | |
77 | bool allow_2pc; | |
78 | std::shared_ptr<Cache> row_cache; | |
79 | #ifndef ROCKSDB_LITE | |
80 | WalFilter* wal_filter; | |
81 | #endif // ROCKSDB_LITE | |
82 | bool fail_if_options_file_error; | |
83 | bool dump_malloc_stats; | |
84 | bool avoid_flush_during_recovery; | |
85 | bool allow_ingest_behind; | |
86 | bool two_write_queues; | |
87 | bool manual_wal_flush; | |
88 | CompressionType wal_compression; | |
89 | bool atomic_flush; | |
90 | bool avoid_unnecessary_blocking_io; | |
91 | bool persist_stats_to_disk; | |
92 | bool write_dbid_to_manifest; | |
93 | size_t log_readahead_size; | |
94 | std::shared_ptr<FileChecksumGenFactory> file_checksum_gen_factory; | |
95 | bool best_efforts_recovery; | |
96 | int max_bgerror_resume_count; | |
97 | uint64_t bgerror_resume_retry_interval; | |
98 | bool allow_data_in_errors; | |
99 | std::string db_host_id; | |
100 | FileTypeSet checksum_handoff_file_types; | |
101 | CacheTier lowest_used_cache_tier; | |
102 | // Convenience/Helper objects that are not part of the base DBOptions | |
103 | std::shared_ptr<FileSystem> fs; | |
104 | SystemClock* clock; | |
105 | Statistics* stats; | |
106 | Logger* logger; | |
107 | std::shared_ptr<CompactionService> compaction_service; | |
108 | bool enforce_single_del_contracts; | |
109 | ||
110 | bool IsWalDirSameAsDBPath() const; | |
111 | bool IsWalDirSameAsDBPath(const std::string& path) const; | |
112 | const std::string& GetWalDir() const; | |
113 | const std::string& GetWalDir(const std::string& path) const; | |
114 | }; | |
115 | ||
116 | struct MutableDBOptions { | |
117 | static const char* kName() { return "MutableDBOptions"; } | |
118 | MutableDBOptions(); | |
119 | explicit MutableDBOptions(const DBOptions& options); | |
120 | ||
121 | void Dump(Logger* log) const; | |
122 | ||
123 | int max_background_jobs; | |
124 | int max_background_compactions; | |
125 | uint32_t max_subcompactions; | |
126 | bool avoid_flush_during_shutdown; | |
127 | size_t writable_file_max_buffer_size; | |
128 | uint64_t delayed_write_rate; | |
129 | uint64_t max_total_wal_size; | |
130 | uint64_t delete_obsolete_files_period_micros; | |
131 | unsigned int stats_dump_period_sec; | |
132 | unsigned int stats_persist_period_sec; | |
133 | size_t stats_history_buffer_size; | |
134 | int max_open_files; | |
135 | uint64_t bytes_per_sync; | |
136 | uint64_t wal_bytes_per_sync; | |
137 | bool strict_bytes_per_sync; | |
138 | size_t compaction_readahead_size; | |
139 | int max_background_flushes; | |
140 | }; | |
141 | ||
142 | #ifndef ROCKSDB_LITE | |
143 | Status GetStringFromMutableDBOptions(const ConfigOptions& config_options, | |
144 | const MutableDBOptions& mutable_opts, | |
145 | std::string* opt_string); | |
146 | ||
147 | Status GetMutableDBOptionsFromStrings( | |
148 | const MutableDBOptions& base_options, | |
149 | const std::unordered_map<std::string, std::string>& options_map, | |
150 | MutableDBOptions* new_options); | |
151 | ||
152 | bool MutableDBOptionsAreEqual(const MutableDBOptions& this_options, | |
153 | const MutableDBOptions& that_options); | |
154 | #endif // ROCKSDB_LITE | |
155 | ||
156 | } // namespace ROCKSDB_NAMESPACE |