Change default value of some Options

Summary: Since we are optimizing for server workloads, some default values are not optimized any more. We change some of those values that I feel it's less prone to regression bugs.

Test Plan: make all check

Reviewers: dhruba, haobo, ljin, igor, yhchiang

Reviewed By: igor

CC: leveldb, MarkCallaghan

Differential Revision: https://reviews.facebook.net/D16995
This commit is contained in:
sdong 2014-03-28 16:57:04 -07:00
parent 2d3468c293
commit 43a593a6d9
3 changed files with 16 additions and 11 deletions

View File

@ -306,6 +306,7 @@ class DBTest {
DBTest() : option_config_(kDefault), DBTest() : option_config_(kDefault),
env_(new SpecialEnv(Env::Default())) { env_(new SpecialEnv(Env::Default())) {
last_options_.max_background_flushes = 0;
filter_policy_ = NewBloomFilterPolicy(10); filter_policy_ = NewBloomFilterPolicy(10);
dbname_ = test::TmpDir() + "/db_test"; dbname_ = test::TmpDir() + "/db_test";
ASSERT_OK(DestroyDB(dbname_, Options())); ASSERT_OK(DestroyDB(dbname_, Options()));
@ -371,6 +372,8 @@ class DBTest {
// Return the current option configuration. // Return the current option configuration.
Options CurrentOptions() { Options CurrentOptions() {
Options options; Options options;
options.paranoid_checks = false;
options.max_background_flushes = 0;
switch (option_config_) { switch (option_config_) {
case kHashSkipList: case kHashSkipList:
options.prefix_extractor.reset(NewFixedPrefixTransform(1)); options.prefix_extractor.reset(NewFixedPrefixTransform(1));
@ -431,6 +434,7 @@ class DBTest {
options.compaction_style = kCompactionStyleUniversal; options.compaction_style = kCompactionStyleUniversal;
break; break;
case kCompressedBlockCache: case kCompressedBlockCache:
options.allow_mmap_writes = true;
options.block_cache_compressed = NewLRUCache(8*1024*1024); options.block_cache_compressed = NewLRUCache(8*1024*1024);
break; break;
case kInfiniteMaxOpenFiles: case kInfiniteMaxOpenFiles:
@ -5306,6 +5310,7 @@ TEST(DBTest, ReadCompaction) {
options.filter_policy = nullptr; options.filter_policy = nullptr;
options.block_size = 4096; options.block_size = 4096;
options.no_block_cache = true; options.no_block_cache = true;
options.disable_seek_compaction = false;
Reopen(&options); Reopen(&options);

View File

@ -146,7 +146,7 @@ struct Options {
// If any of the writes to the database fails (Put, Delete, Merge, Write), // If any of the writes to the database fails (Put, Delete, Merge, Write),
// the database will switch to read-only mode and fail all other // the database will switch to read-only mode and fail all other
// Write operations. // Write operations.
// Default: false // Default: true
bool paranoid_checks; bool paranoid_checks;
// Use the specified object to interact with the environment, // Use the specified object to interact with the environment,
@ -199,7 +199,7 @@ struct Options {
// on target_file_size_base and target_file_size_multiplier for level-based // on target_file_size_base and target_file_size_multiplier for level-based
// compaction. For universal-style compaction, you can usually set it to -1. // compaction. For universal-style compaction, you can usually set it to -1.
// //
// Default: 1000 // Default: 5000
int max_open_files; int max_open_files;
// Control over blocks (user data is stored in a set of blocks, and // Control over blocks (user data is stored in a set of blocks, and
@ -436,7 +436,7 @@ struct Options {
// Without a separate pool, long running major compaction jobs could // Without a separate pool, long running major compaction jobs could
// potentially block memtable flush jobs of other db instances, leading to // potentially block memtable flush jobs of other db instances, leading to
// unnecessary Put stalls. // unnecessary Put stalls.
// Default: 0 // Default: 1
int max_background_flushes; int max_background_flushes;
// Specify the maximal size of the info log file. If the log file // Specify the maximal size of the info log file. If the log file
@ -562,7 +562,7 @@ struct Options {
// Allow the OS to mmap file for reading sst tables. Default: false // Allow the OS to mmap file for reading sst tables. Default: false
bool allow_mmap_reads; bool allow_mmap_reads;
// Allow the OS to mmap file for writing. Default: true // Allow the OS to mmap file for writing. Default: false
bool allow_mmap_writes; bool allow_mmap_writes;
// Disable child process inherit open files. Default: true // Disable child process inherit open files. Default: true

View File

@ -35,14 +35,14 @@ Options::Options()
compaction_filter_factory_v2(new DefaultCompactionFilterFactoryV2()), compaction_filter_factory_v2(new DefaultCompactionFilterFactoryV2()),
create_if_missing(false), create_if_missing(false),
error_if_exists(false), error_if_exists(false),
paranoid_checks(false), paranoid_checks(true),
env(Env::Default()), env(Env::Default()),
info_log(nullptr), info_log(nullptr),
info_log_level(INFO), info_log_level(INFO),
write_buffer_size(4 << 20), write_buffer_size(4 << 20),
max_write_buffer_number(2), max_write_buffer_number(2),
min_write_buffer_number_to_merge(1), min_write_buffer_number_to_merge(1),
max_open_files(1000), max_open_files(5000),
block_cache(nullptr), block_cache(nullptr),
block_cache_compressed(nullptr), block_cache_compressed(nullptr),
block_size(4096), block_size(4096),
@ -53,8 +53,8 @@ Options::Options()
whole_key_filtering(true), whole_key_filtering(true),
num_levels(7), num_levels(7),
level0_file_num_compaction_trigger(4), level0_file_num_compaction_trigger(4),
level0_slowdown_writes_trigger(8), level0_slowdown_writes_trigger(20),
level0_stop_writes_trigger(12), level0_stop_writes_trigger(24),
max_mem_compaction_level(2), max_mem_compaction_level(2),
target_file_size_base(2 * 1048576), target_file_size_base(2 * 1048576),
target_file_size_multiplier(1), target_file_size_multiplier(1),
@ -69,10 +69,10 @@ Options::Options()
db_stats_log_interval(1800), db_stats_log_interval(1800),
db_log_dir(""), db_log_dir(""),
wal_dir(""), wal_dir(""),
disable_seek_compaction(false), disable_seek_compaction(true),
delete_obsolete_files_period_micros(6 * 60 * 60 * 1000000UL), delete_obsolete_files_period_micros(6 * 60 * 60 * 1000000UL),
max_background_compactions(1), max_background_compactions(1),
max_background_flushes(0), max_background_flushes(1),
max_log_file_size(0), max_log_file_size(0),
log_file_time_to_roll(0), log_file_time_to_roll(0),
keep_log_file_num(1000), keep_log_file_num(1000),
@ -91,7 +91,7 @@ Options::Options()
purge_redundant_kvs_while_flush(true), purge_redundant_kvs_while_flush(true),
allow_os_buffer(true), allow_os_buffer(true),
allow_mmap_reads(false), allow_mmap_reads(false),
allow_mmap_writes(true), allow_mmap_writes(false),
is_fd_close_on_exec(true), is_fd_close_on_exec(true),
skip_log_error_on_recovery(false), skip_log_error_on_recovery(false),
stats_dump_period_sec(3600), stats_dump_period_sec(3600),