diff --git a/tools/db_crashtest.py b/tools/db_crashtest.py index cd53fefce4..dbabb2b4f8 100644 --- a/tools/db_crashtest.py +++ b/tools/db_crashtest.py @@ -48,6 +48,7 @@ default_params = { "prefixpercent": 5, "progress_reports": 0, "readpercent": 45, + "recycle_log_file_num": lambda: random.randint(0, 1), "reopen": 20, "snapshot_hold_ops": 100000, "subcompactions": lambda: random.randint(1, 4), diff --git a/tools/db_stress.cc b/tools/db_stress.cc index b916bf5fff..1d079a7c7f 100644 --- a/tools/db_stress.cc +++ b/tools/db_stress.cc @@ -379,6 +379,9 @@ extern std::vector rocksdb_kill_prefix_blacklist; 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, "Target level-1 file size for compaction"); @@ -2605,6 +2608,8 @@ class StressTest { options_.use_direct_reads = FLAGS_use_direct_reads; options_.use_direct_io_for_flush_and_compaction = FLAGS_use_direct_io_for_flush_and_compaction; + options_.recycle_log_file_num = + static_cast(FLAGS_recycle_log_file_num); options_.target_file_size_base = FLAGS_target_file_size_base; options_.target_file_size_multiplier = FLAGS_target_file_size_multiplier; options_.max_bytes_for_level_base = FLAGS_max_bytes_for_level_base;