exercise WAL recycling in crash test (#5070)

Summary:
Since this feature affects the WAL behavior, it seems important our crash-recovery tests cover it.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/5070

Differential Revision: D14470085

Pulled By: miasantreble

fbshipit-source-id: 9b9682a718a926d57d055e0a5ec867efbd2eb9c1
This commit is contained in:
Andrew Kryczka 2019-03-15 11:58:37 -07:00 committed by Facebook Github Bot
parent dcde292c3b
commit 2263f86901
2 changed files with 6 additions and 0 deletions

View File

@ -48,6 +48,7 @@ default_params = {
"prefixpercent": 5, "prefixpercent": 5,
"progress_reports": 0, "progress_reports": 0,
"readpercent": 45, "readpercent": 45,
"recycle_log_file_num": lambda: random.randint(0, 1),
"reopen": 20, "reopen": 20,
"snapshot_hold_ops": 100000, "snapshot_hold_ops": 100000,
"subcompactions": lambda: random.randint(1, 4), "subcompactions": lambda: random.randint(1, 4),

View File

@ -379,6 +379,9 @@ extern std::vector<std::string> rocksdb_kill_prefix_blacklist;
DEFINE_bool(disable_wal, false, "If true, do not write WAL for write."); DEFINE_bool(disable_wal, false, "If true, do not write WAL for write.");
DEFINE_uint64(recycle_log_file_num, rocksdb::Options().recycle_log_file_num,
"Number of old WAL files to keep around for later recycling");
DEFINE_int64(target_file_size_base, rocksdb::Options().target_file_size_base, DEFINE_int64(target_file_size_base, rocksdb::Options().target_file_size_base,
"Target level-1 file size for compaction"); "Target level-1 file size for compaction");
@ -2605,6 +2608,8 @@ class StressTest {
options_.use_direct_reads = FLAGS_use_direct_reads; options_.use_direct_reads = FLAGS_use_direct_reads;
options_.use_direct_io_for_flush_and_compaction = options_.use_direct_io_for_flush_and_compaction =
FLAGS_use_direct_io_for_flush_and_compaction; FLAGS_use_direct_io_for_flush_and_compaction;
options_.recycle_log_file_num =
static_cast<size_t>(FLAGS_recycle_log_file_num);
options_.target_file_size_base = FLAGS_target_file_size_base; options_.target_file_size_base = FLAGS_target_file_size_base;
options_.target_file_size_multiplier = FLAGS_target_file_size_multiplier; options_.target_file_size_multiplier = FLAGS_target_file_size_multiplier;
options_.max_bytes_for_level_base = FLAGS_max_bytes_for_level_base; options_.max_bytes_for_level_base = FLAGS_max_bytes_for_level_base;