1 // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
2 // This source code is licensed under the BSD-style license found in the
3 // LICENSE file in the root directory of this source tree. An additional grant
4 // of patent rights can be found in the PATENTS file in the same directory.
13 #include "options/cf_options.h"
14 #include "options/db_options.h"
15 #include "rocksdb/options.h"
16 #include "rocksdb/status.h"
17 #include "rocksdb/table.h"
21 DBOptions
BuildDBOptions(const ImmutableDBOptions
& immutable_db_options
,
22 const MutableDBOptions
& mutable_db_options
);
24 ColumnFamilyOptions
BuildColumnFamilyOptions(
25 const ColumnFamilyOptions
& ioptions
,
26 const MutableCFOptions
& mutable_cf_options
);
28 static std::map
<CompactionStyle
, std::string
> compaction_style_to_string
= {
29 {kCompactionStyleLevel
, "kCompactionStyleLevel"},
30 {kCompactionStyleUniversal
, "kCompactionStyleUniversal"},
31 {kCompactionStyleFIFO
, "kCompactionStyleFIFO"},
32 {kCompactionStyleNone
, "kCompactionStyleNone"}};
34 static std::map
<CompactionPri
, std::string
> compaction_pri_to_string
= {
35 {kByCompensatedSize
, "kByCompensatedSize"},
36 {kOldestLargestSeqFirst
, "kOldestLargestSeqFirst"},
37 {kOldestSmallestSeqFirst
, "kOldestSmallestSeqFirst"},
38 {kMinOverlappingRatio
, "kMinOverlappingRatio"}};
42 Status
GetMutableOptionsFromStrings(
43 const MutableCFOptions
& base_options
,
44 const std::unordered_map
<std::string
, std::string
>& options_map
,
45 MutableCFOptions
* new_options
);
47 Status
GetMutableDBOptionsFromStrings(
48 const MutableDBOptions
& base_options
,
49 const std::unordered_map
<std::string
, std::string
>& options_map
,
50 MutableDBOptions
* new_options
);
52 Status
GetTableFactoryFromMap(
53 const std::string
& factory_name
,
54 const std::unordered_map
<std::string
, std::string
>& opt_map
,
55 std::shared_ptr
<TableFactory
>* table_factory
);
57 Status
GetStringFromTableFactory(std::string
* opts_str
, const TableFactory
* tf
,
58 const std::string
& delimiter
= "; ");
60 enum class OptionType
{
74 kVectorCompressionType
,
78 kCompactionFilterFactory
,
81 kBlockBasedTableIndexType
,
83 kFlushBlockPolicyFactory
,
92 enum class OptionVerificationType
{
94 kByName
, // The option is pointer typed so we can only verify
95 // based on it's name.
96 kByNameAllowNull
, // Same as kByName, but it also allows the case
97 // where one of them is a nullptr.
98 kDeprecated
// The option is no longer used in rocksdb. The RocksDB
99 // OptionsParser will still accept this option if it
100 // happen to exists in some Options file. However, the
101 // parser will not include it in serialization and
102 // verification processes.
105 // A struct for storing constant option information such as option name,
106 // option type, and offset.
107 struct OptionTypeInfo
{
110 OptionVerificationType verification
;
115 // A helper function that converts "opt_address" to a std::string
116 // based on the specified OptionType.
117 bool SerializeSingleOptionHelper(const char* opt_address
,
118 const OptionType opt_type
, std::string
* value
);
120 // In addition to its public version defined in rocksdb/convenience.h,
121 // this further takes an optional output vector "unsupported_options_names",
122 // which stores the name of all the unsupported options specified in "opts_map".
123 Status
GetDBOptionsFromMapInternal(
124 const DBOptions
& base_options
,
125 const std::unordered_map
<std::string
, std::string
>& opts_map
,
126 DBOptions
* new_options
, bool input_strings_escaped
,
127 std::vector
<std::string
>* unsupported_options_names
= nullptr);
129 // In addition to its public version defined in rocksdb/convenience.h,
130 // this further takes an optional output vector "unsupported_options_names",
131 // which stores the name of all the unsupported options specified in "opts_map".
132 Status
GetColumnFamilyOptionsFromMapInternal(
133 const ColumnFamilyOptions
& base_options
,
134 const std::unordered_map
<std::string
, std::string
>& opts_map
,
135 ColumnFamilyOptions
* new_options
, bool input_strings_escaped
,
136 std::vector
<std::string
>* unsupported_options_names
= nullptr);
138 static std::unordered_map
<std::string
, OptionTypeInfo
> db_options_type_info
= {
142 std::shared_ptr<Cache> row_cache;
143 std::shared_ptr<DeleteScheduler> delete_scheduler;
144 std::shared_ptr<Logger> info_log;
145 std::shared_ptr<RateLimiter> rate_limiter;
146 std::shared_ptr<Statistics> statistics;
147 std::vector<DbPath> db_paths;
148 std::vector<std::shared_ptr<EventListener>> listeners;
150 {"advise_random_on_open",
151 {offsetof(struct DBOptions
, advise_random_on_open
), OptionType::kBoolean
,
152 OptionVerificationType::kNormal
, false, 0}},
154 {offsetof(struct DBOptions
, allow_mmap_reads
), OptionType::kBoolean
,
155 OptionVerificationType::kNormal
, false, 0}},
157 {offsetof(struct DBOptions
, allow_fallocate
), OptionType::kBoolean
,
158 OptionVerificationType::kNormal
, false, 0}},
159 {"allow_mmap_writes",
160 {offsetof(struct DBOptions
, allow_mmap_writes
), OptionType::kBoolean
,
161 OptionVerificationType::kNormal
, false, 0}},
163 {offsetof(struct DBOptions
, use_direct_reads
), OptionType::kBoolean
,
164 OptionVerificationType::kNormal
, false, 0}},
165 {"use_direct_writes",
166 {0, OptionType::kBoolean
, OptionVerificationType::kDeprecated
, false, 0}},
167 {"use_direct_io_for_flush_and_compaction",
168 {offsetof(struct DBOptions
, use_direct_io_for_flush_and_compaction
),
169 OptionType::kBoolean
, OptionVerificationType::kNormal
, false, 0}},
171 {offsetof(struct DBOptions
, allow_2pc
), OptionType::kBoolean
,
172 OptionVerificationType::kNormal
, false, 0}},
174 {0, OptionType::kBoolean
, OptionVerificationType::kDeprecated
, true, 0}},
175 {"create_if_missing",
176 {offsetof(struct DBOptions
, create_if_missing
), OptionType::kBoolean
,
177 OptionVerificationType::kNormal
, false, 0}},
178 {"create_missing_column_families",
179 {offsetof(struct DBOptions
, create_missing_column_families
),
180 OptionType::kBoolean
, OptionVerificationType::kNormal
, false, 0}},
182 {0, OptionType::kBoolean
, OptionVerificationType::kDeprecated
, false, 0}},
183 {"disable_data_sync", // for compatibility
184 {0, OptionType::kBoolean
, OptionVerificationType::kDeprecated
, false, 0}},
185 {"enable_thread_tracking",
186 {offsetof(struct DBOptions
, enable_thread_tracking
), OptionType::kBoolean
,
187 OptionVerificationType::kNormal
, false, 0}},
189 {offsetof(struct DBOptions
, error_if_exists
), OptionType::kBoolean
,
190 OptionVerificationType::kNormal
, false, 0}},
191 {"is_fd_close_on_exec",
192 {offsetof(struct DBOptions
, is_fd_close_on_exec
), OptionType::kBoolean
,
193 OptionVerificationType::kNormal
, false, 0}},
195 {offsetof(struct DBOptions
, paranoid_checks
), OptionType::kBoolean
,
196 OptionVerificationType::kNormal
, false, 0}},
197 {"skip_log_error_on_recovery",
198 {offsetof(struct DBOptions
, skip_log_error_on_recovery
),
199 OptionType::kBoolean
, OptionVerificationType::kNormal
, false, 0}},
200 {"skip_stats_update_on_db_open",
201 {offsetof(struct DBOptions
, skip_stats_update_on_db_open
),
202 OptionType::kBoolean
, OptionVerificationType::kNormal
, false, 0}},
203 {"new_table_reader_for_compaction_inputs",
204 {offsetof(struct DBOptions
, new_table_reader_for_compaction_inputs
),
205 OptionType::kBoolean
, OptionVerificationType::kNormal
, false, 0}},
206 {"compaction_readahead_size",
207 {offsetof(struct DBOptions
, compaction_readahead_size
), OptionType::kSizeT
,
208 OptionVerificationType::kNormal
, false, 0}},
209 {"random_access_max_buffer_size",
210 {offsetof(struct DBOptions
, random_access_max_buffer_size
),
211 OptionType::kSizeT
, OptionVerificationType::kNormal
, false, 0}},
212 {"writable_file_max_buffer_size",
213 {offsetof(struct DBOptions
, writable_file_max_buffer_size
),
214 OptionType::kSizeT
, OptionVerificationType::kNormal
, false, 0}},
215 {"use_adaptive_mutex",
216 {offsetof(struct DBOptions
, use_adaptive_mutex
), OptionType::kBoolean
,
217 OptionVerificationType::kNormal
, false, 0}},
219 {offsetof(struct DBOptions
, use_fsync
), OptionType::kBoolean
,
220 OptionVerificationType::kNormal
, false, 0}},
221 {"max_background_compactions",
222 {offsetof(struct DBOptions
, max_background_compactions
), OptionType::kInt
,
223 OptionVerificationType::kNormal
, true,
224 offsetof(struct MutableDBOptions
, max_background_compactions
)}},
225 {"base_background_compactions",
226 {offsetof(struct DBOptions
, base_background_compactions
), OptionType::kInt
,
227 OptionVerificationType::kNormal
, true,
228 offsetof(struct MutableDBOptions
, base_background_compactions
)}},
229 {"max_background_flushes",
230 {offsetof(struct DBOptions
, max_background_flushes
), OptionType::kInt
,
231 OptionVerificationType::kNormal
, false, 0}},
232 {"max_file_opening_threads",
233 {offsetof(struct DBOptions
, max_file_opening_threads
), OptionType::kInt
,
234 OptionVerificationType::kNormal
, false, 0}},
236 {offsetof(struct DBOptions
, max_open_files
), OptionType::kInt
,
237 OptionVerificationType::kNormal
, false, 0}},
238 {"table_cache_numshardbits",
239 {offsetof(struct DBOptions
, table_cache_numshardbits
), OptionType::kInt
,
240 OptionVerificationType::kNormal
, false, 0}},
241 {"db_write_buffer_size",
242 {offsetof(struct DBOptions
, db_write_buffer_size
), OptionType::kSizeT
,
243 OptionVerificationType::kNormal
, false, 0}},
244 {"keep_log_file_num",
245 {offsetof(struct DBOptions
, keep_log_file_num
), OptionType::kSizeT
,
246 OptionVerificationType::kNormal
, false, 0}},
247 {"recycle_log_file_num",
248 {offsetof(struct DBOptions
, recycle_log_file_num
), OptionType::kSizeT
,
249 OptionVerificationType::kNormal
, false, 0}},
250 {"log_file_time_to_roll",
251 {offsetof(struct DBOptions
, log_file_time_to_roll
), OptionType::kSizeT
,
252 OptionVerificationType::kNormal
, false, 0}},
253 {"manifest_preallocation_size",
254 {offsetof(struct DBOptions
, manifest_preallocation_size
),
255 OptionType::kSizeT
, OptionVerificationType::kNormal
, false, 0}},
256 {"max_log_file_size",
257 {offsetof(struct DBOptions
, max_log_file_size
), OptionType::kSizeT
,
258 OptionVerificationType::kNormal
, false, 0}},
260 {offsetof(struct DBOptions
, db_log_dir
), OptionType::kString
,
261 OptionVerificationType::kNormal
, false, 0}},
263 {offsetof(struct DBOptions
, wal_dir
), OptionType::kString
,
264 OptionVerificationType::kNormal
, false, 0}},
265 {"max_subcompactions",
266 {offsetof(struct DBOptions
, max_subcompactions
), OptionType::kUInt32T
,
267 OptionVerificationType::kNormal
, false, 0}},
268 {"WAL_size_limit_MB",
269 {offsetof(struct DBOptions
, WAL_size_limit_MB
), OptionType::kUInt64T
,
270 OptionVerificationType::kNormal
, false, 0}},
272 {offsetof(struct DBOptions
, WAL_ttl_seconds
), OptionType::kUInt64T
,
273 OptionVerificationType::kNormal
, false, 0}},
275 {offsetof(struct DBOptions
, bytes_per_sync
), OptionType::kUInt64T
,
276 OptionVerificationType::kNormal
, false, 0}},
277 {"delayed_write_rate",
278 {offsetof(struct DBOptions
, delayed_write_rate
), OptionType::kUInt64T
,
279 OptionVerificationType::kNormal
, true,
280 offsetof(struct MutableDBOptions
, delayed_write_rate
)}},
281 {"delete_obsolete_files_period_micros",
282 {offsetof(struct DBOptions
, delete_obsolete_files_period_micros
),
283 OptionType::kUInt64T
, OptionVerificationType::kNormal
, true,
284 offsetof(struct MutableDBOptions
, delete_obsolete_files_period_micros
)}},
285 {"max_manifest_file_size",
286 {offsetof(struct DBOptions
, max_manifest_file_size
), OptionType::kUInt64T
,
287 OptionVerificationType::kNormal
, false, 0}},
288 {"max_total_wal_size",
289 {offsetof(struct DBOptions
, max_total_wal_size
), OptionType::kUInt64T
,
290 OptionVerificationType::kNormal
, true,
291 offsetof(struct MutableDBOptions
, max_total_wal_size
)}},
292 {"wal_bytes_per_sync",
293 {offsetof(struct DBOptions
, wal_bytes_per_sync
), OptionType::kUInt64T
,
294 OptionVerificationType::kNormal
, false, 0}},
295 {"stats_dump_period_sec",
296 {offsetof(struct DBOptions
, stats_dump_period_sec
), OptionType::kUInt
,
297 OptionVerificationType::kNormal
, true,
298 offsetof(struct MutableDBOptions
, stats_dump_period_sec
)}},
299 {"fail_if_options_file_error",
300 {offsetof(struct DBOptions
, fail_if_options_file_error
),
301 OptionType::kBoolean
, OptionVerificationType::kNormal
, false, 0}},
302 {"allow_concurrent_memtable_write",
303 {offsetof(struct DBOptions
, allow_concurrent_memtable_write
),
304 OptionType::kBoolean
, OptionVerificationType::kNormal
, false, 0}},
305 {"wal_recovery_mode",
306 {offsetof(struct DBOptions
, wal_recovery_mode
),
307 OptionType::kWALRecoveryMode
, OptionVerificationType::kNormal
, false, 0}},
308 {"enable_write_thread_adaptive_yield",
309 {offsetof(struct DBOptions
, enable_write_thread_adaptive_yield
),
310 OptionType::kBoolean
, OptionVerificationType::kNormal
, false, 0}},
311 {"write_thread_slow_yield_usec",
312 {offsetof(struct DBOptions
, write_thread_slow_yield_usec
),
313 OptionType::kUInt64T
, OptionVerificationType::kNormal
, false, 0}},
314 {"write_thread_max_yield_usec",
315 {offsetof(struct DBOptions
, write_thread_max_yield_usec
),
316 OptionType::kUInt64T
, OptionVerificationType::kNormal
, false, 0}},
317 {"access_hint_on_compaction_start",
318 {offsetof(struct DBOptions
, access_hint_on_compaction_start
),
319 OptionType::kAccessHint
, OptionVerificationType::kNormal
, false, 0}},
321 {offsetof(struct DBOptions
, info_log_level
), OptionType::kInfoLogLevel
,
322 OptionVerificationType::kNormal
, false, 0}},
323 {"dump_malloc_stats",
324 {offsetof(struct DBOptions
, dump_malloc_stats
), OptionType::kBoolean
,
325 OptionVerificationType::kNormal
, false, 0}},
326 {"avoid_flush_during_recovery",
327 {offsetof(struct DBOptions
, avoid_flush_during_recovery
),
328 OptionType::kBoolean
, OptionVerificationType::kNormal
, false, 0}},
329 {"avoid_flush_during_shutdown",
330 {offsetof(struct DBOptions
, avoid_flush_during_shutdown
),
331 OptionType::kBoolean
, OptionVerificationType::kNormal
, true,
332 offsetof(struct MutableDBOptions
, avoid_flush_during_shutdown
)}}};
334 // offset_of is used to get the offset of a class data member
335 // ex: offset_of(&ColumnFamilyOptions::num_levels)
336 // This call will return the offset of num_levels in ColumnFamilyOptions class
338 // This is the same as offsetof() but allow us to work with non standard-layout
339 // classes and structures
341 // http://en.cppreference.com/w/cpp/concept/StandardLayoutType
342 // https://gist.github.com/graphitemaster/494f21190bb2c63c5516
343 template <typename T1
, typename T2
>
344 inline int offset_of(T1
T2::*member
) {
346 return int(size_t(&(obj
.*member
)) - size_t(&obj
));
349 static std::unordered_map
<std::string
, OptionTypeInfo
> cf_options_type_info
= {
351 CompactionOptionsFIFO compaction_options_fifo;
352 CompactionOptionsUniversal compaction_options_universal;
353 CompressionOptions compression_opts;
354 TablePropertiesCollectorFactories table_properties_collector_factories;
355 typedef std::vector<std::shared_ptr<TablePropertiesCollectorFactory>>
356 TablePropertiesCollectorFactories;
357 UpdateStatus (*inplace_callback)(char* existing_value,
358 uint34_t* existing_value_size,
360 std::string* merged_value);
362 {"report_bg_io_stats",
363 {offset_of(&ColumnFamilyOptions::report_bg_io_stats
), OptionType::kBoolean
,
364 OptionVerificationType::kNormal
, true,
365 offsetof(struct MutableCFOptions
, report_bg_io_stats
)}},
366 {"compaction_measure_io_stats",
367 {0, OptionType::kBoolean
, OptionVerificationType::kDeprecated
, false, 0}},
368 {"disable_auto_compactions",
369 {offset_of(&ColumnFamilyOptions::disable_auto_compactions
),
370 OptionType::kBoolean
, OptionVerificationType::kNormal
, true,
371 offsetof(struct MutableCFOptions
, disable_auto_compactions
)}},
373 {0, OptionType::kBoolean
, OptionVerificationType::kDeprecated
, true, 0}},
374 {"inplace_update_support",
375 {offset_of(&ColumnFamilyOptions::inplace_update_support
),
376 OptionType::kBoolean
, OptionVerificationType::kNormal
, false, 0}},
377 {"level_compaction_dynamic_level_bytes",
378 {offset_of(&ColumnFamilyOptions::level_compaction_dynamic_level_bytes
),
379 OptionType::kBoolean
, OptionVerificationType::kNormal
, false, 0}},
380 {"optimize_filters_for_hits",
381 {offset_of(&ColumnFamilyOptions::optimize_filters_for_hits
),
382 OptionType::kBoolean
, OptionVerificationType::kNormal
, false, 0}},
383 {"paranoid_file_checks",
384 {offset_of(&ColumnFamilyOptions::paranoid_file_checks
),
385 OptionType::kBoolean
, OptionVerificationType::kNormal
, true,
386 offsetof(struct MutableCFOptions
, paranoid_file_checks
)}},
387 {"force_consistency_checks",
388 {offset_of(&ColumnFamilyOptions::force_consistency_checks
),
389 OptionType::kBoolean
, OptionVerificationType::kNormal
, false, 0}},
390 {"purge_redundant_kvs_while_flush",
391 {offset_of(&ColumnFamilyOptions::purge_redundant_kvs_while_flush
),
392 OptionType::kBoolean
, OptionVerificationType::kNormal
, false, 0}},
393 {"verify_checksums_in_compaction",
394 {0, OptionType::kBoolean
, OptionVerificationType::kDeprecated
, true, 0}},
395 {"soft_pending_compaction_bytes_limit",
396 {offset_of(&ColumnFamilyOptions::soft_pending_compaction_bytes_limit
),
397 OptionType::kUInt64T
, OptionVerificationType::kNormal
, true,
398 offsetof(struct MutableCFOptions
, soft_pending_compaction_bytes_limit
)}},
399 {"hard_pending_compaction_bytes_limit",
400 {offset_of(&ColumnFamilyOptions::hard_pending_compaction_bytes_limit
),
401 OptionType::kUInt64T
, OptionVerificationType::kNormal
, true,
402 offsetof(struct MutableCFOptions
, hard_pending_compaction_bytes_limit
)}},
404 {0, OptionType::kDouble
, OptionVerificationType::kDeprecated
, true, 0}},
406 {0, OptionType::kDouble
, OptionVerificationType::kDeprecated
, true, 0}},
407 {"max_compaction_bytes",
408 {offset_of(&ColumnFamilyOptions::max_compaction_bytes
),
409 OptionType::kUInt64T
, OptionVerificationType::kNormal
, true,
410 offsetof(struct MutableCFOptions
, max_compaction_bytes
)}},
411 {"expanded_compaction_factor",
412 {0, OptionType::kInt
, OptionVerificationType::kDeprecated
, true, 0}},
413 {"level0_file_num_compaction_trigger",
414 {offset_of(&ColumnFamilyOptions::level0_file_num_compaction_trigger
),
415 OptionType::kInt
, OptionVerificationType::kNormal
, true,
416 offsetof(struct MutableCFOptions
, level0_file_num_compaction_trigger
)}},
417 {"level0_slowdown_writes_trigger",
418 {offset_of(&ColumnFamilyOptions::level0_slowdown_writes_trigger
),
419 OptionType::kInt
, OptionVerificationType::kNormal
, true,
420 offsetof(struct MutableCFOptions
, level0_slowdown_writes_trigger
)}},
421 {"level0_stop_writes_trigger",
422 {offset_of(&ColumnFamilyOptions::level0_stop_writes_trigger
),
423 OptionType::kInt
, OptionVerificationType::kNormal
, true,
424 offsetof(struct MutableCFOptions
, level0_stop_writes_trigger
)}},
425 {"max_grandparent_overlap_factor",
426 {0, OptionType::kInt
, OptionVerificationType::kDeprecated
, true, 0}},
427 {"max_mem_compaction_level",
428 {0, OptionType::kInt
, OptionVerificationType::kDeprecated
, false, 0}},
429 {"max_write_buffer_number",
430 {offset_of(&ColumnFamilyOptions::max_write_buffer_number
),
431 OptionType::kInt
, OptionVerificationType::kNormal
, true,
432 offsetof(struct MutableCFOptions
, max_write_buffer_number
)}},
433 {"max_write_buffer_number_to_maintain",
434 {offset_of(&ColumnFamilyOptions::max_write_buffer_number_to_maintain
),
435 OptionType::kInt
, OptionVerificationType::kNormal
, false, 0}},
436 {"min_write_buffer_number_to_merge",
437 {offset_of(&ColumnFamilyOptions::min_write_buffer_number_to_merge
),
438 OptionType::kInt
, OptionVerificationType::kNormal
, false, 0}},
440 {offset_of(&ColumnFamilyOptions::num_levels
), OptionType::kInt
,
441 OptionVerificationType::kNormal
, false, 0}},
442 {"source_compaction_factor",
443 {0, OptionType::kInt
, OptionVerificationType::kDeprecated
, true, 0}},
444 {"target_file_size_multiplier",
445 {offset_of(&ColumnFamilyOptions::target_file_size_multiplier
),
446 OptionType::kInt
, OptionVerificationType::kNormal
, true,
447 offsetof(struct MutableCFOptions
, target_file_size_multiplier
)}},
449 {offset_of(&ColumnFamilyOptions::arena_block_size
), OptionType::kSizeT
,
450 OptionVerificationType::kNormal
, true,
451 offsetof(struct MutableCFOptions
, arena_block_size
)}},
452 {"inplace_update_num_locks",
453 {offset_of(&ColumnFamilyOptions::inplace_update_num_locks
),
454 OptionType::kSizeT
, OptionVerificationType::kNormal
, true,
455 offsetof(struct MutableCFOptions
, inplace_update_num_locks
)}},
456 {"max_successive_merges",
457 {offset_of(&ColumnFamilyOptions::max_successive_merges
),
458 OptionType::kSizeT
, OptionVerificationType::kNormal
, true,
459 offsetof(struct MutableCFOptions
, max_successive_merges
)}},
460 {"memtable_huge_page_size",
461 {offset_of(&ColumnFamilyOptions::memtable_huge_page_size
),
462 OptionType::kSizeT
, OptionVerificationType::kNormal
, true,
463 offsetof(struct MutableCFOptions
, memtable_huge_page_size
)}},
464 {"memtable_prefix_bloom_huge_page_tlb_size",
465 {0, OptionType::kSizeT
, OptionVerificationType::kDeprecated
, true, 0}},
466 {"write_buffer_size",
467 {offset_of(&ColumnFamilyOptions::write_buffer_size
), OptionType::kSizeT
,
468 OptionVerificationType::kNormal
, true,
469 offsetof(struct MutableCFOptions
, write_buffer_size
)}},
471 {offset_of(&ColumnFamilyOptions::bloom_locality
), OptionType::kUInt32T
,
472 OptionVerificationType::kNormal
, false, 0}},
473 {"memtable_prefix_bloom_bits",
474 {0, OptionType::kUInt32T
, OptionVerificationType::kDeprecated
, true, 0}},
475 {"memtable_prefix_bloom_size_ratio",
476 {offset_of(&ColumnFamilyOptions::memtable_prefix_bloom_size_ratio
),
477 OptionType::kDouble
, OptionVerificationType::kNormal
, true,
478 offsetof(struct MutableCFOptions
, memtable_prefix_bloom_size_ratio
)}},
479 {"memtable_prefix_bloom_probes",
480 {0, OptionType::kUInt32T
, OptionVerificationType::kDeprecated
, true, 0}},
481 {"min_partial_merge_operands",
482 {0, OptionType::kUInt32T
, OptionVerificationType::kDeprecated
, true, 0}},
483 {"max_bytes_for_level_base",
484 {offset_of(&ColumnFamilyOptions::max_bytes_for_level_base
),
485 OptionType::kUInt64T
, OptionVerificationType::kNormal
, true,
486 offsetof(struct MutableCFOptions
, max_bytes_for_level_base
)}},
487 {"max_bytes_for_level_multiplier",
488 {offset_of(&ColumnFamilyOptions::max_bytes_for_level_multiplier
),
489 OptionType::kDouble
, OptionVerificationType::kNormal
, true,
490 offsetof(struct MutableCFOptions
, max_bytes_for_level_multiplier
)}},
491 {"max_bytes_for_level_multiplier_additional",
493 &ColumnFamilyOptions::max_bytes_for_level_multiplier_additional
),
494 OptionType::kVectorInt
, OptionVerificationType::kNormal
, true,
495 offsetof(struct MutableCFOptions
,
496 max_bytes_for_level_multiplier_additional
)}},
497 {"max_sequential_skip_in_iterations",
498 {offset_of(&ColumnFamilyOptions::max_sequential_skip_in_iterations
),
499 OptionType::kUInt64T
, OptionVerificationType::kNormal
, true,
500 offsetof(struct MutableCFOptions
, max_sequential_skip_in_iterations
)}},
501 {"target_file_size_base",
502 {offset_of(&ColumnFamilyOptions::target_file_size_base
),
503 OptionType::kUInt64T
, OptionVerificationType::kNormal
, true,
504 offsetof(struct MutableCFOptions
, target_file_size_base
)}},
505 {"rate_limit_delay_max_milliseconds",
506 {0, OptionType::kUInt
, OptionVerificationType::kDeprecated
, false, 0}},
508 {offset_of(&ColumnFamilyOptions::compression
),
509 OptionType::kCompressionType
, OptionVerificationType::kNormal
, true,
510 offsetof(struct MutableCFOptions
, compression
)}},
511 {"compression_per_level",
512 {offset_of(&ColumnFamilyOptions::compression_per_level
),
513 OptionType::kVectorCompressionType
, OptionVerificationType::kNormal
,
515 {"bottommost_compression",
516 {offset_of(&ColumnFamilyOptions::bottommost_compression
),
517 OptionType::kCompressionType
, OptionVerificationType::kNormal
, false, 0}},
519 {offset_of(&ColumnFamilyOptions::comparator
), OptionType::kComparator
,
520 OptionVerificationType::kByName
, false, 0}},
522 {offset_of(&ColumnFamilyOptions::prefix_extractor
),
523 OptionType::kSliceTransform
, OptionVerificationType::kByNameAllowNull
,
525 {"memtable_insert_with_hint_prefix_extractor",
527 &ColumnFamilyOptions::memtable_insert_with_hint_prefix_extractor
),
528 OptionType::kSliceTransform
, OptionVerificationType::kByNameAllowNull
,
531 {offset_of(&ColumnFamilyOptions::memtable_factory
),
532 OptionType::kMemTableRepFactory
, OptionVerificationType::kByName
, false,
535 {offset_of(&ColumnFamilyOptions::table_factory
), OptionType::kTableFactory
,
536 OptionVerificationType::kByName
, false, 0}},
537 {"compaction_filter",
538 {offset_of(&ColumnFamilyOptions::compaction_filter
),
539 OptionType::kCompactionFilter
, OptionVerificationType::kByName
, false,
541 {"compaction_filter_factory",
542 {offset_of(&ColumnFamilyOptions::compaction_filter_factory
),
543 OptionType::kCompactionFilterFactory
, OptionVerificationType::kByName
,
546 {offset_of(&ColumnFamilyOptions::merge_operator
),
547 OptionType::kMergeOperator
, OptionVerificationType::kByName
, false, 0}},
549 {offset_of(&ColumnFamilyOptions::compaction_style
),
550 OptionType::kCompactionStyle
, OptionVerificationType::kNormal
, false, 0}},
552 {offset_of(&ColumnFamilyOptions::compaction_pri
),
553 OptionType::kCompactionPri
, OptionVerificationType::kNormal
, false, 0}}};
555 static std::unordered_map
<std::string
, OptionTypeInfo
>
556 block_based_table_type_info
= {
557 /* currently not supported
558 std::shared_ptr<Cache> block_cache = nullptr;
559 std::shared_ptr<Cache> block_cache_compressed = nullptr;
561 {"flush_block_policy_factory",
562 {offsetof(struct BlockBasedTableOptions
, flush_block_policy_factory
),
563 OptionType::kFlushBlockPolicyFactory
, OptionVerificationType::kByName
,
565 {"cache_index_and_filter_blocks",
566 {offsetof(struct BlockBasedTableOptions
,
567 cache_index_and_filter_blocks
),
568 OptionType::kBoolean
, OptionVerificationType::kNormal
, false, 0}},
569 {"cache_index_and_filter_blocks_with_high_priority",
570 {offsetof(struct BlockBasedTableOptions
,
571 cache_index_and_filter_blocks_with_high_priority
),
572 OptionType::kBoolean
, OptionVerificationType::kNormal
, false, 0}},
573 {"pin_l0_filter_and_index_blocks_in_cache",
574 {offsetof(struct BlockBasedTableOptions
,
575 pin_l0_filter_and_index_blocks_in_cache
),
576 OptionType::kBoolean
, OptionVerificationType::kNormal
, false, 0}},
578 {offsetof(struct BlockBasedTableOptions
, index_type
),
579 OptionType::kBlockBasedTableIndexType
,
580 OptionVerificationType::kNormal
, false, 0}},
581 {"hash_index_allow_collision",
582 {offsetof(struct BlockBasedTableOptions
, hash_index_allow_collision
),
583 OptionType::kBoolean
, OptionVerificationType::kNormal
, false, 0}},
585 {offsetof(struct BlockBasedTableOptions
, checksum
),
586 OptionType::kChecksumType
, OptionVerificationType::kNormal
, false,
589 {offsetof(struct BlockBasedTableOptions
, no_block_cache
),
590 OptionType::kBoolean
, OptionVerificationType::kNormal
, false, 0}},
592 {offsetof(struct BlockBasedTableOptions
, block_size
),
593 OptionType::kSizeT
, OptionVerificationType::kNormal
, false, 0}},
594 {"block_size_deviation",
595 {offsetof(struct BlockBasedTableOptions
, block_size_deviation
),
596 OptionType::kInt
, OptionVerificationType::kNormal
, false, 0}},
597 {"block_restart_interval",
598 {offsetof(struct BlockBasedTableOptions
, block_restart_interval
),
599 OptionType::kInt
, OptionVerificationType::kNormal
, false, 0}},
600 {"index_block_restart_interval",
601 {offsetof(struct BlockBasedTableOptions
, index_block_restart_interval
),
602 OptionType::kInt
, OptionVerificationType::kNormal
, false, 0}},
603 {"index_per_partition",
604 {0, OptionType::kUInt64T
, OptionVerificationType::kDeprecated
, false,
606 {"metadata_block_size",
607 {offsetof(struct BlockBasedTableOptions
, metadata_block_size
),
608 OptionType::kUInt64T
, OptionVerificationType::kNormal
, false, 0}},
609 {"partition_filters",
610 {offsetof(struct BlockBasedTableOptions
, partition_filters
),
611 OptionType::kBoolean
, OptionVerificationType::kNormal
, false, 0}},
613 {offsetof(struct BlockBasedTableOptions
, filter_policy
),
614 OptionType::kFilterPolicy
, OptionVerificationType::kByName
, false,
616 {"whole_key_filtering",
617 {offsetof(struct BlockBasedTableOptions
, whole_key_filtering
),
618 OptionType::kBoolean
, OptionVerificationType::kNormal
, false, 0}},
619 {"skip_table_builder_flush",
620 {0, OptionType::kBoolean
, OptionVerificationType::kDeprecated
, false,
623 {offsetof(struct BlockBasedTableOptions
, format_version
),
624 OptionType::kUInt32T
, OptionVerificationType::kNormal
, false, 0}},
625 {"verify_compression",
626 {offsetof(struct BlockBasedTableOptions
, verify_compression
),
627 OptionType::kBoolean
, OptionVerificationType::kNormal
, false, 0}},
628 {"read_amp_bytes_per_bit",
629 {offsetof(struct BlockBasedTableOptions
, read_amp_bytes_per_bit
),
630 OptionType::kSizeT
, OptionVerificationType::kNormal
, false, 0}}};
632 static std::unordered_map
<std::string
, OptionTypeInfo
> plain_table_type_info
= {
634 {offsetof(struct PlainTableOptions
, user_key_len
), OptionType::kUInt32T
,
635 OptionVerificationType::kNormal
, false, 0}},
636 {"bloom_bits_per_key",
637 {offsetof(struct PlainTableOptions
, bloom_bits_per_key
), OptionType::kInt
,
638 OptionVerificationType::kNormal
, false, 0}},
640 {offsetof(struct PlainTableOptions
, hash_table_ratio
), OptionType::kDouble
,
641 OptionVerificationType::kNormal
, false, 0}},
643 {offsetof(struct PlainTableOptions
, index_sparseness
), OptionType::kSizeT
,
644 OptionVerificationType::kNormal
, false, 0}},
645 {"huge_page_tlb_size",
646 {offsetof(struct PlainTableOptions
, huge_page_tlb_size
),
647 OptionType::kSizeT
, OptionVerificationType::kNormal
, false, 0}},
649 {offsetof(struct PlainTableOptions
, encoding_type
),
650 OptionType::kEncodingType
, OptionVerificationType::kByName
, false, 0}},
652 {offsetof(struct PlainTableOptions
, full_scan_mode
), OptionType::kBoolean
,
653 OptionVerificationType::kNormal
, false, 0}},
654 {"store_index_in_file",
655 {offsetof(struct PlainTableOptions
, store_index_in_file
),
656 OptionType::kBoolean
, OptionVerificationType::kNormal
, false, 0}}};
658 static std::unordered_map
<std::string
, CompressionType
>
659 compression_type_string_map
= {
660 {"kNoCompression", kNoCompression
},
661 {"kSnappyCompression", kSnappyCompression
},
662 {"kZlibCompression", kZlibCompression
},
663 {"kBZip2Compression", kBZip2Compression
},
664 {"kLZ4Compression", kLZ4Compression
},
665 {"kLZ4HCCompression", kLZ4HCCompression
},
666 {"kXpressCompression", kXpressCompression
},
668 {"kZSTDNotFinalCompression", kZSTDNotFinalCompression
},
669 {"kDisableCompressionOption", kDisableCompressionOption
}};
671 static std::unordered_map
<std::string
, BlockBasedTableOptions::IndexType
>
672 block_base_table_index_type_string_map
= {
673 {"kBinarySearch", BlockBasedTableOptions::IndexType::kBinarySearch
},
674 {"kHashSearch", BlockBasedTableOptions::IndexType::kHashSearch
},
675 {"kTwoLevelIndexSearch",
676 BlockBasedTableOptions::IndexType::kTwoLevelIndexSearch
}};
678 static std::unordered_map
<std::string
, EncodingType
> encoding_type_string_map
=
679 {{"kPlain", kPlain
}, {"kPrefix", kPrefix
}};
681 static std::unordered_map
<std::string
, ChecksumType
> checksum_type_string_map
=
682 {{"kNoChecksum", kNoChecksum
}, {"kCRC32c", kCRC32c
}, {"kxxHash", kxxHash
}};
684 static std::unordered_map
<std::string
, CompactionStyle
>
685 compaction_style_string_map
= {
686 {"kCompactionStyleLevel", kCompactionStyleLevel
},
687 {"kCompactionStyleUniversal", kCompactionStyleUniversal
},
688 {"kCompactionStyleFIFO", kCompactionStyleFIFO
},
689 {"kCompactionStyleNone", kCompactionStyleNone
}};
691 static std::unordered_map
<std::string
, CompactionPri
>
692 compaction_pri_string_map
= {
693 {"kByCompensatedSize", kByCompensatedSize
},
694 {"kOldestLargestSeqFirst", kOldestLargestSeqFirst
},
695 {"kOldestSmallestSeqFirst", kOldestSmallestSeqFirst
},
696 {"kMinOverlappingRatio", kMinOverlappingRatio
}};
698 static std::unordered_map
<std::string
,
699 WALRecoveryMode
> wal_recovery_mode_string_map
= {
700 {"kTolerateCorruptedTailRecords",
701 WALRecoveryMode::kTolerateCorruptedTailRecords
},
702 {"kAbsoluteConsistency", WALRecoveryMode::kAbsoluteConsistency
},
703 {"kPointInTimeRecovery", WALRecoveryMode::kPointInTimeRecovery
},
704 {"kSkipAnyCorruptedRecords", WALRecoveryMode::kSkipAnyCorruptedRecords
}};
706 static std::unordered_map
<std::string
, DBOptions::AccessHint
>
707 access_hint_string_map
= {{"NONE", DBOptions::AccessHint::NONE
},
708 {"NORMAL", DBOptions::AccessHint::NORMAL
},
709 {"SEQUENTIAL", DBOptions::AccessHint::SEQUENTIAL
},
710 {"WILLNEED", DBOptions::AccessHint::WILLNEED
}};
712 static std::unordered_map
<std::string
, InfoLogLevel
> info_log_level_string_map
=
713 {{"DEBUG_LEVEL", InfoLogLevel::DEBUG_LEVEL
},
714 {"INFO_LEVEL", InfoLogLevel::INFO_LEVEL
},
715 {"WARN_LEVEL", InfoLogLevel::WARN_LEVEL
},
716 {"ERROR_LEVEL", InfoLogLevel::ERROR_LEVEL
},
717 {"FATAL_LEVEL", InfoLogLevel::FATAL_LEVEL
},
718 {"HEADER_LEVEL", InfoLogLevel::HEADER_LEVEL
}};
720 #endif // !ROCKSDB_LITE
722 } // namespace rocksdb