Skip to content

Commit 43a593a

Browse files
committed
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
1 parent 2d3468c commit 43a593a

File tree

3 files changed

+16
-11
lines changed

3 files changed

+16
-11
lines changed

db/db_test.cc

+5
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ class DBTest {
306306

307307
DBTest() : option_config_(kDefault),
308308
env_(new SpecialEnv(Env::Default())) {
309+
last_options_.max_background_flushes = 0;
309310
filter_policy_ = NewBloomFilterPolicy(10);
310311
dbname_ = test::TmpDir() + "/db_test";
311312
ASSERT_OK(DestroyDB(dbname_, Options()));
@@ -371,6 +372,8 @@ class DBTest {
371372
// Return the current option configuration.
372373
Options CurrentOptions() {
373374
Options options;
375+
options.paranoid_checks = false;
376+
options.max_background_flushes = 0;
374377
switch (option_config_) {
375378
case kHashSkipList:
376379
options.prefix_extractor.reset(NewFixedPrefixTransform(1));
@@ -431,6 +434,7 @@ class DBTest {
431434
options.compaction_style = kCompactionStyleUniversal;
432435
break;
433436
case kCompressedBlockCache:
437+
options.allow_mmap_writes = true;
434438
options.block_cache_compressed = NewLRUCache(8*1024*1024);
435439
break;
436440
case kInfiniteMaxOpenFiles:
@@ -5306,6 +5310,7 @@ TEST(DBTest, ReadCompaction) {
53065310
options.filter_policy = nullptr;
53075311
options.block_size = 4096;
53085312
options.no_block_cache = true;
5313+
options.disable_seek_compaction = false;
53095314

53105315
Reopen(&options);
53115316

include/rocksdb/options.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ struct Options {
146146
// If any of the writes to the database fails (Put, Delete, Merge, Write),
147147
// the database will switch to read-only mode and fail all other
148148
// Write operations.
149-
// Default: false
149+
// Default: true
150150
bool paranoid_checks;
151151

152152
// Use the specified object to interact with the environment,
@@ -199,7 +199,7 @@ struct Options {
199199
// on target_file_size_base and target_file_size_multiplier for level-based
200200
// compaction. For universal-style compaction, you can usually set it to -1.
201201
//
202-
// Default: 1000
202+
// Default: 5000
203203
int max_open_files;
204204

205205
// Control over blocks (user data is stored in a set of blocks, and
@@ -436,7 +436,7 @@ struct Options {
436436
// Without a separate pool, long running major compaction jobs could
437437
// potentially block memtable flush jobs of other db instances, leading to
438438
// unnecessary Put stalls.
439-
// Default: 0
439+
// Default: 1
440440
int max_background_flushes;
441441

442442
// Specify the maximal size of the info log file. If the log file
@@ -562,7 +562,7 @@ struct Options {
562562
// Allow the OS to mmap file for reading sst tables. Default: false
563563
bool allow_mmap_reads;
564564

565-
// Allow the OS to mmap file for writing. Default: true
565+
// Allow the OS to mmap file for writing. Default: false
566566
bool allow_mmap_writes;
567567

568568
// Disable child process inherit open files. Default: true

util/options.cc

+7-7
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ Options::Options()
3535
compaction_filter_factory_v2(new DefaultCompactionFilterFactoryV2()),
3636
create_if_missing(false),
3737
error_if_exists(false),
38-
paranoid_checks(false),
38+
paranoid_checks(true),
3939
env(Env::Default()),
4040
info_log(nullptr),
4141
info_log_level(INFO),
4242
write_buffer_size(4 << 20),
4343
max_write_buffer_number(2),
4444
min_write_buffer_number_to_merge(1),
45-
max_open_files(1000),
45+
max_open_files(5000),
4646
block_cache(nullptr),
4747
block_cache_compressed(nullptr),
4848
block_size(4096),
@@ -53,8 +53,8 @@ Options::Options()
5353
whole_key_filtering(true),
5454
num_levels(7),
5555
level0_file_num_compaction_trigger(4),
56-
level0_slowdown_writes_trigger(8),
57-
level0_stop_writes_trigger(12),
56+
level0_slowdown_writes_trigger(20),
57+
level0_stop_writes_trigger(24),
5858
max_mem_compaction_level(2),
5959
target_file_size_base(2 * 1048576),
6060
target_file_size_multiplier(1),
@@ -69,10 +69,10 @@ Options::Options()
6969
db_stats_log_interval(1800),
7070
db_log_dir(""),
7171
wal_dir(""),
72-
disable_seek_compaction(false),
72+
disable_seek_compaction(true),
7373
delete_obsolete_files_period_micros(6 * 60 * 60 * 1000000UL),
7474
max_background_compactions(1),
75-
max_background_flushes(0),
75+
max_background_flushes(1),
7676
max_log_file_size(0),
7777
log_file_time_to_roll(0),
7878
keep_log_file_num(1000),
@@ -91,7 +91,7 @@ Options::Options()
9191
purge_redundant_kvs_while_flush(true),
9292
allow_os_buffer(true),
9393
allow_mmap_reads(false),
94-
allow_mmap_writes(true),
94+
allow_mmap_writes(false),
9595
is_fd_close_on_exec(true),
9696
skip_log_error_on_recovery(false),
9797
stats_dump_period_sec(3600),

0 commit comments

Comments
 (0)