Coverage Report

Created: 2026-04-10 07:52

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
348k
  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
  int table_cache_numshardbits;
52
  uint64_t WAL_ttl_seconds;
53
  uint64_t WAL_size_limit_MB;
54
  uint64_t max_write_batch_group_size_bytes;
55
  bool allow_mmap_reads;
56
  bool allow_mmap_writes;
57
  bool use_direct_reads;
58
  bool use_direct_io_for_flush_and_compaction;
59
  bool allow_fallocate;
60
  bool is_fd_close_on_exec;
61
  bool advise_random_on_open;
62
  size_t db_write_buffer_size;
63
  std::shared_ptr<WriteBufferManager> write_buffer_manager;
64
  bool use_adaptive_mutex;
65
  std::vector<std::shared_ptr<EventListener>> listeners;
66
  bool enable_thread_tracking;
67
  bool enable_pipelined_write;
68
  bool unordered_write;
69
  bool allow_concurrent_memtable_write;
70
  bool enable_write_thread_adaptive_yield;
71
  uint64_t write_thread_max_yield_usec;
72
  uint64_t write_thread_slow_yield_usec;
73
  bool skip_stats_update_on_db_open;
74
  WALRecoveryMode wal_recovery_mode;
75
  bool allow_2pc;
76
  std::shared_ptr<Cache> row_cache;
77
  WalFilter* wal_filter;
78
  bool dump_malloc_stats;
79
  bool avoid_flush_during_recovery;
80
  bool enforce_write_buffer_manager_during_recovery;
81
  bool allow_ingest_behind;
82
  bool two_write_queues;
83
  bool manual_wal_flush;
84
  CompressionType wal_compression;
85
  bool background_close_inactive_wals;
86
  bool atomic_flush;
87
  bool avoid_unnecessary_blocking_io;
88
  bool prefix_seek_opt_in_only;
89
  bool persist_stats_to_disk;
90
  bool write_dbid_to_manifest;
91
  bool write_identity_file;
92
  size_t log_readahead_size;
93
  std::shared_ptr<FileChecksumGenFactory> file_checksum_gen_factory;
94
  bool best_efforts_recovery;
95
  int max_bgerror_resume_count;
96
  uint64_t bgerror_resume_retry_interval;
97
  bool allow_data_in_errors;
98
  std::string db_host_id;
99
  FileTypeSet checksum_handoff_file_types;
100
  CacheTier lowest_used_cache_tier;
101
  std::shared_ptr<CompactionService> compaction_service;
102
  bool enforce_single_del_contracts;
103
  uint64_t follower_refresh_catchup_period_ms;
104
  uint64_t follower_catchup_retry_count;
105
  uint64_t follower_catchup_retry_wait_ms;
106
  Temperature metadata_write_temperature;
107
  Temperature wal_write_temperature;
108
  CompactionStyleSet calculate_sst_write_lifetime_hint_set;
109
110
  // Beginning convenience/helper objects that are not part of the base
111
  // DBOptions
112
  std::shared_ptr<FileSystem> fs;
113
  SystemClock* clock;
114
  Statistics* stats;
115
  Logger* logger;
116
  // End of convenience/helper objects.
117
118
  bool IsWalDirSameAsDBPath() const;
119
  bool IsWalDirSameAsDBPath(const std::string& path) const;
120
  const std::string& GetWalDir() const;
121
  const std::string& GetWalDir(const std::string& path) const;
122
};
123
124
struct MutableDBOptions {
125
348k
  static const char* kName() { return "MutableDBOptions"; }
126
  MutableDBOptions();
127
  explicit MutableDBOptions(const DBOptions& options);
128
129
  void Dump(Logger* log) const;
130
131
  int max_background_jobs;
132
  int max_background_compactions;
133
  uint32_t max_subcompactions;
134
  bool avoid_flush_during_shutdown;
135
  size_t writable_file_max_buffer_size;
136
  uint64_t delayed_write_rate;
137
  uint64_t max_total_wal_size;
138
  uint64_t delete_obsolete_files_period_micros;
139
  unsigned int stats_dump_period_sec;
140
  unsigned int stats_persist_period_sec;
141
  size_t stats_history_buffer_size;
142
  int max_open_files;
143
  uint64_t bytes_per_sync;
144
  uint64_t wal_bytes_per_sync;
145
  bool strict_bytes_per_sync;
146
  size_t compaction_readahead_size;
147
  int max_background_flushes;
148
  uint64_t max_manifest_file_size;
149
  int max_manifest_space_amp_pct;
150
  size_t manifest_preallocation_size;
151
  bool verify_manifest_content_on_close;
152
  std::string daily_offpeak_time_utc;
153
  uint64_t max_compaction_trigger_wakeup_seconds;
154
};
155
156
Status GetStringFromMutableDBOptions(const ConfigOptions& config_options,
157
                                     const MutableDBOptions& mutable_opts,
158
                                     std::string* opt_string);
159
160
Status GetMutableDBOptionsFromStrings(
161
    const MutableDBOptions& base_options,
162
    const std::unordered_map<std::string, std::string>& options_map,
163
    MutableDBOptions* new_options);
164
165
bool MutableDBOptionsAreEqual(const MutableDBOptions& this_options,
166
                              const MutableDBOptions& that_options);
167
168
}  // namespace ROCKSDB_NAMESPACE