Add WAL compression to stress tests (#9811)

Summary:
Add the WAL compression feature to the stress test.

Pull Request resolved: https://github.com/facebook/rocksdb/pull/9811

Reviewed By: riversand963

Differential Revision: D35414316

Pulled By: anand1976

fbshipit-source-id: 0c17b1ec55679a52f088ad368798b57139bd921a
main
anand76 3 years ago committed by Facebook GitHub Bot
parent ad32646e18
commit c3d7e16252
  1. 1
      db_stress_tool/db_stress_common.h
  2. 3
      db_stress_tool/db_stress_gflags.cc
  3. 5
      db_stress_tool/db_stress_test_base.cc
  4. 1
      tools/db_crashtest.py

@ -285,6 +285,7 @@ DECLARE_uint64(wp_commit_cache_bits);
DECLARE_bool(adaptive_readahead); DECLARE_bool(adaptive_readahead);
DECLARE_bool(async_io); DECLARE_bool(async_io);
DECLARE_string(wal_compression);
constexpr long KB = 1024; constexpr long KB = 1024;
constexpr int kRandomValueMaxFactor = 3; constexpr int kRandomValueMaxFactor = 3;

@ -924,4 +924,7 @@ DEFINE_bool(
async_io, false, async_io, false,
"Does asynchronous prefetching when internal auto readahead is enabled"); "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 #endif // GFLAGS

@ -2296,6 +2296,8 @@ void StressTest::PrintEnv() const {
static_cast<int>(FLAGS_fail_if_options_file_error)); static_cast<int>(FLAGS_fail_if_options_file_error));
fprintf(stdout, "User timestamp size bytes : %d\n", fprintf(stdout, "User timestamp size bytes : %d\n",
static_cast<int>(FLAGS_user_timestamp_size)); static_cast<int>(FLAGS_user_timestamp_size));
fprintf(stdout, "WAL compression : %s\n",
FLAGS_wal_compression.c_str());
fprintf(stdout, "------------------------------------------------\n"); fprintf(stdout, "------------------------------------------------\n");
} }
@ -2438,6 +2440,9 @@ void StressTest::Open() {
FLAGS_blob_garbage_collection_force_threshold; FLAGS_blob_garbage_collection_force_threshold;
options_.blob_compaction_readahead_size = options_.blob_compaction_readahead_size =
FLAGS_blob_compaction_readahead_size; FLAGS_blob_compaction_readahead_size;
options_.wal_compression =
StringToCompressionType(FLAGS_wal_compression.c_str());
} else { } else {
#ifdef ROCKSDB_LITE #ifdef ROCKSDB_LITE
fprintf(stderr, "--options_file not supported in lite mode\n"); fprintf(stderr, "--options_file not supported in lite mode\n");

@ -166,6 +166,7 @@ default_params = {
"detect_filter_construct_corruption": lambda: random.choice([0, 1]), "detect_filter_construct_corruption": lambda: random.choice([0, 1]),
"adaptive_readahead": lambda: random.choice([0, 1]), "adaptive_readahead": lambda: random.choice([0, 1]),
"async_io": 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' _TEST_DIR_ENV_VAR = 'TEST_TMPDIR'

Loading…
Cancel
Save