diff --git a/db_stress_tool/db_stress_common.h b/db_stress_tool/db_stress_common.h index f98cd1ec9..d2b1ae4fc 100644 --- a/db_stress_tool/db_stress_common.h +++ b/db_stress_tool/db_stress_common.h @@ -285,6 +285,7 @@ DECLARE_uint64(wp_commit_cache_bits); DECLARE_bool(adaptive_readahead); DECLARE_bool(async_io); +DECLARE_string(wal_compression); constexpr long KB = 1024; constexpr int kRandomValueMaxFactor = 3; diff --git a/db_stress_tool/db_stress_gflags.cc b/db_stress_tool/db_stress_gflags.cc index a137ad97d..8b92f9332 100644 --- a/db_stress_tool/db_stress_gflags.cc +++ b/db_stress_tool/db_stress_gflags.cc @@ -924,4 +924,7 @@ DEFINE_bool( async_io, false, "Does asynchronous prefetching when internal auto readahead is enabled"); +DEFINE_string(wal_compression, "none", + "Algorithm to use for WAL compression. none to disable."); + #endif // GFLAGS diff --git a/db_stress_tool/db_stress_test_base.cc b/db_stress_tool/db_stress_test_base.cc index 3acaefd67..9fde2ecd7 100644 --- a/db_stress_tool/db_stress_test_base.cc +++ b/db_stress_tool/db_stress_test_base.cc @@ -2296,6 +2296,8 @@ void StressTest::PrintEnv() const { static_cast(FLAGS_fail_if_options_file_error)); fprintf(stdout, "User timestamp size bytes : %d\n", static_cast(FLAGS_user_timestamp_size)); + fprintf(stdout, "WAL compression : %s\n", + FLAGS_wal_compression.c_str()); fprintf(stdout, "------------------------------------------------\n"); } @@ -2438,6 +2440,9 @@ void StressTest::Open() { FLAGS_blob_garbage_collection_force_threshold; options_.blob_compaction_readahead_size = FLAGS_blob_compaction_readahead_size; + + options_.wal_compression = + StringToCompressionType(FLAGS_wal_compression.c_str()); } else { #ifdef ROCKSDB_LITE fprintf(stderr, "--options_file not supported in lite mode\n"); diff --git a/tools/db_crashtest.py b/tools/db_crashtest.py index bb8508665..231f79372 100644 --- a/tools/db_crashtest.py +++ b/tools/db_crashtest.py @@ -166,6 +166,7 @@ default_params = { "detect_filter_construct_corruption": lambda: random.choice([0, 1]), "adaptive_readahead": lambda: random.choice([0, 1]), "async_io": lambda: random.choice([0, 1]), + "wal_compression": lambda: random.choice(["none", "zstd"]), } _TEST_DIR_ENV_VAR = 'TEST_TMPDIR'