From 43a593a6d921acbf79ccac0abad35c093faac175 Mon Sep 17 00:00:00 2001 From: sdong Date: Fri, 28 Mar 2014 16:57:04 -0700 Subject: [PATCH] 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 --- db/db_test.cc | 5 +++++ include/rocksdb/options.h | 8 ++++---- util/options.cc | 14 +++++++------- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/db/db_test.cc b/db/db_test.cc index ee70871a2..0f007f791 100644 --- a/db/db_test.cc +++ b/db/db_test.cc @@ -306,6 +306,7 @@ class DBTest { DBTest() : option_config_(kDefault), env_(new SpecialEnv(Env::Default())) { + last_options_.max_background_flushes = 0; filter_policy_ = NewBloomFilterPolicy(10); dbname_ = test::TmpDir() + "/db_test"; ASSERT_OK(DestroyDB(dbname_, Options())); @@ -371,6 +372,8 @@ class DBTest { // Return the current option configuration. Options CurrentOptions() { Options options; + options.paranoid_checks = false; + options.max_background_flushes = 0; switch (option_config_) { case kHashSkipList: options.prefix_extractor.reset(NewFixedPrefixTransform(1)); @@ -431,6 +434,7 @@ class DBTest { options.compaction_style = kCompactionStyleUniversal; break; case kCompressedBlockCache: + options.allow_mmap_writes = true; options.block_cache_compressed = NewLRUCache(8*1024*1024); break; case kInfiniteMaxOpenFiles: @@ -5306,6 +5310,7 @@ TEST(DBTest, ReadCompaction) { options.filter_policy = nullptr; options.block_size = 4096; options.no_block_cache = true; + options.disable_seek_compaction = false; Reopen(&options); diff --git a/include/rocksdb/options.h b/include/rocksdb/options.h index bd51669a2..54b4ef38f 100644 --- a/include/rocksdb/options.h +++ b/include/rocksdb/options.h @@ -146,7 +146,7 @@ struct Options { // 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 // Write operations. - // Default: false + // Default: true bool paranoid_checks; // 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 // compaction. For universal-style compaction, you can usually set it to -1. // - // Default: 1000 + // Default: 5000 int max_open_files; // 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 // potentially block memtable flush jobs of other db instances, leading to // unnecessary Put stalls. - // Default: 0 + // Default: 1 int max_background_flushes; // 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 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; // Disable child process inherit open files. Default: true diff --git a/util/options.cc b/util/options.cc index aa1a4c64e..5c5bab557 100644 --- a/util/options.cc +++ b/util/options.cc @@ -35,14 +35,14 @@ Options::Options() compaction_filter_factory_v2(new DefaultCompactionFilterFactoryV2()), create_if_missing(false), error_if_exists(false), - paranoid_checks(false), + paranoid_checks(true), env(Env::Default()), info_log(nullptr), info_log_level(INFO), write_buffer_size(4 << 20), max_write_buffer_number(2), min_write_buffer_number_to_merge(1), - max_open_files(1000), + max_open_files(5000), block_cache(nullptr), block_cache_compressed(nullptr), block_size(4096), @@ -53,8 +53,8 @@ Options::Options() whole_key_filtering(true), num_levels(7), level0_file_num_compaction_trigger(4), - level0_slowdown_writes_trigger(8), - level0_stop_writes_trigger(12), + level0_slowdown_writes_trigger(20), + level0_stop_writes_trigger(24), max_mem_compaction_level(2), target_file_size_base(2 * 1048576), target_file_size_multiplier(1), @@ -69,10 +69,10 @@ Options::Options() db_stats_log_interval(1800), db_log_dir(""), wal_dir(""), - disable_seek_compaction(false), + disable_seek_compaction(true), delete_obsolete_files_period_micros(6 * 60 * 60 * 1000000UL), max_background_compactions(1), - max_background_flushes(0), + max_background_flushes(1), max_log_file_size(0), log_file_time_to_roll(0), keep_log_file_num(1000), @@ -91,7 +91,7 @@ Options::Options() purge_redundant_kvs_while_flush(true), allow_os_buffer(true), allow_mmap_reads(false), - allow_mmap_writes(true), + allow_mmap_writes(false), is_fd_close_on_exec(true), skip_log_error_on_recovery(false), stats_dump_period_sec(3600),