2016-02-09 23:12:00 +00:00
|
|
|
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
|
2017-07-15 23:03:42 +00:00
|
|
|
// This source code is licensed under both the GPLv2 (found in the
|
|
|
|
// COPYING file in the root directory) and Apache 2.0 License
|
|
|
|
// (found in the LICENSE.Apache file in the root directory).
|
2014-09-17 19:49:13 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2017-02-07 18:35:15 +00:00
|
|
|
#include <map>
|
2014-11-18 21:21:02 +00:00
|
|
|
#include <stdexcept>
|
2016-09-20 20:02:41 +00:00
|
|
|
#include <string>
|
Add OptionsUtil::LoadOptionsFromFile() API
Summary:
This patch adds OptionsUtil::LoadOptionsFromFile() and
OptionsUtil::LoadLatestOptionsFromDB(), which allow developers
to construct DBOptions and ColumnFamilyOptions from a RocksDB
options file. Note that most pointer-typed options such as
merge_operator will not be constructed.
With this API, developers no longer need to remember all the
options in order to reopen an existing rocksdb instance like
the following:
DBOptions db_options;
std::vector<std::string> cf_names;
std::vector<ColumnFamilyOptions> cf_opts;
// Load primitive-typed options from an existing DB
OptionsUtil::LoadLatestOptionsFromDB(
dbname, &db_options, &cf_names, &cf_opts);
// Initialize necessary pointer-typed options
cf_opts[0].merge_operator.reset(new MyMergeOperator());
...
// Construct the vector of ColumnFamilyDescriptor
std::vector<ColumnFamilyDescriptor> cf_descs;
for (size_t i = 0; i < cf_opts.size(); ++i) {
cf_descs.emplace_back(cf_names[i], cf_opts[i]);
}
// Open the DB
DB* db = nullptr;
std::vector<ColumnFamilyHandle*> cf_handles;
auto s = DB::Open(db_options, dbname, cf_descs,
&handles, &db);
Test Plan:
Augment existing tests in column_family_test
options_test
db_test
Reviewers: igor, IslamAbdelRahman, sdong, anthony
Reviewed By: anthony
Subscribers: dhruba, leveldb
Differential Revision: https://reviews.facebook.net/D49095
2015-11-12 14:52:43 +00:00
|
|
|
#include <vector>
|
|
|
|
|
2017-04-06 02:02:00 +00:00
|
|
|
#include "options/cf_options.h"
|
|
|
|
#include "options/db_options.h"
|
2015-08-26 23:13:56 +00:00
|
|
|
#include "rocksdb/options.h"
|
2014-11-05 00:23:05 +00:00
|
|
|
#include "rocksdb/status.h"
|
2015-10-11 19:17:42 +00:00
|
|
|
#include "rocksdb/table.h"
|
2014-09-17 19:49:13 +00:00
|
|
|
|
|
|
|
namespace rocksdb {
|
|
|
|
|
2016-09-23 23:34:04 +00:00
|
|
|
DBOptions BuildDBOptions(const ImmutableDBOptions& immutable_db_options,
|
|
|
|
const MutableDBOptions& mutable_db_options);
|
|
|
|
|
2016-09-15 05:10:28 +00:00
|
|
|
ColumnFamilyOptions BuildColumnFamilyOptions(
|
|
|
|
const ColumnFamilyOptions& ioptions,
|
|
|
|
const MutableCFOptions& mutable_cf_options);
|
|
|
|
|
2017-02-07 18:35:15 +00:00
|
|
|
static std::map<CompactionStyle, std::string> compaction_style_to_string = {
|
|
|
|
{kCompactionStyleLevel, "kCompactionStyleLevel"},
|
|
|
|
{kCompactionStyleUniversal, "kCompactionStyleUniversal"},
|
|
|
|
{kCompactionStyleFIFO, "kCompactionStyleFIFO"},
|
|
|
|
{kCompactionStyleNone, "kCompactionStyleNone"}};
|
|
|
|
|
|
|
|
static std::map<CompactionPri, std::string> compaction_pri_to_string = {
|
|
|
|
{kByCompensatedSize, "kByCompensatedSize"},
|
|
|
|
{kOldestLargestSeqFirst, "kOldestLargestSeqFirst"},
|
|
|
|
{kOldestSmallestSeqFirst, "kOldestSmallestSeqFirst"},
|
|
|
|
{kMinOverlappingRatio, "kMinOverlappingRatio"}};
|
|
|
|
|
2017-05-09 22:44:48 +00:00
|
|
|
static std::map<CompactionStopStyle, std::string>
|
|
|
|
compaction_stop_style_to_string = {
|
|
|
|
{kCompactionStopStyleSimilarSize, "kCompactionStopStyleSimilarSize"},
|
|
|
|
{kCompactionStopStyleTotalSize, "kCompactionStopStyleTotalSize"}};
|
|
|
|
|
2016-09-15 05:10:28 +00:00
|
|
|
#ifndef ROCKSDB_LITE
|
|
|
|
|
2014-11-05 00:23:05 +00:00
|
|
|
Status GetMutableOptionsFromStrings(
|
2014-09-17 19:49:13 +00:00
|
|
|
const MutableCFOptions& base_options,
|
|
|
|
const std::unordered_map<std::string, std::string>& options_map,
|
|
|
|
MutableCFOptions* new_options);
|
|
|
|
|
2016-10-14 19:25:39 +00:00
|
|
|
Status GetMutableDBOptionsFromStrings(
|
|
|
|
const MutableDBOptions& base_options,
|
|
|
|
const std::unordered_map<std::string, std::string>& options_map,
|
|
|
|
MutableDBOptions* new_options);
|
|
|
|
|
2015-10-11 19:17:42 +00:00
|
|
|
Status GetTableFactoryFromMap(
|
|
|
|
const std::string& factory_name,
|
|
|
|
const std::unordered_map<std::string, std::string>& opt_map,
|
2017-06-13 23:55:08 +00:00
|
|
|
std::shared_ptr<TableFactory>* table_factory,
|
|
|
|
bool ignore_unknown_options = false);
|
2015-10-11 19:17:42 +00:00
|
|
|
|
2015-08-18 20:30:18 +00:00
|
|
|
enum class OptionType {
|
|
|
|
kBoolean,
|
|
|
|
kInt,
|
2016-09-14 04:12:43 +00:00
|
|
|
kVectorInt,
|
2015-08-18 20:30:18 +00:00
|
|
|
kUInt,
|
|
|
|
kUInt32T,
|
|
|
|
kUInt64T,
|
|
|
|
kSizeT,
|
|
|
|
kString,
|
2015-08-26 23:13:56 +00:00
|
|
|
kDouble,
|
|
|
|
kCompactionStyle,
|
2017-03-02 18:08:49 +00:00
|
|
|
kCompactionPri,
|
2015-10-02 22:35:32 +00:00
|
|
|
kSliceTransform,
|
|
|
|
kCompressionType,
|
|
|
|
kVectorCompressionType,
|
|
|
|
kTableFactory,
|
|
|
|
kComparator,
|
|
|
|
kCompactionFilter,
|
|
|
|
kCompactionFilterFactory,
|
|
|
|
kMergeOperator,
|
|
|
|
kMemTableRepFactory,
|
2015-10-11 19:17:42 +00:00
|
|
|
kBlockBasedTableIndexType,
|
|
|
|
kFilterPolicy,
|
|
|
|
kFlushBlockPolicyFactory,
|
|
|
|
kChecksumType,
|
2015-10-28 17:46:01 +00:00
|
|
|
kEncodingType,
|
2016-03-02 18:34:14 +00:00
|
|
|
kWALRecoveryMode,
|
|
|
|
kAccessHint,
|
|
|
|
kInfoLogLevel,
|
2015-08-18 20:30:18 +00:00
|
|
|
kUnknown
|
|
|
|
};
|
|
|
|
|
2015-09-30 00:13:02 +00:00
|
|
|
enum class OptionVerificationType {
|
|
|
|
kNormal,
|
2016-02-19 22:42:24 +00:00
|
|
|
kByName, // The option is pointer typed so we can only verify
|
|
|
|
// based on it's name.
|
|
|
|
kByNameAllowNull, // Same as kByName, but it also allows the case
|
|
|
|
// where one of them is a nullptr.
|
|
|
|
kDeprecated // The option is no longer used in rocksdb. The RocksDB
|
|
|
|
// OptionsParser will still accept this option if it
|
|
|
|
// happen to exists in some Options file. However, the
|
|
|
|
// parser will not include it in serialization and
|
|
|
|
// verification processes.
|
2015-09-30 00:13:02 +00:00
|
|
|
};
|
|
|
|
|
2015-08-18 20:30:18 +00:00
|
|
|
// A struct for storing constant option information such as option name,
|
|
|
|
// option type, and offset.
|
|
|
|
struct OptionTypeInfo {
|
|
|
|
int offset;
|
|
|
|
OptionType type;
|
2015-09-30 00:13:02 +00:00
|
|
|
OptionVerificationType verification;
|
2016-09-14 04:12:43 +00:00
|
|
|
bool is_mutable;
|
|
|
|
int mutable_offset;
|
2015-08-18 20:30:18 +00:00
|
|
|
};
|
|
|
|
|
2015-10-02 22:35:32 +00:00
|
|
|
// A helper function that converts "opt_address" to a std::string
|
|
|
|
// based on the specified OptionType.
|
|
|
|
bool SerializeSingleOptionHelper(const char* opt_address,
|
|
|
|
const OptionType opt_type, std::string* value);
|
|
|
|
|
Add OptionsUtil::LoadOptionsFromFile() API
Summary:
This patch adds OptionsUtil::LoadOptionsFromFile() and
OptionsUtil::LoadLatestOptionsFromDB(), which allow developers
to construct DBOptions and ColumnFamilyOptions from a RocksDB
options file. Note that most pointer-typed options such as
merge_operator will not be constructed.
With this API, developers no longer need to remember all the
options in order to reopen an existing rocksdb instance like
the following:
DBOptions db_options;
std::vector<std::string> cf_names;
std::vector<ColumnFamilyOptions> cf_opts;
// Load primitive-typed options from an existing DB
OptionsUtil::LoadLatestOptionsFromDB(
dbname, &db_options, &cf_names, &cf_opts);
// Initialize necessary pointer-typed options
cf_opts[0].merge_operator.reset(new MyMergeOperator());
...
// Construct the vector of ColumnFamilyDescriptor
std::vector<ColumnFamilyDescriptor> cf_descs;
for (size_t i = 0; i < cf_opts.size(); ++i) {
cf_descs.emplace_back(cf_names[i], cf_opts[i]);
}
// Open the DB
DB* db = nullptr;
std::vector<ColumnFamilyHandle*> cf_handles;
auto s = DB::Open(db_options, dbname, cf_descs,
&handles, &db);
Test Plan:
Augment existing tests in column_family_test
options_test
db_test
Reviewers: igor, IslamAbdelRahman, sdong, anthony
Reviewed By: anthony
Subscribers: dhruba, leveldb
Differential Revision: https://reviews.facebook.net/D49095
2015-11-12 14:52:43 +00:00
|
|
|
// In addition to its public version defined in rocksdb/convenience.h,
|
|
|
|
// this further takes an optional output vector "unsupported_options_names",
|
|
|
|
// which stores the name of all the unsupported options specified in "opts_map".
|
|
|
|
Status GetDBOptionsFromMapInternal(
|
|
|
|
const DBOptions& base_options,
|
|
|
|
const std::unordered_map<std::string, std::string>& opts_map,
|
|
|
|
DBOptions* new_options, bool input_strings_escaped,
|
2017-06-13 23:55:08 +00:00
|
|
|
std::vector<std::string>* unsupported_options_names = nullptr,
|
|
|
|
bool ignore_unknown_options = false);
|
Add OptionsUtil::LoadOptionsFromFile() API
Summary:
This patch adds OptionsUtil::LoadOptionsFromFile() and
OptionsUtil::LoadLatestOptionsFromDB(), which allow developers
to construct DBOptions and ColumnFamilyOptions from a RocksDB
options file. Note that most pointer-typed options such as
merge_operator will not be constructed.
With this API, developers no longer need to remember all the
options in order to reopen an existing rocksdb instance like
the following:
DBOptions db_options;
std::vector<std::string> cf_names;
std::vector<ColumnFamilyOptions> cf_opts;
// Load primitive-typed options from an existing DB
OptionsUtil::LoadLatestOptionsFromDB(
dbname, &db_options, &cf_names, &cf_opts);
// Initialize necessary pointer-typed options
cf_opts[0].merge_operator.reset(new MyMergeOperator());
...
// Construct the vector of ColumnFamilyDescriptor
std::vector<ColumnFamilyDescriptor> cf_descs;
for (size_t i = 0; i < cf_opts.size(); ++i) {
cf_descs.emplace_back(cf_names[i], cf_opts[i]);
}
// Open the DB
DB* db = nullptr;
std::vector<ColumnFamilyHandle*> cf_handles;
auto s = DB::Open(db_options, dbname, cf_descs,
&handles, &db);
Test Plan:
Augment existing tests in column_family_test
options_test
db_test
Reviewers: igor, IslamAbdelRahman, sdong, anthony
Reviewed By: anthony
Subscribers: dhruba, leveldb
Differential Revision: https://reviews.facebook.net/D49095
2015-11-12 14:52:43 +00:00
|
|
|
|
|
|
|
// In addition to its public version defined in rocksdb/convenience.h,
|
|
|
|
// this further takes an optional output vector "unsupported_options_names",
|
|
|
|
// which stores the name of all the unsupported options specified in "opts_map".
|
|
|
|
Status GetColumnFamilyOptionsFromMapInternal(
|
|
|
|
const ColumnFamilyOptions& base_options,
|
|
|
|
const std::unordered_map<std::string, std::string>& opts_map,
|
|
|
|
ColumnFamilyOptions* new_options, bool input_strings_escaped,
|
2017-06-13 23:55:08 +00:00
|
|
|
std::vector<std::string>* unsupported_options_names = nullptr,
|
|
|
|
bool ignore_unknown_options = false);
|
Add OptionsUtil::LoadOptionsFromFile() API
Summary:
This patch adds OptionsUtil::LoadOptionsFromFile() and
OptionsUtil::LoadLatestOptionsFromDB(), which allow developers
to construct DBOptions and ColumnFamilyOptions from a RocksDB
options file. Note that most pointer-typed options such as
merge_operator will not be constructed.
With this API, developers no longer need to remember all the
options in order to reopen an existing rocksdb instance like
the following:
DBOptions db_options;
std::vector<std::string> cf_names;
std::vector<ColumnFamilyOptions> cf_opts;
// Load primitive-typed options from an existing DB
OptionsUtil::LoadLatestOptionsFromDB(
dbname, &db_options, &cf_names, &cf_opts);
// Initialize necessary pointer-typed options
cf_opts[0].merge_operator.reset(new MyMergeOperator());
...
// Construct the vector of ColumnFamilyDescriptor
std::vector<ColumnFamilyDescriptor> cf_descs;
for (size_t i = 0; i < cf_opts.size(); ++i) {
cf_descs.emplace_back(cf_names[i], cf_opts[i]);
}
// Open the DB
DB* db = nullptr;
std::vector<ColumnFamilyHandle*> cf_handles;
auto s = DB::Open(db_options, dbname, cf_descs,
&handles, &db);
Test Plan:
Augment existing tests in column_family_test
options_test
db_test
Reviewers: igor, IslamAbdelRahman, sdong, anthony
Reviewed By: anthony
Subscribers: dhruba, leveldb
Differential Revision: https://reviews.facebook.net/D49095
2015-11-12 14:52:43 +00:00
|
|
|
|
2015-08-18 20:30:18 +00:00
|
|
|
static std::unordered_map<std::string, OptionTypeInfo> db_options_type_info = {
|
|
|
|
/*
|
|
|
|
// not yet supported
|
|
|
|
Env* env;
|
|
|
|
std::shared_ptr<Cache> row_cache;
|
|
|
|
std::shared_ptr<DeleteScheduler> delete_scheduler;
|
|
|
|
std::shared_ptr<Logger> info_log;
|
|
|
|
std::shared_ptr<RateLimiter> rate_limiter;
|
|
|
|
std::shared_ptr<Statistics> statistics;
|
|
|
|
std::vector<DbPath> db_paths;
|
|
|
|
std::vector<std::shared_ptr<EventListener>> listeners;
|
|
|
|
*/
|
|
|
|
{"advise_random_on_open",
|
2015-09-30 00:13:02 +00:00
|
|
|
{offsetof(struct DBOptions, advise_random_on_open), OptionType::kBoolean,
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionVerificationType::kNormal, false, 0}},
|
2015-08-18 20:30:18 +00:00
|
|
|
{"allow_mmap_reads",
|
2015-09-30 00:13:02 +00:00
|
|
|
{offsetof(struct DBOptions, allow_mmap_reads), OptionType::kBoolean,
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionVerificationType::kNormal, false, 0}},
|
2015-10-07 17:04:05 +00:00
|
|
|
{"allow_fallocate",
|
|
|
|
{offsetof(struct DBOptions, allow_fallocate), OptionType::kBoolean,
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionVerificationType::kNormal, false, 0}},
|
2015-08-18 20:30:18 +00:00
|
|
|
{"allow_mmap_writes",
|
2015-09-30 00:13:02 +00:00
|
|
|
{offsetof(struct DBOptions, allow_mmap_writes), OptionType::kBoolean,
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionVerificationType::kNormal, false, 0}},
|
2016-10-28 17:36:05 +00:00
|
|
|
{"use_direct_reads",
|
|
|
|
{offsetof(struct DBOptions, use_direct_reads), OptionType::kBoolean,
|
|
|
|
OptionVerificationType::kNormal, false, 0}},
|
2016-12-22 20:51:29 +00:00
|
|
|
{"use_direct_writes",
|
2017-04-13 20:07:33 +00:00
|
|
|
{0, OptionType::kBoolean, OptionVerificationType::kDeprecated, false, 0}},
|
|
|
|
{"use_direct_io_for_flush_and_compaction",
|
|
|
|
{offsetof(struct DBOptions, use_direct_io_for_flush_and_compaction),
|
|
|
|
OptionType::kBoolean, OptionVerificationType::kNormal, false, 0}},
|
2016-04-18 18:11:51 +00:00
|
|
|
{"allow_2pc",
|
|
|
|
{offsetof(struct DBOptions, allow_2pc), OptionType::kBoolean,
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionVerificationType::kNormal, false, 0}},
|
2015-08-18 20:30:18 +00:00
|
|
|
{"allow_os_buffer",
|
2016-12-22 20:51:29 +00:00
|
|
|
{0, OptionType::kBoolean, OptionVerificationType::kDeprecated, true, 0}},
|
2015-08-18 20:30:18 +00:00
|
|
|
{"create_if_missing",
|
2015-09-30 00:13:02 +00:00
|
|
|
{offsetof(struct DBOptions, create_if_missing), OptionType::kBoolean,
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionVerificationType::kNormal, false, 0}},
|
2015-08-18 20:30:18 +00:00
|
|
|
{"create_missing_column_families",
|
|
|
|
{offsetof(struct DBOptions, create_missing_column_families),
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionType::kBoolean, OptionVerificationType::kNormal, false, 0}},
|
2015-08-18 20:30:18 +00:00
|
|
|
{"disableDataSync",
|
2017-02-13 18:54:38 +00:00
|
|
|
{0, OptionType::kBoolean, OptionVerificationType::kDeprecated, false, 0}},
|
2015-08-18 20:30:18 +00:00
|
|
|
{"disable_data_sync", // for compatibility
|
2017-02-13 18:54:38 +00:00
|
|
|
{0, OptionType::kBoolean, OptionVerificationType::kDeprecated, false, 0}},
|
2015-08-18 20:30:18 +00:00
|
|
|
{"enable_thread_tracking",
|
2015-09-30 00:13:02 +00:00
|
|
|
{offsetof(struct DBOptions, enable_thread_tracking), OptionType::kBoolean,
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionVerificationType::kNormal, false, 0}},
|
2015-08-18 20:30:18 +00:00
|
|
|
{"error_if_exists",
|
2015-09-30 00:13:02 +00:00
|
|
|
{offsetof(struct DBOptions, error_if_exists), OptionType::kBoolean,
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionVerificationType::kNormal, false, 0}},
|
2015-08-18 20:30:18 +00:00
|
|
|
{"is_fd_close_on_exec",
|
2015-09-30 00:13:02 +00:00
|
|
|
{offsetof(struct DBOptions, is_fd_close_on_exec), OptionType::kBoolean,
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionVerificationType::kNormal, false, 0}},
|
2015-08-18 20:30:18 +00:00
|
|
|
{"paranoid_checks",
|
2015-09-30 00:13:02 +00:00
|
|
|
{offsetof(struct DBOptions, paranoid_checks), OptionType::kBoolean,
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionVerificationType::kNormal, false, 0}},
|
2015-08-18 20:30:18 +00:00
|
|
|
{"skip_log_error_on_recovery",
|
|
|
|
{offsetof(struct DBOptions, skip_log_error_on_recovery),
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionType::kBoolean, OptionVerificationType::kNormal, false, 0}},
|
2015-08-18 20:30:18 +00:00
|
|
|
{"skip_stats_update_on_db_open",
|
|
|
|
{offsetof(struct DBOptions, skip_stats_update_on_db_open),
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionType::kBoolean, OptionVerificationType::kNormal, false, 0}},
|
2015-08-21 05:33:25 +00:00
|
|
|
{"new_table_reader_for_compaction_inputs",
|
|
|
|
{offsetof(struct DBOptions, new_table_reader_for_compaction_inputs),
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionType::kBoolean, OptionVerificationType::kNormal, false, 0}},
|
2015-08-26 22:25:59 +00:00
|
|
|
{"compaction_readahead_size",
|
2015-09-30 00:13:02 +00:00
|
|
|
{offsetof(struct DBOptions, compaction_readahead_size), OptionType::kSizeT,
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionVerificationType::kNormal, false, 0}},
|
2015-10-27 21:44:16 +00:00
|
|
|
{"random_access_max_buffer_size",
|
2015-10-29 22:52:32 +00:00
|
|
|
{offsetof(struct DBOptions, random_access_max_buffer_size),
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionType::kSizeT, OptionVerificationType::kNormal, false, 0}},
|
2015-10-30 05:10:25 +00:00
|
|
|
{"writable_file_max_buffer_size",
|
Add options.base_background_compactions as a number of compaction threads for low compaction debt
Summary:
If options.base_background_compactions is given, we try to schedule number of compactions not existing this number, only when L0 files increase to certain number, or pending compaction bytes more than certain threshold, we schedule compactions based on options.max_background_compactions.
The watermarks are calculated based on slowdown thresholds.
Test Plan:
Add new test cases in column_family_test.
Adding more unit tests.
Reviewers: IslamAbdelRahman, yhchiang, kradhakrishnan, rven, anthony
Reviewed By: anthony
Subscribers: leveldb, dhruba, yoshinorim
Differential Revision: https://reviews.facebook.net/D53409
2016-01-28 19:56:16 +00:00
|
|
|
{offsetof(struct DBOptions, writable_file_max_buffer_size),
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionType::kSizeT, OptionVerificationType::kNormal, false, 0}},
|
2015-08-18 20:30:18 +00:00
|
|
|
{"use_adaptive_mutex",
|
2015-09-30 00:13:02 +00:00
|
|
|
{offsetof(struct DBOptions, use_adaptive_mutex), OptionType::kBoolean,
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionVerificationType::kNormal, false, 0}},
|
2015-08-18 20:30:18 +00:00
|
|
|
{"use_fsync",
|
2015-09-30 00:13:02 +00:00
|
|
|
{offsetof(struct DBOptions, use_fsync), OptionType::kBoolean,
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionVerificationType::kNormal, false, 0}},
|
2017-05-24 18:25:38 +00:00
|
|
|
{"max_background_jobs",
|
|
|
|
{offsetof(struct DBOptions, max_background_jobs), OptionType::kInt,
|
|
|
|
OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableDBOptions, max_background_jobs)}},
|
2015-08-18 20:30:18 +00:00
|
|
|
{"max_background_compactions",
|
2015-09-30 00:13:02 +00:00
|
|
|
{offsetof(struct DBOptions, max_background_compactions), OptionType::kInt,
|
2016-10-14 19:25:39 +00:00
|
|
|
OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableDBOptions, max_background_compactions)}},
|
Add options.base_background_compactions as a number of compaction threads for low compaction debt
Summary:
If options.base_background_compactions is given, we try to schedule number of compactions not existing this number, only when L0 files increase to certain number, or pending compaction bytes more than certain threshold, we schedule compactions based on options.max_background_compactions.
The watermarks are calculated based on slowdown thresholds.
Test Plan:
Add new test cases in column_family_test.
Adding more unit tests.
Reviewers: IslamAbdelRahman, yhchiang, kradhakrishnan, rven, anthony
Reviewed By: anthony
Subscribers: leveldb, dhruba, yoshinorim
Differential Revision: https://reviews.facebook.net/D53409
2016-01-28 19:56:16 +00:00
|
|
|
{"base_background_compactions",
|
|
|
|
{offsetof(struct DBOptions, base_background_compactions), OptionType::kInt,
|
2016-10-14 19:25:39 +00:00
|
|
|
OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableDBOptions, base_background_compactions)}},
|
2015-08-18 20:30:18 +00:00
|
|
|
{"max_background_flushes",
|
2015-09-30 00:13:02 +00:00
|
|
|
{offsetof(struct DBOptions, max_background_flushes), OptionType::kInt,
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionVerificationType::kNormal, false, 0}},
|
2015-08-18 20:30:18 +00:00
|
|
|
{"max_file_opening_threads",
|
2015-09-30 00:13:02 +00:00
|
|
|
{offsetof(struct DBOptions, max_file_opening_threads), OptionType::kInt,
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionVerificationType::kNormal, false, 0}},
|
2015-08-18 20:30:18 +00:00
|
|
|
{"max_open_files",
|
2015-09-30 00:13:02 +00:00
|
|
|
{offsetof(struct DBOptions, max_open_files), OptionType::kInt,
|
2017-05-04 03:46:17 +00:00
|
|
|
OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableDBOptions, max_open_files)}},
|
2015-08-18 20:30:18 +00:00
|
|
|
{"table_cache_numshardbits",
|
2015-09-30 00:13:02 +00:00
|
|
|
{offsetof(struct DBOptions, table_cache_numshardbits), OptionType::kInt,
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionVerificationType::kNormal, false, 0}},
|
2015-08-18 20:30:18 +00:00
|
|
|
{"db_write_buffer_size",
|
2015-09-30 00:13:02 +00:00
|
|
|
{offsetof(struct DBOptions, db_write_buffer_size), OptionType::kSizeT,
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionVerificationType::kNormal, false, 0}},
|
2015-08-18 20:30:18 +00:00
|
|
|
{"keep_log_file_num",
|
2015-09-30 00:13:02 +00:00
|
|
|
{offsetof(struct DBOptions, keep_log_file_num), OptionType::kSizeT,
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionVerificationType::kNormal, false, 0}},
|
2015-10-08 01:06:28 +00:00
|
|
|
{"recycle_log_file_num",
|
|
|
|
{offsetof(struct DBOptions, recycle_log_file_num), OptionType::kSizeT,
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionVerificationType::kNormal, false, 0}},
|
2015-08-18 20:30:18 +00:00
|
|
|
{"log_file_time_to_roll",
|
2015-09-30 00:13:02 +00:00
|
|
|
{offsetof(struct DBOptions, log_file_time_to_roll), OptionType::kSizeT,
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionVerificationType::kNormal, false, 0}},
|
2015-08-18 20:30:18 +00:00
|
|
|
{"manifest_preallocation_size",
|
|
|
|
{offsetof(struct DBOptions, manifest_preallocation_size),
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionType::kSizeT, OptionVerificationType::kNormal, false, 0}},
|
2015-08-18 20:30:18 +00:00
|
|
|
{"max_log_file_size",
|
2015-09-30 00:13:02 +00:00
|
|
|
{offsetof(struct DBOptions, max_log_file_size), OptionType::kSizeT,
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionVerificationType::kNormal, false, 0}},
|
2015-08-18 20:30:18 +00:00
|
|
|
{"db_log_dir",
|
2015-09-30 00:13:02 +00:00
|
|
|
{offsetof(struct DBOptions, db_log_dir), OptionType::kString,
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionVerificationType::kNormal, false, 0}},
|
2015-09-30 00:13:02 +00:00
|
|
|
{"wal_dir",
|
|
|
|
{offsetof(struct DBOptions, wal_dir), OptionType::kString,
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionVerificationType::kNormal, false, 0}},
|
2015-08-21 21:25:34 +00:00
|
|
|
{"max_subcompactions",
|
2015-09-30 00:13:02 +00:00
|
|
|
{offsetof(struct DBOptions, max_subcompactions), OptionType::kUInt32T,
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionVerificationType::kNormal, false, 0}},
|
2015-08-18 20:30:18 +00:00
|
|
|
{"WAL_size_limit_MB",
|
2015-09-30 00:13:02 +00:00
|
|
|
{offsetof(struct DBOptions, WAL_size_limit_MB), OptionType::kUInt64T,
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionVerificationType::kNormal, false, 0}},
|
2015-08-18 20:30:18 +00:00
|
|
|
{"WAL_ttl_seconds",
|
2015-09-30 00:13:02 +00:00
|
|
|
{offsetof(struct DBOptions, WAL_ttl_seconds), OptionType::kUInt64T,
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionVerificationType::kNormal, false, 0}},
|
2015-08-18 20:30:18 +00:00
|
|
|
{"bytes_per_sync",
|
2015-09-30 00:13:02 +00:00
|
|
|
{offsetof(struct DBOptions, bytes_per_sync), OptionType::kUInt64T,
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionVerificationType::kNormal, false, 0}},
|
2015-08-18 20:30:18 +00:00
|
|
|
{"delayed_write_rate",
|
2015-09-30 00:13:02 +00:00
|
|
|
{offsetof(struct DBOptions, delayed_write_rate), OptionType::kUInt64T,
|
2016-11-12 23:43:33 +00:00
|
|
|
OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableDBOptions, delayed_write_rate)}},
|
2015-08-18 20:30:18 +00:00
|
|
|
{"delete_obsolete_files_period_micros",
|
|
|
|
{offsetof(struct DBOptions, delete_obsolete_files_period_micros),
|
2016-12-05 22:09:35 +00:00
|
|
|
OptionType::kUInt64T, OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableDBOptions, delete_obsolete_files_period_micros)}},
|
2015-08-18 20:30:18 +00:00
|
|
|
{"max_manifest_file_size",
|
2015-09-30 00:13:02 +00:00
|
|
|
{offsetof(struct DBOptions, max_manifest_file_size), OptionType::kUInt64T,
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionVerificationType::kNormal, false, 0}},
|
2015-08-18 20:30:18 +00:00
|
|
|
{"max_total_wal_size",
|
2015-09-30 00:13:02 +00:00
|
|
|
{offsetof(struct DBOptions, max_total_wal_size), OptionType::kUInt64T,
|
2016-11-15 06:45:16 +00:00
|
|
|
OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableDBOptions, max_total_wal_size)}},
|
2015-08-18 20:30:18 +00:00
|
|
|
{"wal_bytes_per_sync",
|
2015-09-30 00:13:02 +00:00
|
|
|
{offsetof(struct DBOptions, wal_bytes_per_sync), OptionType::kUInt64T,
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionVerificationType::kNormal, false, 0}},
|
2015-08-18 20:30:18 +00:00
|
|
|
{"stats_dump_period_sec",
|
2015-09-30 00:13:02 +00:00
|
|
|
{offsetof(struct DBOptions, stats_dump_period_sec), OptionType::kUInt,
|
2017-03-21 05:50:56 +00:00
|
|
|
OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableDBOptions, stats_dump_period_sec)}},
|
2016-03-02 18:34:14 +00:00
|
|
|
{"fail_if_options_file_error",
|
|
|
|
{offsetof(struct DBOptions, fail_if_options_file_error),
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionType::kBoolean, OptionVerificationType::kNormal, false, 0}},
|
2017-05-19 21:24:23 +00:00
|
|
|
{"enable_pipelined_write",
|
|
|
|
{offsetof(struct DBOptions, enable_pipelined_write), OptionType::kBoolean,
|
|
|
|
OptionVerificationType::kNormal, false, 0}},
|
2016-03-02 18:34:14 +00:00
|
|
|
{"allow_concurrent_memtable_write",
|
|
|
|
{offsetof(struct DBOptions, allow_concurrent_memtable_write),
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionType::kBoolean, OptionVerificationType::kNormal, false, 0}},
|
2016-03-02 18:34:14 +00:00
|
|
|
{"wal_recovery_mode",
|
|
|
|
{offsetof(struct DBOptions, wal_recovery_mode),
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionType::kWALRecoveryMode, OptionVerificationType::kNormal, false, 0}},
|
2016-03-02 18:34:14 +00:00
|
|
|
{"enable_write_thread_adaptive_yield",
|
|
|
|
{offsetof(struct DBOptions, enable_write_thread_adaptive_yield),
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionType::kBoolean, OptionVerificationType::kNormal, false, 0}},
|
2016-03-02 18:34:14 +00:00
|
|
|
{"write_thread_slow_yield_usec",
|
|
|
|
{offsetof(struct DBOptions, write_thread_slow_yield_usec),
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionType::kUInt64T, OptionVerificationType::kNormal, false, 0}},
|
2016-03-02 18:34:14 +00:00
|
|
|
{"write_thread_max_yield_usec",
|
|
|
|
{offsetof(struct DBOptions, write_thread_max_yield_usec),
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionType::kUInt64T, OptionVerificationType::kNormal, false, 0}},
|
2016-03-02 18:34:14 +00:00
|
|
|
{"access_hint_on_compaction_start",
|
|
|
|
{offsetof(struct DBOptions, access_hint_on_compaction_start),
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionType::kAccessHint, OptionVerificationType::kNormal, false, 0}},
|
2016-03-02 18:34:14 +00:00
|
|
|
{"info_log_level",
|
|
|
|
{offsetof(struct DBOptions, info_log_level), OptionType::kInfoLogLevel,
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionVerificationType::kNormal, false, 0}},
|
2016-04-27 23:23:33 +00:00
|
|
|
{"dump_malloc_stats",
|
|
|
|
{offsetof(struct DBOptions, dump_malloc_stats), OptionType::kBoolean,
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionVerificationType::kNormal, false, 0}},
|
2016-06-13 18:34:16 +00:00
|
|
|
{"avoid_flush_during_recovery",
|
|
|
|
{offsetof(struct DBOptions, avoid_flush_during_recovery),
|
2016-11-02 22:22:13 +00:00
|
|
|
OptionType::kBoolean, OptionVerificationType::kNormal, false, 0}},
|
|
|
|
{"avoid_flush_during_shutdown",
|
|
|
|
{offsetof(struct DBOptions, avoid_flush_during_shutdown),
|
|
|
|
OptionType::kBoolean, OptionVerificationType::kNormal, true,
|
2017-05-17 18:32:26 +00:00
|
|
|
offsetof(struct MutableDBOptions, avoid_flush_during_shutdown)}},
|
|
|
|
{"allow_ingest_behind",
|
2017-06-02 21:13:59 +00:00
|
|
|
{offsetof(struct DBOptions, allow_ingest_behind), OptionType::kBoolean,
|
|
|
|
OptionVerificationType::kNormal, false,
|
2017-06-24 21:06:43 +00:00
|
|
|
offsetof(struct ImmutableDBOptions, allow_ingest_behind)}},
|
|
|
|
{"concurrent_prepare",
|
|
|
|
{offsetof(struct DBOptions, concurrent_prepare), OptionType::kBoolean,
|
|
|
|
OptionVerificationType::kNormal, false,
|
|
|
|
offsetof(struct ImmutableDBOptions, concurrent_prepare)}},
|
|
|
|
{"manual_wal_flush",
|
|
|
|
{offsetof(struct DBOptions, manual_wal_flush), OptionType::kBoolean,
|
|
|
|
OptionVerificationType::kNormal, false,
|
2017-09-18 21:36:53 +00:00
|
|
|
offsetof(struct ImmutableDBOptions, manual_wal_flush)}},
|
|
|
|
{"seq_per_batch",
|
|
|
|
{offsetof(struct DBOptions, seq_per_batch), OptionType::kBoolean,
|
|
|
|
OptionVerificationType::kNormal, false,
|
|
|
|
offsetof(struct ImmutableDBOptions, seq_per_batch)}}};
|
2015-08-18 20:30:18 +00:00
|
|
|
|
2017-02-28 01:36:06 +00:00
|
|
|
// offset_of is used to get the offset of a class data member
|
|
|
|
// ex: offset_of(&ColumnFamilyOptions::num_levels)
|
|
|
|
// This call will return the offset of num_levels in ColumnFamilyOptions class
|
|
|
|
//
|
|
|
|
// This is the same as offsetof() but allow us to work with non standard-layout
|
|
|
|
// classes and structures
|
|
|
|
// refs:
|
|
|
|
// http://en.cppreference.com/w/cpp/concept/StandardLayoutType
|
|
|
|
// https://gist.github.com/graphitemaster/494f21190bb2c63c5516
|
|
|
|
template <typename T1, typename T2>
|
|
|
|
inline int offset_of(T1 T2::*member) {
|
|
|
|
static T2 obj;
|
|
|
|
return int(size_t(&(obj.*member)) - size_t(&obj));
|
|
|
|
}
|
|
|
|
|
2015-08-26 23:13:56 +00:00
|
|
|
static std::unordered_map<std::string, OptionTypeInfo> cf_options_type_info = {
|
|
|
|
/* not yet supported
|
|
|
|
CompactionOptionsFIFO compaction_options_fifo;
|
|
|
|
CompactionOptionsUniversal compaction_options_universal;
|
|
|
|
CompressionOptions compression_opts;
|
|
|
|
TablePropertiesCollectorFactories table_properties_collector_factories;
|
|
|
|
typedef std::vector<std::shared_ptr<TablePropertiesCollectorFactory>>
|
|
|
|
TablePropertiesCollectorFactories;
|
|
|
|
UpdateStatus (*inplace_callback)(char* existing_value,
|
|
|
|
uint34_t* existing_value_size,
|
|
|
|
Slice delta_value,
|
|
|
|
std::string* merged_value);
|
|
|
|
*/
|
2016-04-14 20:56:29 +00:00
|
|
|
{"report_bg_io_stats",
|
2017-02-28 01:36:06 +00:00
|
|
|
{offset_of(&ColumnFamilyOptions::report_bg_io_stats), OptionType::kBoolean,
|
|
|
|
OptionVerificationType::kNormal, true,
|
2016-09-14 04:12:43 +00:00
|
|
|
offsetof(struct MutableCFOptions, report_bg_io_stats)}},
|
2016-04-14 20:56:29 +00:00
|
|
|
{"compaction_measure_io_stats",
|
2016-09-20 20:02:41 +00:00
|
|
|
{0, OptionType::kBoolean, OptionVerificationType::kDeprecated, false, 0}},
|
2015-08-26 23:13:56 +00:00
|
|
|
{"disable_auto_compactions",
|
2017-02-28 01:36:06 +00:00
|
|
|
{offset_of(&ColumnFamilyOptions::disable_auto_compactions),
|
2016-09-14 04:12:43 +00:00
|
|
|
OptionType::kBoolean, OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableCFOptions, disable_auto_compactions)}},
|
2015-08-26 23:13:56 +00:00
|
|
|
{"filter_deletes",
|
2016-09-20 20:02:41 +00:00
|
|
|
{0, OptionType::kBoolean, OptionVerificationType::kDeprecated, true, 0}},
|
2015-08-26 23:13:56 +00:00
|
|
|
{"inplace_update_support",
|
2017-02-28 01:36:06 +00:00
|
|
|
{offset_of(&ColumnFamilyOptions::inplace_update_support),
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionType::kBoolean, OptionVerificationType::kNormal, false, 0}},
|
2015-08-26 23:13:56 +00:00
|
|
|
{"level_compaction_dynamic_level_bytes",
|
2017-02-28 01:36:06 +00:00
|
|
|
{offset_of(&ColumnFamilyOptions::level_compaction_dynamic_level_bytes),
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionType::kBoolean, OptionVerificationType::kNormal, false, 0}},
|
2015-08-26 23:13:56 +00:00
|
|
|
{"optimize_filters_for_hits",
|
2017-02-28 01:36:06 +00:00
|
|
|
{offset_of(&ColumnFamilyOptions::optimize_filters_for_hits),
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionType::kBoolean, OptionVerificationType::kNormal, false, 0}},
|
2015-08-26 23:13:56 +00:00
|
|
|
{"paranoid_file_checks",
|
2017-02-28 01:36:06 +00:00
|
|
|
{offset_of(&ColumnFamilyOptions::paranoid_file_checks),
|
2016-09-14 04:12:43 +00:00
|
|
|
OptionType::kBoolean, OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableCFOptions, paranoid_file_checks)}},
|
2016-10-08 00:21:45 +00:00
|
|
|
{"force_consistency_checks",
|
2017-02-28 01:36:06 +00:00
|
|
|
{offset_of(&ColumnFamilyOptions::force_consistency_checks),
|
2016-10-08 00:21:45 +00:00
|
|
|
OptionType::kBoolean, OptionVerificationType::kNormal, false, 0}},
|
2015-08-26 23:13:56 +00:00
|
|
|
{"purge_redundant_kvs_while_flush",
|
2017-02-28 01:36:06 +00:00
|
|
|
{offset_of(&ColumnFamilyOptions::purge_redundant_kvs_while_flush),
|
2017-09-13 18:48:16 +00:00
|
|
|
OptionType::kBoolean, OptionVerificationType::kDeprecated, false, 0}},
|
2015-08-26 23:13:56 +00:00
|
|
|
{"verify_checksums_in_compaction",
|
2017-02-23 22:53:03 +00:00
|
|
|
{0, OptionType::kBoolean, OptionVerificationType::kDeprecated, true, 0}},
|
2015-11-19 02:10:20 +00:00
|
|
|
{"soft_pending_compaction_bytes_limit",
|
2017-02-28 01:36:06 +00:00
|
|
|
{offset_of(&ColumnFamilyOptions::soft_pending_compaction_bytes_limit),
|
2016-09-14 04:12:43 +00:00
|
|
|
OptionType::kUInt64T, OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableCFOptions, soft_pending_compaction_bytes_limit)}},
|
2015-09-11 21:31:23 +00:00
|
|
|
{"hard_pending_compaction_bytes_limit",
|
2017-02-28 01:36:06 +00:00
|
|
|
{offset_of(&ColumnFamilyOptions::hard_pending_compaction_bytes_limit),
|
2016-09-14 04:12:43 +00:00
|
|
|
OptionType::kUInt64T, OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableCFOptions, hard_pending_compaction_bytes_limit)}},
|
2015-08-26 23:13:56 +00:00
|
|
|
{"hard_rate_limit",
|
2016-09-20 20:02:41 +00:00
|
|
|
{0, OptionType::kDouble, OptionVerificationType::kDeprecated, true, 0}},
|
2015-08-26 23:13:56 +00:00
|
|
|
{"soft_rate_limit",
|
2016-09-20 20:02:41 +00:00
|
|
|
{0, OptionType::kDouble, OptionVerificationType::kDeprecated, true, 0}},
|
2016-06-16 23:02:52 +00:00
|
|
|
{"max_compaction_bytes",
|
2017-02-28 01:36:06 +00:00
|
|
|
{offset_of(&ColumnFamilyOptions::max_compaction_bytes),
|
2016-09-14 04:12:43 +00:00
|
|
|
OptionType::kUInt64T, OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableCFOptions, max_compaction_bytes)}},
|
2015-08-26 23:13:56 +00:00
|
|
|
{"expanded_compaction_factor",
|
2016-09-20 20:02:41 +00:00
|
|
|
{0, OptionType::kInt, OptionVerificationType::kDeprecated, true, 0}},
|
2015-08-26 23:13:56 +00:00
|
|
|
{"level0_file_num_compaction_trigger",
|
2017-02-28 01:36:06 +00:00
|
|
|
{offset_of(&ColumnFamilyOptions::level0_file_num_compaction_trigger),
|
2016-09-14 04:12:43 +00:00
|
|
|
OptionType::kInt, OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableCFOptions, level0_file_num_compaction_trigger)}},
|
2015-08-26 23:13:56 +00:00
|
|
|
{"level0_slowdown_writes_trigger",
|
2017-02-28 01:36:06 +00:00
|
|
|
{offset_of(&ColumnFamilyOptions::level0_slowdown_writes_trigger),
|
2016-09-14 04:12:43 +00:00
|
|
|
OptionType::kInt, OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableCFOptions, level0_slowdown_writes_trigger)}},
|
2015-08-26 23:13:56 +00:00
|
|
|
{"level0_stop_writes_trigger",
|
2017-02-28 01:36:06 +00:00
|
|
|
{offset_of(&ColumnFamilyOptions::level0_stop_writes_trigger),
|
2016-09-14 04:12:43 +00:00
|
|
|
OptionType::kInt, OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableCFOptions, level0_stop_writes_trigger)}},
|
2015-08-26 23:13:56 +00:00
|
|
|
{"max_grandparent_overlap_factor",
|
2016-09-20 20:02:41 +00:00
|
|
|
{0, OptionType::kInt, OptionVerificationType::kDeprecated, true, 0}},
|
2015-08-26 23:13:56 +00:00
|
|
|
{"max_mem_compaction_level",
|
2016-09-20 20:02:41 +00:00
|
|
|
{0, OptionType::kInt, OptionVerificationType::kDeprecated, false, 0}},
|
2015-08-26 23:13:56 +00:00
|
|
|
{"max_write_buffer_number",
|
2017-02-28 01:36:06 +00:00
|
|
|
{offset_of(&ColumnFamilyOptions::max_write_buffer_number),
|
2016-09-14 04:12:43 +00:00
|
|
|
OptionType::kInt, OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableCFOptions, max_write_buffer_number)}},
|
2015-08-26 23:13:56 +00:00
|
|
|
{"max_write_buffer_number_to_maintain",
|
2017-02-28 01:36:06 +00:00
|
|
|
{offset_of(&ColumnFamilyOptions::max_write_buffer_number_to_maintain),
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionType::kInt, OptionVerificationType::kNormal, false, 0}},
|
2015-08-26 23:13:56 +00:00
|
|
|
{"min_write_buffer_number_to_merge",
|
2017-02-28 01:36:06 +00:00
|
|
|
{offset_of(&ColumnFamilyOptions::min_write_buffer_number_to_merge),
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionType::kInt, OptionVerificationType::kNormal, false, 0}},
|
2015-08-26 23:13:56 +00:00
|
|
|
{"num_levels",
|
2017-02-28 01:36:06 +00:00
|
|
|
{offset_of(&ColumnFamilyOptions::num_levels), OptionType::kInt,
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionVerificationType::kNormal, false, 0}},
|
2015-08-26 23:13:56 +00:00
|
|
|
{"source_compaction_factor",
|
2016-09-20 20:02:41 +00:00
|
|
|
{0, OptionType::kInt, OptionVerificationType::kDeprecated, true, 0}},
|
2015-08-26 23:13:56 +00:00
|
|
|
{"target_file_size_multiplier",
|
2017-02-28 01:36:06 +00:00
|
|
|
{offset_of(&ColumnFamilyOptions::target_file_size_multiplier),
|
2016-09-14 04:12:43 +00:00
|
|
|
OptionType::kInt, OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableCFOptions, target_file_size_multiplier)}},
|
2015-08-26 23:13:56 +00:00
|
|
|
{"arena_block_size",
|
2017-02-28 01:36:06 +00:00
|
|
|
{offset_of(&ColumnFamilyOptions::arena_block_size), OptionType::kSizeT,
|
|
|
|
OptionVerificationType::kNormal, true,
|
2016-09-14 04:12:43 +00:00
|
|
|
offsetof(struct MutableCFOptions, arena_block_size)}},
|
2015-08-26 23:13:56 +00:00
|
|
|
{"inplace_update_num_locks",
|
2017-02-28 01:36:06 +00:00
|
|
|
{offset_of(&ColumnFamilyOptions::inplace_update_num_locks),
|
2016-09-14 04:12:43 +00:00
|
|
|
OptionType::kSizeT, OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableCFOptions, inplace_update_num_locks)}},
|
2015-08-26 23:13:56 +00:00
|
|
|
{"max_successive_merges",
|
2017-02-28 01:36:06 +00:00
|
|
|
{offset_of(&ColumnFamilyOptions::max_successive_merges),
|
2016-09-14 04:12:43 +00:00
|
|
|
OptionType::kSizeT, OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableCFOptions, max_successive_merges)}},
|
2016-07-27 01:05:30 +00:00
|
|
|
{"memtable_huge_page_size",
|
2017-02-28 01:36:06 +00:00
|
|
|
{offset_of(&ColumnFamilyOptions::memtable_huge_page_size),
|
2016-09-14 04:12:43 +00:00
|
|
|
OptionType::kSizeT, OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableCFOptions, memtable_huge_page_size)}},
|
2016-07-27 01:05:30 +00:00
|
|
|
{"memtable_prefix_bloom_huge_page_tlb_size",
|
2016-09-20 20:02:41 +00:00
|
|
|
{0, OptionType::kSizeT, OptionVerificationType::kDeprecated, true, 0}},
|
2015-08-26 23:13:56 +00:00
|
|
|
{"write_buffer_size",
|
2017-02-28 01:36:06 +00:00
|
|
|
{offset_of(&ColumnFamilyOptions::write_buffer_size), OptionType::kSizeT,
|
|
|
|
OptionVerificationType::kNormal, true,
|
2016-09-14 04:12:43 +00:00
|
|
|
offsetof(struct MutableCFOptions, write_buffer_size)}},
|
2015-08-26 23:13:56 +00:00
|
|
|
{"bloom_locality",
|
2017-02-28 01:36:06 +00:00
|
|
|
{offset_of(&ColumnFamilyOptions::bloom_locality), OptionType::kUInt32T,
|
|
|
|
OptionVerificationType::kNormal, false, 0}},
|
2015-08-26 23:13:56 +00:00
|
|
|
{"memtable_prefix_bloom_bits",
|
2016-09-20 20:02:41 +00:00
|
|
|
{0, OptionType::kUInt32T, OptionVerificationType::kDeprecated, true, 0}},
|
2016-06-04 00:02:10 +00:00
|
|
|
{"memtable_prefix_bloom_size_ratio",
|
2017-02-28 01:36:06 +00:00
|
|
|
{offset_of(&ColumnFamilyOptions::memtable_prefix_bloom_size_ratio),
|
2016-09-14 04:12:43 +00:00
|
|
|
OptionType::kDouble, OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableCFOptions, memtable_prefix_bloom_size_ratio)}},
|
2015-08-26 23:13:56 +00:00
|
|
|
{"memtable_prefix_bloom_probes",
|
2016-09-20 20:02:41 +00:00
|
|
|
{0, OptionType::kUInt32T, OptionVerificationType::kDeprecated, true, 0}},
|
2015-08-26 23:13:56 +00:00
|
|
|
{"min_partial_merge_operands",
|
2017-02-23 22:53:03 +00:00
|
|
|
{0, OptionType::kUInt32T, OptionVerificationType::kDeprecated, true, 0}},
|
2015-08-26 23:13:56 +00:00
|
|
|
{"max_bytes_for_level_base",
|
2017-02-28 01:36:06 +00:00
|
|
|
{offset_of(&ColumnFamilyOptions::max_bytes_for_level_base),
|
2016-09-14 04:12:43 +00:00
|
|
|
OptionType::kUInt64T, OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableCFOptions, max_bytes_for_level_base)}},
|
|
|
|
{"max_bytes_for_level_multiplier",
|
2017-02-28 01:36:06 +00:00
|
|
|
{offset_of(&ColumnFamilyOptions::max_bytes_for_level_multiplier),
|
2016-11-02 04:05:32 +00:00
|
|
|
OptionType::kDouble, OptionVerificationType::kNormal, true,
|
2016-09-14 04:12:43 +00:00
|
|
|
offsetof(struct MutableCFOptions, max_bytes_for_level_multiplier)}},
|
|
|
|
{"max_bytes_for_level_multiplier_additional",
|
2017-02-28 01:36:06 +00:00
|
|
|
{offset_of(
|
|
|
|
&ColumnFamilyOptions::max_bytes_for_level_multiplier_additional),
|
2016-09-14 04:12:43 +00:00
|
|
|
OptionType::kVectorInt, OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableCFOptions,
|
|
|
|
max_bytes_for_level_multiplier_additional)}},
|
2015-08-26 23:13:56 +00:00
|
|
|
{"max_sequential_skip_in_iterations",
|
2017-02-28 01:36:06 +00:00
|
|
|
{offset_of(&ColumnFamilyOptions::max_sequential_skip_in_iterations),
|
2016-09-14 04:12:43 +00:00
|
|
|
OptionType::kUInt64T, OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableCFOptions, max_sequential_skip_in_iterations)}},
|
2015-08-26 23:13:56 +00:00
|
|
|
{"target_file_size_base",
|
2017-02-28 01:36:06 +00:00
|
|
|
{offset_of(&ColumnFamilyOptions::target_file_size_base),
|
2016-09-14 04:12:43 +00:00
|
|
|
OptionType::kUInt64T, OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableCFOptions, target_file_size_base)}},
|
2015-08-26 23:13:56 +00:00
|
|
|
{"rate_limit_delay_max_milliseconds",
|
2016-09-20 20:02:41 +00:00
|
|
|
{0, OptionType::kUInt, OptionVerificationType::kDeprecated, false, 0}},
|
2015-10-02 22:35:32 +00:00
|
|
|
{"compression",
|
2017-02-28 01:36:06 +00:00
|
|
|
{offset_of(&ColumnFamilyOptions::compression),
|
2016-09-14 04:12:43 +00:00
|
|
|
OptionType::kCompressionType, OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableCFOptions, compression)}},
|
2015-10-02 22:35:32 +00:00
|
|
|
{"compression_per_level",
|
2017-02-28 01:36:06 +00:00
|
|
|
{offset_of(&ColumnFamilyOptions::compression_per_level),
|
2016-09-14 04:12:43 +00:00
|
|
|
OptionType::kVectorCompressionType, OptionVerificationType::kNormal,
|
2016-09-20 20:02:41 +00:00
|
|
|
false, 0}},
|
2016-05-09 22:57:19 +00:00
|
|
|
{"bottommost_compression",
|
2017-02-28 01:36:06 +00:00
|
|
|
{offset_of(&ColumnFamilyOptions::bottommost_compression),
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionType::kCompressionType, OptionVerificationType::kNormal, false, 0}},
|
2015-10-02 22:35:32 +00:00
|
|
|
{"comparator",
|
2017-02-28 01:36:06 +00:00
|
|
|
{offset_of(&ColumnFamilyOptions::comparator), OptionType::kComparator,
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionVerificationType::kByName, false, 0}},
|
2015-10-02 22:35:32 +00:00
|
|
|
{"prefix_extractor",
|
2017-02-28 01:36:06 +00:00
|
|
|
{offset_of(&ColumnFamilyOptions::prefix_extractor),
|
2016-09-14 04:12:43 +00:00
|
|
|
OptionType::kSliceTransform, OptionVerificationType::kByNameAllowNull,
|
2016-09-20 20:02:41 +00:00
|
|
|
false, 0}},
|
2016-11-14 02:58:17 +00:00
|
|
|
{"memtable_insert_with_hint_prefix_extractor",
|
2017-02-28 01:36:06 +00:00
|
|
|
{offset_of(
|
|
|
|
&ColumnFamilyOptions::memtable_insert_with_hint_prefix_extractor),
|
2016-11-14 02:58:17 +00:00
|
|
|
OptionType::kSliceTransform, OptionVerificationType::kByNameAllowNull,
|
|
|
|
false, 0}},
|
2015-10-02 22:35:32 +00:00
|
|
|
{"memtable_factory",
|
2017-02-28 01:36:06 +00:00
|
|
|
{offset_of(&ColumnFamilyOptions::memtable_factory),
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionType::kMemTableRepFactory, OptionVerificationType::kByName, false,
|
|
|
|
0}},
|
2015-10-02 22:35:32 +00:00
|
|
|
{"table_factory",
|
2017-02-28 01:36:06 +00:00
|
|
|
{offset_of(&ColumnFamilyOptions::table_factory), OptionType::kTableFactory,
|
|
|
|
OptionVerificationType::kByName, false, 0}},
|
2015-10-02 22:35:32 +00:00
|
|
|
{"compaction_filter",
|
2017-02-28 01:36:06 +00:00
|
|
|
{offset_of(&ColumnFamilyOptions::compaction_filter),
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionType::kCompactionFilter, OptionVerificationType::kByName, false,
|
|
|
|
0}},
|
2015-10-02 22:35:32 +00:00
|
|
|
{"compaction_filter_factory",
|
2017-02-28 01:36:06 +00:00
|
|
|
{offset_of(&ColumnFamilyOptions::compaction_filter_factory),
|
2016-09-14 04:12:43 +00:00
|
|
|
OptionType::kCompactionFilterFactory, OptionVerificationType::kByName,
|
2016-09-20 20:02:41 +00:00
|
|
|
false, 0}},
|
2015-10-02 22:35:32 +00:00
|
|
|
{"merge_operator",
|
2017-02-28 01:36:06 +00:00
|
|
|
{offset_of(&ColumnFamilyOptions::merge_operator),
|
2016-09-20 20:02:41 +00:00
|
|
|
OptionType::kMergeOperator, OptionVerificationType::kByName, false, 0}},
|
2015-08-26 23:13:56 +00:00
|
|
|
{"compaction_style",
|
2017-02-28 01:36:06 +00:00
|
|
|
{offset_of(&ColumnFamilyOptions::compaction_style),
|
2017-03-02 18:08:49 +00:00
|
|
|
OptionType::kCompactionStyle, OptionVerificationType::kNormal, false, 0}},
|
|
|
|
{"compaction_pri",
|
|
|
|
{offset_of(&ColumnFamilyOptions::compaction_pri),
|
|
|
|
OptionType::kCompactionPri, OptionVerificationType::kNormal, false, 0}}};
|
2015-08-26 23:13:56 +00:00
|
|
|
|
2015-11-18 00:41:54 +00:00
|
|
|
static std::unordered_map<std::string, CompressionType>
|
2015-10-30 22:58:46 +00:00
|
|
|
compression_type_string_map = {
|
2015-11-18 00:41:54 +00:00
|
|
|
{"kNoCompression", kNoCompression},
|
|
|
|
{"kSnappyCompression", kSnappyCompression},
|
|
|
|
{"kZlibCompression", kZlibCompression},
|
|
|
|
{"kBZip2Compression", kBZip2Compression},
|
|
|
|
{"kLZ4Compression", kLZ4Compression},
|
|
|
|
{"kLZ4HCCompression", kLZ4HCCompression},
|
2016-05-09 22:57:19 +00:00
|
|
|
{"kXpressCompression", kXpressCompression},
|
2016-09-01 22:28:40 +00:00
|
|
|
{"kZSTD", kZSTD},
|
2016-05-09 22:57:19 +00:00
|
|
|
{"kZSTDNotFinalCompression", kZSTDNotFinalCompression},
|
|
|
|
{"kDisableCompressionOption", kDisableCompressionOption}};
|
2015-10-30 22:58:46 +00:00
|
|
|
|
|
|
|
static std::unordered_map<std::string, BlockBasedTableOptions::IndexType>
|
2015-11-18 00:41:54 +00:00
|
|
|
block_base_table_index_type_string_map = {
|
2015-10-30 22:58:46 +00:00
|
|
|
{"kBinarySearch", BlockBasedTableOptions::IndexType::kBinarySearch},
|
2017-02-07 00:29:29 +00:00
|
|
|
{"kHashSearch", BlockBasedTableOptions::IndexType::kHashSearch},
|
|
|
|
{"kTwoLevelIndexSearch",
|
2017-03-07 21:48:02 +00:00
|
|
|
BlockBasedTableOptions::IndexType::kTwoLevelIndexSearch}};
|
2015-10-30 22:58:46 +00:00
|
|
|
|
2015-11-18 00:41:54 +00:00
|
|
|
static std::unordered_map<std::string, EncodingType> encoding_type_string_map =
|
|
|
|
{{"kPlain", kPlain}, {"kPrefix", kPrefix}};
|
2015-10-30 22:58:46 +00:00
|
|
|
|
2015-11-18 00:41:54 +00:00
|
|
|
static std::unordered_map<std::string, ChecksumType> checksum_type_string_map =
|
|
|
|
{{"kNoChecksum", kNoChecksum}, {"kCRC32c", kCRC32c}, {"kxxHash", kxxHash}};
|
2015-10-30 22:58:46 +00:00
|
|
|
|
|
|
|
static std::unordered_map<std::string, CompactionStyle>
|
|
|
|
compaction_style_string_map = {
|
|
|
|
{"kCompactionStyleLevel", kCompactionStyleLevel},
|
|
|
|
{"kCompactionStyleUniversal", kCompactionStyleUniversal},
|
|
|
|
{"kCompactionStyleFIFO", kCompactionStyleFIFO},
|
|
|
|
{"kCompactionStyleNone", kCompactionStyleNone}};
|
|
|
|
|
2017-03-02 18:08:49 +00:00
|
|
|
static std::unordered_map<std::string, CompactionPri>
|
|
|
|
compaction_pri_string_map = {
|
|
|
|
{"kByCompensatedSize", kByCompensatedSize},
|
|
|
|
{"kOldestLargestSeqFirst", kOldestLargestSeqFirst},
|
|
|
|
{"kOldestSmallestSeqFirst", kOldestSmallestSeqFirst},
|
|
|
|
{"kMinOverlappingRatio", kMinOverlappingRatio}};
|
|
|
|
|
2016-03-02 18:34:14 +00:00
|
|
|
static std::unordered_map<std::string,
|
|
|
|
WALRecoveryMode> wal_recovery_mode_string_map = {
|
|
|
|
{"kTolerateCorruptedTailRecords",
|
|
|
|
WALRecoveryMode::kTolerateCorruptedTailRecords},
|
|
|
|
{"kAbsoluteConsistency", WALRecoveryMode::kAbsoluteConsistency},
|
|
|
|
{"kPointInTimeRecovery", WALRecoveryMode::kPointInTimeRecovery},
|
|
|
|
{"kSkipAnyCorruptedRecords", WALRecoveryMode::kSkipAnyCorruptedRecords}};
|
|
|
|
|
|
|
|
static std::unordered_map<std::string, DBOptions::AccessHint>
|
|
|
|
access_hint_string_map = {{"NONE", DBOptions::AccessHint::NONE},
|
|
|
|
{"NORMAL", DBOptions::AccessHint::NORMAL},
|
|
|
|
{"SEQUENTIAL", DBOptions::AccessHint::SEQUENTIAL},
|
|
|
|
{"WILLNEED", DBOptions::AccessHint::WILLNEED}};
|
|
|
|
|
|
|
|
static std::unordered_map<std::string, InfoLogLevel> info_log_level_string_map =
|
|
|
|
{{"DEBUG_LEVEL", InfoLogLevel::DEBUG_LEVEL},
|
|
|
|
{"INFO_LEVEL", InfoLogLevel::INFO_LEVEL},
|
|
|
|
{"WARN_LEVEL", InfoLogLevel::WARN_LEVEL},
|
|
|
|
{"ERROR_LEVEL", InfoLogLevel::ERROR_LEVEL},
|
|
|
|
{"FATAL_LEVEL", InfoLogLevel::FATAL_LEVEL},
|
|
|
|
{"HEADER_LEVEL", InfoLogLevel::HEADER_LEVEL}};
|
|
|
|
|
2017-07-28 23:23:50 +00:00
|
|
|
extern Status StringToMap(
|
|
|
|
const std::string& opts_str,
|
|
|
|
std::unordered_map<std::string, std::string>* opts_map);
|
|
|
|
|
|
|
|
extern bool ParseOptionHelper(char* opt_address, const OptionType& opt_type,
|
|
|
|
const std::string& value);
|
2016-09-15 05:10:28 +00:00
|
|
|
#endif // !ROCKSDB_LITE
|
|
|
|
|
2014-09-17 19:49:13 +00:00
|
|
|
} // namespace rocksdb
|