Coverage Report

Created: 2026-05-31 07:45

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/rocksdb/options/db_options.h
Line
Count
Source
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
415k
  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 open_files_async;
28
  bool flush_verify_memtable_count;
29
  bool compaction_verify_record_count;
30
  bool track_and_verify_wals_in_manifest;
31
  bool track_and_verify_wals;
32
  bool verify_sst_unique_id_in_manifest;
33
  Env* env;
34
  std::shared_ptr<RateLimiter> rate_limiter;
35
  std::shared_ptr<SstFileManager> sst_file_manager;
36
  std::shared_ptr<Logger> info_log;
37
  InfoLogLevel info_log_level;
38
  int max_file_opening_threads;
39
  std::shared_ptr<Statistics> statistics;
40
  bool use_fsync;
41
  std::vector<DbPath> db_paths;
42
  std::string db_log_dir;
43
  // The wal_dir option from the file.  To determine the
44
  // directory in use, the GetWalDir or IsWalDirSameAsDBPath
45
  // methods should be used instead of accessing this variable directly.
46
  std::string wal_dir;
47
  size_t max_log_file_size;
48
  size_t log_file_time_to_roll;
49
  size_t keep_log_file_num;
50
  size_t recycle_log_file_num;
51
  // Immutable copy of DBOptions::async_wal_precreate.
52
  bool async_wal_precreate;
53
  int table_cache_numshardbits;
54
  uint64_t WAL_ttl_seconds;
55
  uint64_t WAL_size_limit_MB;
56
  uint64_t max_write_batch_group_size_bytes;
57
  bool allow_mmap_reads;
58
  bool allow_mmap_writes;
59
  bool use_direct_reads;
60
  bool use_direct_io_for_flush_and_compaction;
61
  bool allow_fallocate;
62
  bool is_fd_close_on_exec;
63
  bool advise_random_on_open;
64
  size_t db_write_buffer_size;
65
  std::shared_ptr<WriteBufferManager> write_buffer_manager;
66
  bool use_adaptive_mutex;
67
  std::vector<std::shared_ptr<EventListener>> listeners;
68
  bool enable_thread_tracking;
69
  bool enable_pipelined_write;
70
  bool unordered_write;
71
  bool allow_concurrent_memtable_write;
72
  bool enable_write_thread_adaptive_yield;
73
  uint64_t write_thread_max_yield_usec;
74
  uint64_t write_thread_slow_yield_usec;
75
  bool skip_stats_update_on_db_open;
76
  WALRecoveryMode wal_recovery_mode;
77
  bool allow_2pc;
78
  std::shared_ptr<Cache> row_cache;
79
  WalFilter* wal_filter;
80
  bool dump_malloc_stats;
81
  bool avoid_flush_during_recovery;
82
  bool enforce_write_buffer_manager_during_recovery;
83
  bool allow_ingest_behind;
84
  bool two_write_queues;
85
  bool manual_wal_flush;
86
  CompressionType wal_compression;
87
  bool background_close_inactive_wals;
88
  bool atomic_flush;
89
  bool avoid_unnecessary_blocking_io;
90
  bool prefix_seek_opt_in_only;
91
  bool persist_stats_to_disk;
92
  bool write_dbid_to_manifest;
93
  bool reuse_manifest_on_open;
94
  bool write_identity_file;
95
  size_t log_readahead_size;
96
  std::shared_ptr<FileChecksumGenFactory> file_checksum_gen_factory;
97
  bool best_efforts_recovery;
98
  int max_bgerror_resume_count;
99
  uint64_t bgerror_resume_retry_interval;
100
  bool allow_data_in_errors;
101
  std::string db_host_id;
102
  FileTypeSet checksum_handoff_file_types;
103
  CacheTier lowest_used_cache_tier;
104
  std::shared_ptr<CompactionService> compaction_service;
105
  bool enforce_single_del_contracts;
106
  uint64_t follower_refresh_catchup_period_ms;
107
  uint64_t follower_catchup_retry_count;
108
  uint64_t follower_catchup_retry_wait_ms;
109
  Temperature metadata_write_temperature;
110
  Temperature wal_write_temperature;
111
  CompactionStyleSet calculate_sst_write_lifetime_hint_set;
112
113
  // Beginning convenience/helper objects that are not part of the base
114
  // DBOptions
115
  std::shared_ptr<FileSystem> fs;
116
  SystemClock* clock;
117
  Statistics* stats;
118
  Logger* logger;
119
  // End of convenience/helper objects.
120
121
  bool IsWalDirSameAsDBPath() const;
122
  bool IsWalDirSameAsDBPath(const std::string& path) const;
123
  const std::string& GetWalDir() const;
124
  const std::string& GetWalDir(const std::string& path) const;
125
};
126
127
struct MutableDBOptions {
128
415k
  static const char* kName() { return "MutableDBOptions"; }
129
  MutableDBOptions();
130
  explicit MutableDBOptions(const DBOptions& options);
131
132
  void Dump(Logger* log) const;
133
134
  int max_background_jobs;
135
  int max_background_compactions;
136
  uint32_t max_subcompactions;
137
  bool avoid_flush_during_shutdown;
138
  size_t writable_file_max_buffer_size;
139
  uint64_t delayed_write_rate;
140
  uint64_t max_total_wal_size;
141
  uint64_t delete_obsolete_files_period_micros;
142
  unsigned int stats_dump_period_sec;
143
  unsigned int stats_persist_period_sec;
144
  size_t stats_history_buffer_size;
145
  int max_open_files;
146
  uint64_t bytes_per_sync;
147
  uint64_t wal_bytes_per_sync;
148
  bool strict_bytes_per_sync;
149
  size_t compaction_readahead_size;
150
  int max_background_flushes;
151
  uint64_t max_manifest_file_size;
152
  int max_manifest_space_amp_pct;
153
  size_t manifest_preallocation_size;
154
  bool verify_manifest_content_on_close;
155
  bool optimize_manifest_for_recovery;
156
  bool fast_sst_open;
157
  std::string daily_offpeak_time_utc;
158
  uint64_t max_compaction_trigger_wakeup_seconds;
159
};
160
161
Status GetStringFromMutableDBOptions(const ConfigOptions& config_options,
162
                                     const MutableDBOptions& mutable_opts,
163
                                     std::string* opt_string);
164
165
Status GetMutableDBOptionsFromStrings(
166
    const MutableDBOptions& base_options,
167
    const std::unordered_map<std::string, std::string>& options_map,
168
    MutableDBOptions* new_options);
169
170
bool MutableDBOptionsAreEqual(const MutableDBOptions& this_options,
171
                              const MutableDBOptions& that_options);
172
173
}  // namespace ROCKSDB_NAMESPACE