2016-02-10 00:12:00 +01:00
|
|
|
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
|
2014-09-17 21:49:13 +02:00
|
|
|
// This source code is licensed under the BSD-style license found in the
|
|
|
|
// LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
// of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <string>
|
2014-11-18 22:21:02 +01:00
|
|
|
#include <stdexcept>
|
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 15:52:43 +01:00
|
|
|
#include <vector>
|
|
|
|
|
2015-08-27 01:13:56 +02:00
|
|
|
#include "rocksdb/options.h"
|
2014-11-05 01:23:05 +01:00
|
|
|
#include "rocksdb/status.h"
|
2015-10-11 21:17:42 +02:00
|
|
|
#include "rocksdb/table.h"
|
2016-09-02 23:16:31 +02:00
|
|
|
#include "util/cf_options.h"
|
2014-09-17 21:49:13 +02:00
|
|
|
|
RocksDB Options file format and its serialization / deserialization.
Summary:
This patch defines the format of RocksDB options file, which
follows the INI file format, and implements functions for its
serialization and deserialization. An example RocksDB options
file can be found in examples/rocksdb_option_file_example.ini.
A typical RocksDB options file has three sections, which are
Version, DBOptions, and more than one CFOptions. The RocksDB
options file in general follows the basic INI file format
with the following extensions / modifications:
* Escaped characters
We escaped the following characters:
- \n -- line feed - new line
- \r -- carriage return
- \\ -- backslash \
- \: -- colon symbol :
- \# -- hash tag #
* Comments
We support # style comments. Comments can appear at the ending
part of a line.
* Statements
A statement is of the form option_name = value.
Each statement contains a '=', where extra white-spaces
are supported. However, we don't support multi-lined statement.
Furthermore, each line can only contain at most one statement.
* Section
Sections are of the form [SecitonTitle "SectionArgument"],
where section argument is optional.
* List
We use colon-separated string to represent a list.
For instance, n1:n2:n3:n4 is a list containing four values.
Below is an example of a RocksDB options file:
[Version]
rocksdb_version=4.0.0
options_file_version=1.0
[DBOptions]
max_open_files=12345
max_background_flushes=301
[CFOptions "default"]
[CFOptions "the second column family"]
[CFOptions "the third column family"]
Test Plan: Added many tests in options_test.cc
Reviewers: igor, IslamAbdelRahman, sdong, anthony
Reviewed By: anthony
Subscribers: maykov, dhruba, leveldb
Differential Revision: https://reviews.facebook.net/D46059
2015-09-29 23:42:40 +02:00
|
|
|
#ifndef ROCKSDB_LITE
|
2014-09-17 21:49:13 +02:00
|
|
|
namespace rocksdb {
|
|
|
|
|
RocksDB Options file format and its serialization / deserialization.
Summary:
This patch defines the format of RocksDB options file, which
follows the INI file format, and implements functions for its
serialization and deserialization. An example RocksDB options
file can be found in examples/rocksdb_option_file_example.ini.
A typical RocksDB options file has three sections, which are
Version, DBOptions, and more than one CFOptions. The RocksDB
options file in general follows the basic INI file format
with the following extensions / modifications:
* Escaped characters
We escaped the following characters:
- \n -- line feed - new line
- \r -- carriage return
- \\ -- backslash \
- \: -- colon symbol :
- \# -- hash tag #
* Comments
We support # style comments. Comments can appear at the ending
part of a line.
* Statements
A statement is of the form option_name = value.
Each statement contains a '=', where extra white-spaces
are supported. However, we don't support multi-lined statement.
Furthermore, each line can only contain at most one statement.
* Section
Sections are of the form [SecitonTitle "SectionArgument"],
where section argument is optional.
* List
We use colon-separated string to represent a list.
For instance, n1:n2:n3:n4 is a list containing four values.
Below is an example of a RocksDB options file:
[Version]
rocksdb_version=4.0.0
options_file_version=1.0
[DBOptions]
max_open_files=12345
max_background_flushes=301
[CFOptions "default"]
[CFOptions "the second column family"]
[CFOptions "the third column family"]
Test Plan: Added many tests in options_test.cc
Reviewers: igor, IslamAbdelRahman, sdong, anthony
Reviewed By: anthony
Subscribers: maykov, dhruba, leveldb
Differential Revision: https://reviews.facebook.net/D46059
2015-09-29 23:42:40 +02:00
|
|
|
// Returns true if the input char "c" is considered as a special character
|
|
|
|
// that will be escaped when EscapeOptionString() is called.
|
|
|
|
//
|
|
|
|
// @param c the input char
|
|
|
|
// @return true if the input char "c" is considered as a special character.
|
|
|
|
// @see EscapeOptionString
|
|
|
|
bool isSpecialChar(const char c);
|
|
|
|
|
|
|
|
// If the input char is an escaped char, it will return the its
|
|
|
|
// associated raw-char. Otherwise, the function will simply return
|
|
|
|
// the original input char.
|
|
|
|
char UnescapeChar(const char c);
|
|
|
|
|
|
|
|
// If the input char is a control char, it will return the its
|
|
|
|
// associated escaped char. Otherwise, the function will simply return
|
|
|
|
// the original input char.
|
|
|
|
char EscapeChar(const char c);
|
|
|
|
|
|
|
|
// Converts a raw string to an escaped string. Escaped-characters are
|
|
|
|
// defined via the isSpecialChar() function. When a char in the input
|
|
|
|
// string "raw_string" is classified as a special characters, then it
|
|
|
|
// will be prefixed by '\' in the output.
|
|
|
|
//
|
|
|
|
// It's inverse function is UnescapeOptionString().
|
|
|
|
// @param raw_string the input string
|
|
|
|
// @return the '\' escaped string of the input "raw_string"
|
|
|
|
// @see isSpecialChar, UnescapeOptionString
|
|
|
|
std::string EscapeOptionString(const std::string& raw_string);
|
|
|
|
|
|
|
|
// The inverse function of EscapeOptionString. It converts
|
|
|
|
// an '\' escaped string back to a raw string.
|
|
|
|
//
|
|
|
|
// @param escaped_string the input '\' escaped string
|
|
|
|
// @return the raw string of the input "escaped_string"
|
|
|
|
std::string UnescapeOptionString(const std::string& escaped_string);
|
|
|
|
|
2016-08-06 00:56:22 +02:00
|
|
|
uint64_t ParseUint64(const std::string& value);
|
|
|
|
|
2014-11-05 01:23:05 +01:00
|
|
|
Status GetMutableOptionsFromStrings(
|
2014-09-17 21:49:13 +02:00
|
|
|
const MutableCFOptions& base_options,
|
|
|
|
const std::unordered_map<std::string, std::string>& options_map,
|
|
|
|
MutableCFOptions* new_options);
|
|
|
|
|
2015-10-11 21:17:42 +02:00
|
|
|
Status GetTableFactoryFromMap(
|
|
|
|
const std::string& factory_name,
|
|
|
|
const std::unordered_map<std::string, std::string>& opt_map,
|
|
|
|
std::shared_ptr<TableFactory>* table_factory);
|
|
|
|
|
|
|
|
Status GetStringFromTableFactory(std::string* opts_str, const TableFactory* tf,
|
|
|
|
const std::string& delimiter = "; ");
|
|
|
|
|
2015-11-11 07:58:01 +01:00
|
|
|
ColumnFamilyOptions BuildColumnFamilyOptions(
|
|
|
|
const Options& options, const MutableCFOptions& mutable_cf_options);
|
|
|
|
|
2015-08-18 22:30:18 +02:00
|
|
|
enum class OptionType {
|
|
|
|
kBoolean,
|
|
|
|
kInt,
|
2016-09-14 06:12:43 +02:00
|
|
|
kVectorInt,
|
2015-08-18 22:30:18 +02:00
|
|
|
kUInt,
|
|
|
|
kUInt32T,
|
|
|
|
kUInt64T,
|
|
|
|
kSizeT,
|
|
|
|
kString,
|
2015-08-27 01:13:56 +02:00
|
|
|
kDouble,
|
|
|
|
kCompactionStyle,
|
2015-10-03 00:35:32 +02:00
|
|
|
kSliceTransform,
|
|
|
|
kCompressionType,
|
|
|
|
kVectorCompressionType,
|
|
|
|
kTableFactory,
|
|
|
|
kComparator,
|
|
|
|
kCompactionFilter,
|
|
|
|
kCompactionFilterFactory,
|
|
|
|
kMergeOperator,
|
|
|
|
kMemTableRepFactory,
|
2015-10-11 21:17:42 +02:00
|
|
|
kBlockBasedTableIndexType,
|
|
|
|
kFilterPolicy,
|
|
|
|
kFlushBlockPolicyFactory,
|
|
|
|
kChecksumType,
|
2015-10-28 18:46:01 +01:00
|
|
|
kEncodingType,
|
2016-03-02 19:34:14 +01:00
|
|
|
kWALRecoveryMode,
|
|
|
|
kAccessHint,
|
|
|
|
kInfoLogLevel,
|
2015-08-18 22:30:18 +02:00
|
|
|
kUnknown
|
|
|
|
};
|
|
|
|
|
2015-09-30 02:13:02 +02:00
|
|
|
enum class OptionVerificationType {
|
|
|
|
kNormal,
|
2016-02-19 23:42:24 +01: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 02:13:02 +02:00
|
|
|
};
|
|
|
|
|
2015-08-18 22:30:18 +02: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 02:13:02 +02:00
|
|
|
OptionVerificationType verification;
|
2016-09-14 06:12:43 +02:00
|
|
|
bool is_mutable;
|
|
|
|
int mutable_offset;
|
2015-08-18 22:30:18 +02:00
|
|
|
};
|
|
|
|
|
2015-10-03 00:35:32 +02: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 15:52:43 +01: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,
|
|
|
|
std::vector<std::string>* unsupported_options_names = nullptr);
|
|
|
|
|
|
|
|
// 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,
|
|
|
|
std::vector<std::string>* unsupported_options_names = nullptr);
|
|
|
|
|
2015-08-18 22:30:18 +02: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 02:13:02 +02:00
|
|
|
{offsetof(struct DBOptions, advise_random_on_open), OptionType::kBoolean,
|
|
|
|
OptionVerificationType::kNormal}},
|
2015-08-18 22:30:18 +02:00
|
|
|
{"allow_mmap_reads",
|
2015-09-30 02:13:02 +02:00
|
|
|
{offsetof(struct DBOptions, allow_mmap_reads), OptionType::kBoolean,
|
|
|
|
OptionVerificationType::kNormal}},
|
2015-10-07 19:04:05 +02:00
|
|
|
{"allow_fallocate",
|
|
|
|
{offsetof(struct DBOptions, allow_fallocate), OptionType::kBoolean,
|
|
|
|
OptionVerificationType::kNormal}},
|
2015-08-18 22:30:18 +02:00
|
|
|
{"allow_mmap_writes",
|
2015-09-30 02:13:02 +02:00
|
|
|
{offsetof(struct DBOptions, allow_mmap_writes), OptionType::kBoolean,
|
|
|
|
OptionVerificationType::kNormal}},
|
2016-04-18 20:11:51 +02:00
|
|
|
{"allow_2pc",
|
|
|
|
{offsetof(struct DBOptions, allow_2pc), OptionType::kBoolean,
|
|
|
|
OptionVerificationType::kNormal}},
|
2015-08-18 22:30:18 +02:00
|
|
|
{"allow_os_buffer",
|
2015-09-30 02:13:02 +02:00
|
|
|
{offsetof(struct DBOptions, allow_os_buffer), OptionType::kBoolean,
|
|
|
|
OptionVerificationType::kNormal}},
|
2015-08-18 22:30:18 +02:00
|
|
|
{"create_if_missing",
|
2015-09-30 02:13:02 +02:00
|
|
|
{offsetof(struct DBOptions, create_if_missing), OptionType::kBoolean,
|
|
|
|
OptionVerificationType::kNormal}},
|
2015-08-18 22:30:18 +02:00
|
|
|
{"create_missing_column_families",
|
|
|
|
{offsetof(struct DBOptions, create_missing_column_families),
|
2015-09-30 02:13:02 +02:00
|
|
|
OptionType::kBoolean, OptionVerificationType::kNormal}},
|
2015-08-18 22:30:18 +02:00
|
|
|
{"disableDataSync",
|
2015-09-30 02:13:02 +02:00
|
|
|
{offsetof(struct DBOptions, disableDataSync), OptionType::kBoolean,
|
|
|
|
OptionVerificationType::kNormal}},
|
2015-08-18 22:30:18 +02:00
|
|
|
{"disable_data_sync", // for compatibility
|
2015-09-30 02:13:02 +02:00
|
|
|
{offsetof(struct DBOptions, disableDataSync), OptionType::kBoolean,
|
|
|
|
OptionVerificationType::kNormal}},
|
2015-08-18 22:30:18 +02:00
|
|
|
{"enable_thread_tracking",
|
2015-09-30 02:13:02 +02:00
|
|
|
{offsetof(struct DBOptions, enable_thread_tracking), OptionType::kBoolean,
|
|
|
|
OptionVerificationType::kNormal}},
|
2015-08-18 22:30:18 +02:00
|
|
|
{"error_if_exists",
|
2015-09-30 02:13:02 +02:00
|
|
|
{offsetof(struct DBOptions, error_if_exists), OptionType::kBoolean,
|
|
|
|
OptionVerificationType::kNormal}},
|
2015-08-18 22:30:18 +02:00
|
|
|
{"is_fd_close_on_exec",
|
2015-09-30 02:13:02 +02:00
|
|
|
{offsetof(struct DBOptions, is_fd_close_on_exec), OptionType::kBoolean,
|
|
|
|
OptionVerificationType::kNormal}},
|
2015-08-18 22:30:18 +02:00
|
|
|
{"paranoid_checks",
|
2015-09-30 02:13:02 +02:00
|
|
|
{offsetof(struct DBOptions, paranoid_checks), OptionType::kBoolean,
|
|
|
|
OptionVerificationType::kNormal}},
|
2015-08-18 22:30:18 +02:00
|
|
|
{"skip_log_error_on_recovery",
|
|
|
|
{offsetof(struct DBOptions, skip_log_error_on_recovery),
|
2015-09-30 02:13:02 +02:00
|
|
|
OptionType::kBoolean, OptionVerificationType::kNormal}},
|
2015-08-18 22:30:18 +02:00
|
|
|
{"skip_stats_update_on_db_open",
|
|
|
|
{offsetof(struct DBOptions, skip_stats_update_on_db_open),
|
2015-09-30 02:13:02 +02:00
|
|
|
OptionType::kBoolean, OptionVerificationType::kNormal}},
|
2015-08-21 07:33:25 +02:00
|
|
|
{"new_table_reader_for_compaction_inputs",
|
|
|
|
{offsetof(struct DBOptions, new_table_reader_for_compaction_inputs),
|
2015-09-30 02:13:02 +02:00
|
|
|
OptionType::kBoolean, OptionVerificationType::kNormal}},
|
2015-08-27 00:25:59 +02:00
|
|
|
{"compaction_readahead_size",
|
2015-09-30 02:13:02 +02:00
|
|
|
{offsetof(struct DBOptions, compaction_readahead_size), OptionType::kSizeT,
|
|
|
|
OptionVerificationType::kNormal}},
|
2015-10-27 22:44:16 +01:00
|
|
|
{"random_access_max_buffer_size",
|
2015-10-29 23:52:32 +01:00
|
|
|
{offsetof(struct DBOptions, random_access_max_buffer_size),
|
|
|
|
OptionType::kSizeT, OptionVerificationType::kNormal}},
|
2015-10-30 06:10:25 +01: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 20:56:16 +01:00
|
|
|
{offsetof(struct DBOptions, writable_file_max_buffer_size),
|
2015-10-30 06:10:25 +01:00
|
|
|
OptionType::kSizeT, OptionVerificationType::kNormal}},
|
2015-08-18 22:30:18 +02:00
|
|
|
{"use_adaptive_mutex",
|
2015-09-30 02:13:02 +02:00
|
|
|
{offsetof(struct DBOptions, use_adaptive_mutex), OptionType::kBoolean,
|
|
|
|
OptionVerificationType::kNormal}},
|
2015-08-18 22:30:18 +02:00
|
|
|
{"use_fsync",
|
2015-09-30 02:13:02 +02:00
|
|
|
{offsetof(struct DBOptions, use_fsync), OptionType::kBoolean,
|
|
|
|
OptionVerificationType::kNormal}},
|
2015-08-18 22:30:18 +02:00
|
|
|
{"max_background_compactions",
|
2015-09-30 02:13:02 +02:00
|
|
|
{offsetof(struct DBOptions, max_background_compactions), OptionType::kInt,
|
|
|
|
OptionVerificationType::kNormal}},
|
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 20:56:16 +01:00
|
|
|
{"base_background_compactions",
|
|
|
|
{offsetof(struct DBOptions, base_background_compactions), OptionType::kInt,
|
|
|
|
OptionVerificationType::kNormal}},
|
2015-08-18 22:30:18 +02:00
|
|
|
{"max_background_flushes",
|
2015-09-30 02:13:02 +02:00
|
|
|
{offsetof(struct DBOptions, max_background_flushes), OptionType::kInt,
|
|
|
|
OptionVerificationType::kNormal}},
|
2015-08-18 22:30:18 +02:00
|
|
|
{"max_file_opening_threads",
|
2015-09-30 02:13:02 +02:00
|
|
|
{offsetof(struct DBOptions, max_file_opening_threads), OptionType::kInt,
|
|
|
|
OptionVerificationType::kNormal}},
|
2015-08-18 22:30:18 +02:00
|
|
|
{"max_open_files",
|
2015-09-30 02:13:02 +02:00
|
|
|
{offsetof(struct DBOptions, max_open_files), OptionType::kInt,
|
|
|
|
OptionVerificationType::kNormal}},
|
2015-08-18 22:30:18 +02:00
|
|
|
{"table_cache_numshardbits",
|
2015-09-30 02:13:02 +02:00
|
|
|
{offsetof(struct DBOptions, table_cache_numshardbits), OptionType::kInt,
|
|
|
|
OptionVerificationType::kNormal}},
|
2015-08-18 22:30:18 +02:00
|
|
|
{"db_write_buffer_size",
|
2015-09-30 02:13:02 +02:00
|
|
|
{offsetof(struct DBOptions, db_write_buffer_size), OptionType::kSizeT,
|
|
|
|
OptionVerificationType::kNormal}},
|
2015-08-18 22:30:18 +02:00
|
|
|
{"keep_log_file_num",
|
2015-09-30 02:13:02 +02:00
|
|
|
{offsetof(struct DBOptions, keep_log_file_num), OptionType::kSizeT,
|
|
|
|
OptionVerificationType::kNormal}},
|
2015-10-08 03:06:28 +02:00
|
|
|
{"recycle_log_file_num",
|
|
|
|
{offsetof(struct DBOptions, recycle_log_file_num), OptionType::kSizeT,
|
|
|
|
OptionVerificationType::kNormal}},
|
2015-08-18 22:30:18 +02:00
|
|
|
{"log_file_time_to_roll",
|
2015-09-30 02:13:02 +02:00
|
|
|
{offsetof(struct DBOptions, log_file_time_to_roll), OptionType::kSizeT,
|
|
|
|
OptionVerificationType::kNormal}},
|
2015-08-18 22:30:18 +02:00
|
|
|
{"manifest_preallocation_size",
|
|
|
|
{offsetof(struct DBOptions, manifest_preallocation_size),
|
2015-09-30 02:13:02 +02:00
|
|
|
OptionType::kSizeT, OptionVerificationType::kNormal}},
|
2015-08-18 22:30:18 +02:00
|
|
|
{"max_log_file_size",
|
2015-09-30 02:13:02 +02:00
|
|
|
{offsetof(struct DBOptions, max_log_file_size), OptionType::kSizeT,
|
|
|
|
OptionVerificationType::kNormal}},
|
2015-08-18 22:30:18 +02:00
|
|
|
{"db_log_dir",
|
2015-09-30 02:13:02 +02:00
|
|
|
{offsetof(struct DBOptions, db_log_dir), OptionType::kString,
|
|
|
|
OptionVerificationType::kNormal}},
|
|
|
|
{"wal_dir",
|
|
|
|
{offsetof(struct DBOptions, wal_dir), OptionType::kString,
|
|
|
|
OptionVerificationType::kNormal}},
|
2015-08-21 23:25:34 +02:00
|
|
|
{"max_subcompactions",
|
2015-09-30 02:13:02 +02:00
|
|
|
{offsetof(struct DBOptions, max_subcompactions), OptionType::kUInt32T,
|
|
|
|
OptionVerificationType::kNormal}},
|
2015-08-18 22:30:18 +02:00
|
|
|
{"WAL_size_limit_MB",
|
2015-09-30 02:13:02 +02:00
|
|
|
{offsetof(struct DBOptions, WAL_size_limit_MB), OptionType::kUInt64T,
|
|
|
|
OptionVerificationType::kNormal}},
|
2015-08-18 22:30:18 +02:00
|
|
|
{"WAL_ttl_seconds",
|
2015-09-30 02:13:02 +02:00
|
|
|
{offsetof(struct DBOptions, WAL_ttl_seconds), OptionType::kUInt64T,
|
|
|
|
OptionVerificationType::kNormal}},
|
2015-08-18 22:30:18 +02:00
|
|
|
{"bytes_per_sync",
|
2015-09-30 02:13:02 +02:00
|
|
|
{offsetof(struct DBOptions, bytes_per_sync), OptionType::kUInt64T,
|
|
|
|
OptionVerificationType::kNormal}},
|
2015-08-18 22:30:18 +02:00
|
|
|
{"delayed_write_rate",
|
2015-09-30 02:13:02 +02:00
|
|
|
{offsetof(struct DBOptions, delayed_write_rate), OptionType::kUInt64T,
|
|
|
|
OptionVerificationType::kNormal}},
|
2015-08-18 22:30:18 +02:00
|
|
|
{"delete_obsolete_files_period_micros",
|
|
|
|
{offsetof(struct DBOptions, delete_obsolete_files_period_micros),
|
2015-09-30 02:13:02 +02:00
|
|
|
OptionType::kUInt64T, OptionVerificationType::kNormal}},
|
2015-08-18 22:30:18 +02:00
|
|
|
{"max_manifest_file_size",
|
2015-09-30 02:13:02 +02:00
|
|
|
{offsetof(struct DBOptions, max_manifest_file_size), OptionType::kUInt64T,
|
|
|
|
OptionVerificationType::kNormal}},
|
2015-08-18 22:30:18 +02:00
|
|
|
{"max_total_wal_size",
|
2015-09-30 02:13:02 +02:00
|
|
|
{offsetof(struct DBOptions, max_total_wal_size), OptionType::kUInt64T,
|
|
|
|
OptionVerificationType::kNormal}},
|
2015-08-18 22:30:18 +02:00
|
|
|
{"wal_bytes_per_sync",
|
2015-09-30 02:13:02 +02:00
|
|
|
{offsetof(struct DBOptions, wal_bytes_per_sync), OptionType::kUInt64T,
|
|
|
|
OptionVerificationType::kNormal}},
|
2015-08-18 22:30:18 +02:00
|
|
|
{"stats_dump_period_sec",
|
2015-09-30 02:13:02 +02:00
|
|
|
{offsetof(struct DBOptions, stats_dump_period_sec), OptionType::kUInt,
|
2016-03-02 19:34:14 +01:00
|
|
|
OptionVerificationType::kNormal}},
|
|
|
|
{"fail_if_options_file_error",
|
|
|
|
{offsetof(struct DBOptions, fail_if_options_file_error),
|
|
|
|
OptionType::kBoolean, OptionVerificationType::kNormal}},
|
|
|
|
{"allow_concurrent_memtable_write",
|
|
|
|
{offsetof(struct DBOptions, allow_concurrent_memtable_write),
|
|
|
|
OptionType::kBoolean, OptionVerificationType::kNormal}},
|
|
|
|
{"wal_recovery_mode",
|
|
|
|
{offsetof(struct DBOptions, wal_recovery_mode),
|
|
|
|
OptionType::kWALRecoveryMode, OptionVerificationType::kNormal}},
|
|
|
|
{"enable_write_thread_adaptive_yield",
|
|
|
|
{offsetof(struct DBOptions, enable_write_thread_adaptive_yield),
|
|
|
|
OptionType::kBoolean, OptionVerificationType::kNormal}},
|
|
|
|
{"write_thread_slow_yield_usec",
|
|
|
|
{offsetof(struct DBOptions, write_thread_slow_yield_usec),
|
|
|
|
OptionType::kUInt64T, OptionVerificationType::kNormal}},
|
|
|
|
{"write_thread_max_yield_usec",
|
|
|
|
{offsetof(struct DBOptions, write_thread_max_yield_usec),
|
|
|
|
OptionType::kUInt64T, OptionVerificationType::kNormal}},
|
|
|
|
{"access_hint_on_compaction_start",
|
|
|
|
{offsetof(struct DBOptions, access_hint_on_compaction_start),
|
|
|
|
OptionType::kAccessHint, OptionVerificationType::kNormal}},
|
|
|
|
{"info_log_level",
|
|
|
|
{offsetof(struct DBOptions, info_log_level), OptionType::kInfoLogLevel,
|
2016-04-28 01:23:33 +02:00
|
|
|
OptionVerificationType::kNormal}},
|
|
|
|
{"dump_malloc_stats",
|
|
|
|
{offsetof(struct DBOptions, dump_malloc_stats), OptionType::kBoolean,
|
2016-06-13 20:34:16 +02:00
|
|
|
OptionVerificationType::kNormal}},
|
|
|
|
{"avoid_flush_during_recovery",
|
|
|
|
{offsetof(struct DBOptions, avoid_flush_during_recovery),
|
|
|
|
OptionType::kBoolean, OptionVerificationType::kNormal}}};
|
2015-08-18 22:30:18 +02:00
|
|
|
|
2015-08-27 01:13:56 +02: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 22:56:29 +02:00
|
|
|
{"report_bg_io_stats",
|
|
|
|
{offsetof(struct ColumnFamilyOptions, report_bg_io_stats),
|
2016-09-14 06:12:43 +02:00
|
|
|
OptionType::kBoolean, OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableCFOptions, report_bg_io_stats)}},
|
2016-04-14 22:56:29 +02:00
|
|
|
{"compaction_measure_io_stats",
|
2016-09-14 06:12:43 +02:00
|
|
|
{0, OptionType::kBoolean, OptionVerificationType::kDeprecated, false}},
|
2015-08-27 01:13:56 +02:00
|
|
|
{"disable_auto_compactions",
|
|
|
|
{offsetof(struct ColumnFamilyOptions, disable_auto_compactions),
|
2016-09-14 06:12:43 +02:00
|
|
|
OptionType::kBoolean, OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableCFOptions, disable_auto_compactions)}},
|
2015-08-27 01:13:56 +02:00
|
|
|
{"filter_deletes",
|
2016-09-14 06:12:43 +02:00
|
|
|
{0, OptionType::kBoolean, OptionVerificationType::kDeprecated, true}},
|
2015-08-27 01:13:56 +02:00
|
|
|
{"inplace_update_support",
|
|
|
|
{offsetof(struct ColumnFamilyOptions, inplace_update_support),
|
2016-09-14 06:12:43 +02:00
|
|
|
OptionType::kBoolean, OptionVerificationType::kNormal, false}},
|
2015-08-27 01:13:56 +02:00
|
|
|
{"level_compaction_dynamic_level_bytes",
|
|
|
|
{offsetof(struct ColumnFamilyOptions,
|
|
|
|
level_compaction_dynamic_level_bytes),
|
2016-09-14 06:12:43 +02:00
|
|
|
OptionType::kBoolean, OptionVerificationType::kNormal, false}},
|
2015-08-27 01:13:56 +02:00
|
|
|
{"optimize_filters_for_hits",
|
|
|
|
{offsetof(struct ColumnFamilyOptions, optimize_filters_for_hits),
|
2016-09-14 06:12:43 +02:00
|
|
|
OptionType::kBoolean, OptionVerificationType::kNormal, false}},
|
2015-08-27 01:13:56 +02:00
|
|
|
{"paranoid_file_checks",
|
|
|
|
{offsetof(struct ColumnFamilyOptions, paranoid_file_checks),
|
2016-09-14 06:12:43 +02:00
|
|
|
OptionType::kBoolean, OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableCFOptions, paranoid_file_checks)}},
|
2015-08-27 01:13:56 +02:00
|
|
|
{"purge_redundant_kvs_while_flush",
|
|
|
|
{offsetof(struct ColumnFamilyOptions, purge_redundant_kvs_while_flush),
|
2016-09-14 06:12:43 +02:00
|
|
|
OptionType::kBoolean, OptionVerificationType::kNormal, false}},
|
2015-08-27 01:13:56 +02:00
|
|
|
{"verify_checksums_in_compaction",
|
|
|
|
{offsetof(struct ColumnFamilyOptions, verify_checksums_in_compaction),
|
2016-09-14 06:12:43 +02:00
|
|
|
OptionType::kBoolean, OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableCFOptions, verify_checksums_in_compaction)}},
|
2015-11-19 03:10:20 +01:00
|
|
|
{"soft_pending_compaction_bytes_limit",
|
|
|
|
{offsetof(struct ColumnFamilyOptions, soft_pending_compaction_bytes_limit),
|
2016-09-14 06:12:43 +02:00
|
|
|
OptionType::kUInt64T, OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableCFOptions, soft_pending_compaction_bytes_limit)}},
|
2015-09-11 23:31:23 +02:00
|
|
|
{"hard_pending_compaction_bytes_limit",
|
|
|
|
{offsetof(struct ColumnFamilyOptions, hard_pending_compaction_bytes_limit),
|
2016-09-14 06:12:43 +02:00
|
|
|
OptionType::kUInt64T, OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableCFOptions, hard_pending_compaction_bytes_limit)}},
|
2015-08-27 01:13:56 +02:00
|
|
|
{"hard_rate_limit",
|
2016-09-14 06:12:43 +02:00
|
|
|
{0, OptionType::kDouble, OptionVerificationType::kDeprecated, true}},
|
2015-08-27 01:13:56 +02:00
|
|
|
{"soft_rate_limit",
|
2016-09-14 06:12:43 +02:00
|
|
|
{0, OptionType::kDouble, OptionVerificationType::kDeprecated, true}},
|
2016-06-17 01:02:52 +02:00
|
|
|
{"max_compaction_bytes",
|
|
|
|
{offsetof(struct ColumnFamilyOptions, max_compaction_bytes),
|
2016-09-14 06:12:43 +02:00
|
|
|
OptionType::kUInt64T, OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableCFOptions, max_compaction_bytes)}},
|
2015-08-27 01:13:56 +02:00
|
|
|
{"expanded_compaction_factor",
|
2016-09-14 06:12:43 +02:00
|
|
|
{0, OptionType::kInt, OptionVerificationType::kDeprecated, true}},
|
2015-08-27 01:13:56 +02:00
|
|
|
{"level0_file_num_compaction_trigger",
|
|
|
|
{offsetof(struct ColumnFamilyOptions, level0_file_num_compaction_trigger),
|
2016-09-14 06:12:43 +02:00
|
|
|
OptionType::kInt, OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableCFOptions, level0_file_num_compaction_trigger)}},
|
2015-08-27 01:13:56 +02:00
|
|
|
{"level0_slowdown_writes_trigger",
|
|
|
|
{offsetof(struct ColumnFamilyOptions, level0_slowdown_writes_trigger),
|
2016-09-14 06:12:43 +02:00
|
|
|
OptionType::kInt, OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableCFOptions, level0_slowdown_writes_trigger)}},
|
2015-08-27 01:13:56 +02:00
|
|
|
{"level0_stop_writes_trigger",
|
|
|
|
{offsetof(struct ColumnFamilyOptions, level0_stop_writes_trigger),
|
2016-09-14 06:12:43 +02:00
|
|
|
OptionType::kInt, OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableCFOptions, level0_stop_writes_trigger)}},
|
2015-08-27 01:13:56 +02:00
|
|
|
{"max_grandparent_overlap_factor",
|
2016-09-14 06:12:43 +02:00
|
|
|
{0, OptionType::kInt, OptionVerificationType::kDeprecated, true}},
|
2015-08-27 01:13:56 +02:00
|
|
|
{"max_mem_compaction_level",
|
2016-09-14 06:12:43 +02:00
|
|
|
{0, OptionType::kInt, OptionVerificationType::kDeprecated, false}},
|
2015-08-27 01:13:56 +02:00
|
|
|
{"max_write_buffer_number",
|
|
|
|
{offsetof(struct ColumnFamilyOptions, max_write_buffer_number),
|
2016-09-14 06:12:43 +02:00
|
|
|
OptionType::kInt, OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableCFOptions, max_write_buffer_number)}},
|
2015-08-27 01:13:56 +02:00
|
|
|
{"max_write_buffer_number_to_maintain",
|
|
|
|
{offsetof(struct ColumnFamilyOptions, max_write_buffer_number_to_maintain),
|
2016-09-14 06:12:43 +02:00
|
|
|
OptionType::kInt, OptionVerificationType::kNormal, false}},
|
2015-08-27 01:13:56 +02:00
|
|
|
{"min_write_buffer_number_to_merge",
|
|
|
|
{offsetof(struct ColumnFamilyOptions, min_write_buffer_number_to_merge),
|
2016-09-14 06:12:43 +02:00
|
|
|
OptionType::kInt, OptionVerificationType::kNormal, false}},
|
2015-08-27 01:13:56 +02:00
|
|
|
{"num_levels",
|
2015-09-30 02:13:02 +02:00
|
|
|
{offsetof(struct ColumnFamilyOptions, num_levels), OptionType::kInt,
|
2016-09-14 06:12:43 +02:00
|
|
|
OptionVerificationType::kNormal, false}},
|
2015-08-27 01:13:56 +02:00
|
|
|
{"source_compaction_factor",
|
2016-09-14 06:12:43 +02:00
|
|
|
{0, OptionType::kInt, OptionVerificationType::kDeprecated, true}},
|
2015-08-27 01:13:56 +02:00
|
|
|
{"target_file_size_multiplier",
|
|
|
|
{offsetof(struct ColumnFamilyOptions, target_file_size_multiplier),
|
2016-09-14 06:12:43 +02:00
|
|
|
OptionType::kInt, OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableCFOptions, target_file_size_multiplier)}},
|
2015-08-27 01:13:56 +02:00
|
|
|
{"arena_block_size",
|
|
|
|
{offsetof(struct ColumnFamilyOptions, arena_block_size),
|
2016-09-14 06:12:43 +02:00
|
|
|
OptionType::kSizeT, OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableCFOptions, arena_block_size)}},
|
2015-08-27 01:13:56 +02:00
|
|
|
{"inplace_update_num_locks",
|
|
|
|
{offsetof(struct ColumnFamilyOptions, inplace_update_num_locks),
|
2016-09-14 06:12:43 +02:00
|
|
|
OptionType::kSizeT, OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableCFOptions, inplace_update_num_locks)}},
|
2015-08-27 01:13:56 +02:00
|
|
|
{"max_successive_merges",
|
|
|
|
{offsetof(struct ColumnFamilyOptions, max_successive_merges),
|
2016-09-14 06:12:43 +02:00
|
|
|
OptionType::kSizeT, OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableCFOptions, max_successive_merges)}},
|
2016-07-27 03:05:30 +02:00
|
|
|
{"memtable_huge_page_size",
|
|
|
|
{offsetof(struct ColumnFamilyOptions, memtable_huge_page_size),
|
2016-09-14 06:12:43 +02:00
|
|
|
OptionType::kSizeT, OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableCFOptions, memtable_huge_page_size)}},
|
2016-07-27 03:05:30 +02:00
|
|
|
{"memtable_prefix_bloom_huge_page_tlb_size",
|
2016-09-14 06:12:43 +02:00
|
|
|
{0, OptionType::kSizeT, OptionVerificationType::kDeprecated, true}},
|
2015-08-27 01:13:56 +02:00
|
|
|
{"write_buffer_size",
|
|
|
|
{offsetof(struct ColumnFamilyOptions, write_buffer_size),
|
2016-09-14 06:12:43 +02:00
|
|
|
OptionType::kSizeT, OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableCFOptions, write_buffer_size)}},
|
2015-08-27 01:13:56 +02:00
|
|
|
{"bloom_locality",
|
|
|
|
{offsetof(struct ColumnFamilyOptions, bloom_locality),
|
2016-09-14 06:12:43 +02:00
|
|
|
OptionType::kUInt32T, OptionVerificationType::kNormal, false}},
|
2015-08-27 01:13:56 +02:00
|
|
|
{"memtable_prefix_bloom_bits",
|
2016-09-14 06:12:43 +02:00
|
|
|
{0, OptionType::kUInt32T, OptionVerificationType::kDeprecated, true}},
|
2016-06-04 02:02:10 +02:00
|
|
|
{"memtable_prefix_bloom_size_ratio",
|
|
|
|
{offsetof(struct ColumnFamilyOptions, memtable_prefix_bloom_size_ratio),
|
2016-09-14 06:12:43 +02:00
|
|
|
OptionType::kDouble, OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableCFOptions, memtable_prefix_bloom_size_ratio)}},
|
2015-08-27 01:13:56 +02:00
|
|
|
{"memtable_prefix_bloom_probes",
|
2016-09-14 06:12:43 +02:00
|
|
|
{0, OptionType::kUInt32T, OptionVerificationType::kDeprecated, true}},
|
2015-08-27 01:13:56 +02:00
|
|
|
{"min_partial_merge_operands",
|
|
|
|
{offsetof(struct ColumnFamilyOptions, min_partial_merge_operands),
|
2016-09-14 06:12:43 +02:00
|
|
|
OptionType::kUInt32T, OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableCFOptions, min_partial_merge_operands)}},
|
2015-08-27 01:13:56 +02:00
|
|
|
{"max_bytes_for_level_base",
|
|
|
|
{offsetof(struct ColumnFamilyOptions, max_bytes_for_level_base),
|
2016-09-14 06:12:43 +02:00
|
|
|
OptionType::kUInt64T, OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableCFOptions, max_bytes_for_level_base)}},
|
|
|
|
{"max_bytes_for_level_multiplier",
|
|
|
|
{offsetof(struct ColumnFamilyOptions, max_bytes_for_level_multiplier),
|
|
|
|
OptionType::kInt, OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableCFOptions, max_bytes_for_level_multiplier)}},
|
|
|
|
{"max_bytes_for_level_multiplier_additional",
|
|
|
|
{offsetof(struct ColumnFamilyOptions,
|
|
|
|
max_bytes_for_level_multiplier_additional),
|
|
|
|
OptionType::kVectorInt, OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableCFOptions,
|
|
|
|
max_bytes_for_level_multiplier_additional)}},
|
2015-08-27 01:13:56 +02:00
|
|
|
{"max_sequential_skip_in_iterations",
|
|
|
|
{offsetof(struct ColumnFamilyOptions, max_sequential_skip_in_iterations),
|
2016-09-14 06:12:43 +02:00
|
|
|
OptionType::kUInt64T, OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableCFOptions, max_sequential_skip_in_iterations)}},
|
2015-08-27 01:13:56 +02:00
|
|
|
{"target_file_size_base",
|
|
|
|
{offsetof(struct ColumnFamilyOptions, target_file_size_base),
|
2016-09-14 06:12:43 +02:00
|
|
|
OptionType::kUInt64T, OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableCFOptions, target_file_size_base)}},
|
2015-08-27 01:13:56 +02:00
|
|
|
{"rate_limit_delay_max_milliseconds",
|
2016-09-14 06:12:43 +02:00
|
|
|
{0, OptionType::kUInt, OptionVerificationType::kDeprecated, false}},
|
2015-10-03 00:35:32 +02:00
|
|
|
{"compression",
|
|
|
|
{offsetof(struct ColumnFamilyOptions, compression),
|
2016-09-14 06:12:43 +02:00
|
|
|
OptionType::kCompressionType, OptionVerificationType::kNormal, true,
|
|
|
|
offsetof(struct MutableCFOptions, compression)}},
|
2015-10-03 00:35:32 +02:00
|
|
|
{"compression_per_level",
|
|
|
|
{offsetof(struct ColumnFamilyOptions, compression_per_level),
|
2016-09-14 06:12:43 +02:00
|
|
|
OptionType::kVectorCompressionType, OptionVerificationType::kNormal,
|
|
|
|
false}},
|
2016-05-10 00:57:19 +02:00
|
|
|
{"bottommost_compression",
|
|
|
|
{offsetof(struct ColumnFamilyOptions, bottommost_compression),
|
2016-09-14 06:12:43 +02:00
|
|
|
OptionType::kCompressionType, OptionVerificationType::kNormal, false}},
|
2015-10-03 00:35:32 +02:00
|
|
|
{"comparator",
|
|
|
|
{offsetof(struct ColumnFamilyOptions, comparator), OptionType::kComparator,
|
2016-09-14 06:12:43 +02:00
|
|
|
OptionVerificationType::kByName, false}},
|
2015-10-03 00:35:32 +02:00
|
|
|
{"prefix_extractor",
|
|
|
|
{offsetof(struct ColumnFamilyOptions, prefix_extractor),
|
2016-09-14 06:12:43 +02:00
|
|
|
OptionType::kSliceTransform, OptionVerificationType::kByNameAllowNull,
|
|
|
|
false}},
|
2015-10-03 00:35:32 +02:00
|
|
|
{"memtable_factory",
|
|
|
|
{offsetof(struct ColumnFamilyOptions, memtable_factory),
|
2016-09-14 06:12:43 +02:00
|
|
|
OptionType::kMemTableRepFactory, OptionVerificationType::kByName, false}},
|
2015-10-03 00:35:32 +02:00
|
|
|
{"table_factory",
|
|
|
|
{offsetof(struct ColumnFamilyOptions, table_factory),
|
2016-09-14 06:12:43 +02:00
|
|
|
OptionType::kTableFactory, OptionVerificationType::kByName, false}},
|
2015-10-03 00:35:32 +02:00
|
|
|
{"compaction_filter",
|
|
|
|
{offsetof(struct ColumnFamilyOptions, compaction_filter),
|
2016-09-14 06:12:43 +02:00
|
|
|
OptionType::kCompactionFilter, OptionVerificationType::kByName, false}},
|
2015-10-03 00:35:32 +02:00
|
|
|
{"compaction_filter_factory",
|
|
|
|
{offsetof(struct ColumnFamilyOptions, compaction_filter_factory),
|
2016-09-14 06:12:43 +02:00
|
|
|
OptionType::kCompactionFilterFactory, OptionVerificationType::kByName,
|
|
|
|
false}},
|
2015-10-03 00:35:32 +02:00
|
|
|
{"merge_operator",
|
|
|
|
{offsetof(struct ColumnFamilyOptions, merge_operator),
|
2016-09-14 06:12:43 +02:00
|
|
|
OptionType::kMergeOperator, OptionVerificationType::kByName, false}},
|
2015-08-27 01:13:56 +02:00
|
|
|
{"compaction_style",
|
|
|
|
{offsetof(struct ColumnFamilyOptions, compaction_style),
|
2016-09-14 06:12:43 +02:00
|
|
|
OptionType::kCompactionStyle, OptionVerificationType::kNormal, false}}};
|
2015-08-27 01:13:56 +02:00
|
|
|
|
Adding pin_l0_filter_and_index_blocks_in_cache feature and related fixes.
Summary:
When a block based table file is opened, if prefetch_index_and_filter is true, it will prefetch the index and filter blocks, putting them into the block cache.
What this feature adds: when a L0 block based table file is opened, if pin_l0_filter_and_index_blocks_in_cache is true in the options (and prefetch_index_and_filter is true), then the filter and index blocks aren't released back to the block cache at the end of BlockBasedTableReader::Open(). Instead the table reader takes ownership of them, hence pinning them, ie. the LRU cache will never push them out. Meanwhile in the table reader, further accesses will not hit the block cache, thus avoiding lock contention.
Test Plan:
'export TEST_TMPDIR=/dev/shm/ && DISABLE_JEMALLOC=1 OPT=-g make all valgrind_check -j32' is OK.
I didn't run the Java tests, I don't have Java set up on my devserver.
Reviewers: sdong
Reviewed By: sdong
Subscribers: andrewkr, dhruba
Differential Revision: https://reviews.facebook.net/D56133
2016-04-01 19:42:39 +02:00
|
|
|
static std::unordered_map<std::string, OptionTypeInfo>
|
|
|
|
block_based_table_type_info = {
|
|
|
|
/* currently not supported
|
|
|
|
std::shared_ptr<Cache> block_cache = nullptr;
|
|
|
|
std::shared_ptr<Cache> block_cache_compressed = nullptr;
|
|
|
|
*/
|
|
|
|
{"flush_block_policy_factory",
|
|
|
|
{offsetof(struct BlockBasedTableOptions, flush_block_policy_factory),
|
|
|
|
OptionType::kFlushBlockPolicyFactory,
|
|
|
|
OptionVerificationType::kByName}},
|
|
|
|
{"cache_index_and_filter_blocks",
|
|
|
|
{offsetof(struct BlockBasedTableOptions,
|
|
|
|
cache_index_and_filter_blocks),
|
|
|
|
OptionType::kBoolean, OptionVerificationType::kNormal}},
|
2016-08-23 22:44:13 +02:00
|
|
|
{"cache_index_and_filter_blocks_with_high_priority",
|
|
|
|
{offsetof(struct BlockBasedTableOptions,
|
|
|
|
cache_index_and_filter_blocks_with_high_priority),
|
|
|
|
OptionType::kBoolean, OptionVerificationType::kNormal}},
|
Adding pin_l0_filter_and_index_blocks_in_cache feature and related fixes.
Summary:
When a block based table file is opened, if prefetch_index_and_filter is true, it will prefetch the index and filter blocks, putting them into the block cache.
What this feature adds: when a L0 block based table file is opened, if pin_l0_filter_and_index_blocks_in_cache is true in the options (and prefetch_index_and_filter is true), then the filter and index blocks aren't released back to the block cache at the end of BlockBasedTableReader::Open(). Instead the table reader takes ownership of them, hence pinning them, ie. the LRU cache will never push them out. Meanwhile in the table reader, further accesses will not hit the block cache, thus avoiding lock contention.
Test Plan:
'export TEST_TMPDIR=/dev/shm/ && DISABLE_JEMALLOC=1 OPT=-g make all valgrind_check -j32' is OK.
I didn't run the Java tests, I don't have Java set up on my devserver.
Reviewers: sdong
Reviewed By: sdong
Subscribers: andrewkr, dhruba
Differential Revision: https://reviews.facebook.net/D56133
2016-04-01 19:42:39 +02:00
|
|
|
{"pin_l0_filter_and_index_blocks_in_cache",
|
|
|
|
{offsetof(struct BlockBasedTableOptions,
|
|
|
|
pin_l0_filter_and_index_blocks_in_cache),
|
|
|
|
OptionType::kBoolean, OptionVerificationType::kNormal}},
|
|
|
|
{"index_type",
|
|
|
|
{offsetof(struct BlockBasedTableOptions, index_type),
|
|
|
|
OptionType::kBlockBasedTableIndexType,
|
|
|
|
OptionVerificationType::kNormal}},
|
|
|
|
{"hash_index_allow_collision",
|
|
|
|
{offsetof(struct BlockBasedTableOptions, hash_index_allow_collision),
|
|
|
|
OptionType::kBoolean, OptionVerificationType::kNormal}},
|
|
|
|
{"checksum",
|
|
|
|
{offsetof(struct BlockBasedTableOptions, checksum),
|
|
|
|
OptionType::kChecksumType, OptionVerificationType::kNormal}},
|
|
|
|
{"no_block_cache",
|
|
|
|
{offsetof(struct BlockBasedTableOptions, no_block_cache),
|
|
|
|
OptionType::kBoolean, OptionVerificationType::kNormal}},
|
|
|
|
{"block_size",
|
|
|
|
{offsetof(struct BlockBasedTableOptions, block_size),
|
|
|
|
OptionType::kSizeT, OptionVerificationType::kNormal}},
|
|
|
|
{"block_size_deviation",
|
|
|
|
{offsetof(struct BlockBasedTableOptions, block_size_deviation),
|
|
|
|
OptionType::kInt, OptionVerificationType::kNormal}},
|
|
|
|
{"block_restart_interval",
|
|
|
|
{offsetof(struct BlockBasedTableOptions, block_restart_interval),
|
|
|
|
OptionType::kInt, OptionVerificationType::kNormal}},
|
|
|
|
{"index_block_restart_interval",
|
|
|
|
{offsetof(struct BlockBasedTableOptions, index_block_restart_interval),
|
|
|
|
OptionType::kInt, OptionVerificationType::kNormal}},
|
|
|
|
{"filter_policy",
|
|
|
|
{offsetof(struct BlockBasedTableOptions, filter_policy),
|
|
|
|
OptionType::kFilterPolicy, OptionVerificationType::kByName}},
|
|
|
|
{"whole_key_filtering",
|
|
|
|
{offsetof(struct BlockBasedTableOptions, whole_key_filtering),
|
|
|
|
OptionType::kBoolean, OptionVerificationType::kNormal}},
|
|
|
|
{"skip_table_builder_flush",
|
|
|
|
{offsetof(struct BlockBasedTableOptions, skip_table_builder_flush),
|
|
|
|
OptionType::kBoolean, OptionVerificationType::kNormal}},
|
|
|
|
{"format_version",
|
|
|
|
{offsetof(struct BlockBasedTableOptions, format_version),
|
2016-06-11 03:20:54 +02:00
|
|
|
OptionType::kUInt32T, OptionVerificationType::kNormal}},
|
|
|
|
{"verify_compression",
|
|
|
|
{offsetof(struct BlockBasedTableOptions, verify_compression),
|
2016-08-27 03:55:58 +02:00
|
|
|
OptionType::kBoolean, OptionVerificationType::kNormal}},
|
|
|
|
{"read_amp_bytes_per_bit",
|
|
|
|
{offsetof(struct BlockBasedTableOptions, read_amp_bytes_per_bit),
|
|
|
|
OptionType::kSizeT, OptionVerificationType::kNormal}}};
|
2015-10-28 18:46:01 +01:00
|
|
|
|
2015-11-18 01:41:54 +01:00
|
|
|
static std::unordered_map<std::string, OptionTypeInfo> plain_table_type_info = {
|
|
|
|
{"user_key_len",
|
|
|
|
{offsetof(struct PlainTableOptions, user_key_len), OptionType::kUInt32T,
|
|
|
|
OptionVerificationType::kNormal}},
|
|
|
|
{"bloom_bits_per_key",
|
|
|
|
{offsetof(struct PlainTableOptions, bloom_bits_per_key), OptionType::kInt,
|
|
|
|
OptionVerificationType::kNormal}},
|
|
|
|
{"hash_table_ratio",
|
|
|
|
{offsetof(struct PlainTableOptions, hash_table_ratio), OptionType::kDouble,
|
|
|
|
OptionVerificationType::kNormal}},
|
|
|
|
{"index_sparseness",
|
|
|
|
{offsetof(struct PlainTableOptions, index_sparseness), OptionType::kSizeT,
|
|
|
|
OptionVerificationType::kNormal}},
|
|
|
|
{"huge_page_tlb_size",
|
|
|
|
{offsetof(struct PlainTableOptions, huge_page_tlb_size),
|
|
|
|
OptionType::kSizeT, OptionVerificationType::kNormal}},
|
|
|
|
{"encoding_type",
|
|
|
|
{offsetof(struct PlainTableOptions, encoding_type),
|
|
|
|
OptionType::kEncodingType, OptionVerificationType::kByName}},
|
|
|
|
{"full_scan_mode",
|
|
|
|
{offsetof(struct PlainTableOptions, full_scan_mode), OptionType::kBoolean,
|
|
|
|
OptionVerificationType::kNormal}},
|
|
|
|
{"store_index_in_file",
|
|
|
|
{offsetof(struct PlainTableOptions, store_index_in_file),
|
|
|
|
OptionType::kBoolean, OptionVerificationType::kNormal}}};
|
2015-10-28 18:46:01 +01:00
|
|
|
|
2015-11-18 01:41:54 +01:00
|
|
|
static std::unordered_map<std::string, CompressionType>
|
2015-10-30 23:58:46 +01:00
|
|
|
compression_type_string_map = {
|
2015-11-18 01:41:54 +01:00
|
|
|
{"kNoCompression", kNoCompression},
|
|
|
|
{"kSnappyCompression", kSnappyCompression},
|
|
|
|
{"kZlibCompression", kZlibCompression},
|
|
|
|
{"kBZip2Compression", kBZip2Compression},
|
|
|
|
{"kLZ4Compression", kLZ4Compression},
|
|
|
|
{"kLZ4HCCompression", kLZ4HCCompression},
|
2016-05-10 00:57:19 +02:00
|
|
|
{"kXpressCompression", kXpressCompression},
|
2016-09-02 00:28:40 +02:00
|
|
|
{"kZSTD", kZSTD},
|
2016-05-10 00:57:19 +02:00
|
|
|
{"kZSTDNotFinalCompression", kZSTDNotFinalCompression},
|
|
|
|
{"kDisableCompressionOption", kDisableCompressionOption}};
|
2015-10-30 23:58:46 +01:00
|
|
|
|
|
|
|
static std::unordered_map<std::string, BlockBasedTableOptions::IndexType>
|
2015-11-18 01:41:54 +01:00
|
|
|
block_base_table_index_type_string_map = {
|
2015-10-30 23:58:46 +01:00
|
|
|
{"kBinarySearch", BlockBasedTableOptions::IndexType::kBinarySearch},
|
|
|
|
{"kHashSearch", BlockBasedTableOptions::IndexType::kHashSearch}};
|
|
|
|
|
2015-11-18 01:41:54 +01:00
|
|
|
static std::unordered_map<std::string, EncodingType> encoding_type_string_map =
|
|
|
|
{{"kPlain", kPlain}, {"kPrefix", kPrefix}};
|
2015-10-30 23:58:46 +01:00
|
|
|
|
2015-11-18 01:41:54 +01:00
|
|
|
static std::unordered_map<std::string, ChecksumType> checksum_type_string_map =
|
|
|
|
{{"kNoChecksum", kNoChecksum}, {"kCRC32c", kCRC32c}, {"kxxHash", kxxHash}};
|
2015-10-30 23:58:46 +01:00
|
|
|
|
|
|
|
static std::unordered_map<std::string, CompactionStyle>
|
|
|
|
compaction_style_string_map = {
|
|
|
|
{"kCompactionStyleLevel", kCompactionStyleLevel},
|
|
|
|
{"kCompactionStyleUniversal", kCompactionStyleUniversal},
|
|
|
|
{"kCompactionStyleFIFO", kCompactionStyleFIFO},
|
|
|
|
{"kCompactionStyleNone", kCompactionStyleNone}};
|
|
|
|
|
2016-03-02 19:34:14 +01: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}};
|
|
|
|
|
2014-09-17 21:49:13 +02:00
|
|
|
} // namespace rocksdb
|
RocksDB Options file format and its serialization / deserialization.
Summary:
This patch defines the format of RocksDB options file, which
follows the INI file format, and implements functions for its
serialization and deserialization. An example RocksDB options
file can be found in examples/rocksdb_option_file_example.ini.
A typical RocksDB options file has three sections, which are
Version, DBOptions, and more than one CFOptions. The RocksDB
options file in general follows the basic INI file format
with the following extensions / modifications:
* Escaped characters
We escaped the following characters:
- \n -- line feed - new line
- \r -- carriage return
- \\ -- backslash \
- \: -- colon symbol :
- \# -- hash tag #
* Comments
We support # style comments. Comments can appear at the ending
part of a line.
* Statements
A statement is of the form option_name = value.
Each statement contains a '=', where extra white-spaces
are supported. However, we don't support multi-lined statement.
Furthermore, each line can only contain at most one statement.
* Section
Sections are of the form [SecitonTitle "SectionArgument"],
where section argument is optional.
* List
We use colon-separated string to represent a list.
For instance, n1:n2:n3:n4 is a list containing four values.
Below is an example of a RocksDB options file:
[Version]
rocksdb_version=4.0.0
options_file_version=1.0
[DBOptions]
max_open_files=12345
max_background_flushes=301
[CFOptions "default"]
[CFOptions "the second column family"]
[CFOptions "the third column family"]
Test Plan: Added many tests in options_test.cc
Reviewers: igor, IslamAbdelRahman, sdong, anthony
Reviewed By: anthony
Subscribers: maykov, dhruba, leveldb
Differential Revision: https://reviews.facebook.net/D46059
2015-09-29 23:42:40 +02:00
|
|
|
|
|
|
|
#endif // !ROCKSDB_LITE
|