diff --git a/db_stress_tool/db_stress_common.h b/db_stress_tool/db_stress_common.h index 109b0d3b310de341605a367ae2393ecf675dcf47..1dea256283e7c902a6db009016039faf6f55d655 100644 --- a/db_stress_tool/db_stress_common.h +++ b/db_stress_tool/db_stress_common.h @@ -282,6 +282,9 @@ DECLARE_uint64(wp_snapshot_cache_bits); DECLARE_uint64(wp_commit_cache_bits); #endif // !ROCKSDB_LITE +DECLARE_bool(adaptive_readahead); +DECLARE_bool(async_io); + constexpr long KB = 1024; constexpr int kRandomValueMaxFactor = 3; constexpr int kValueMaxLen = 100; diff --git a/db_stress_tool/db_stress_gflags.cc b/db_stress_tool/db_stress_gflags.cc index 205cff68c1a3a7c56892bcec57be5944be3ff462..e7eee76ebe42c8af7dc5eebaadb43a935c8b067b 100644 --- a/db_stress_tool/db_stress_gflags.cc +++ b/db_stress_tool/db_stress_gflags.cc @@ -912,4 +912,11 @@ DEFINE_uint64(wp_commit_cache_bits, 23ull, "commit cache. Default: 23 (8M entries)"); #endif // !ROCKSDB_LITE +DEFINE_bool(adaptive_readahead, false, + "Carry forward internal auto readahead size from one file to next " + "file at each level during iteration"); +DEFINE_bool( + async_io, false, + "Does asynchronous prefetching when internal auto readahead is enabled"); + #endif // GFLAGS diff --git a/db_stress_tool/db_stress_test_base.cc b/db_stress_tool/db_stress_test_base.cc index cbadbb6ed1e4d7a64b9e1f58e673b7a7c07a3598..1368298ebcd75e66b0c5d123d42e5645c782eca8 100644 --- a/db_stress_tool/db_stress_test_base.cc +++ b/db_stress_tool/db_stress_test_base.cc @@ -645,6 +645,8 @@ void StressTest::OperateDb(ThreadState* thread) { ReadOptions read_opts(FLAGS_verify_checksum, true); read_opts.rate_limiter_priority = FLAGS_rate_limit_user_ops ? Env::IO_USER : Env::IO_TOTAL; + read_opts.async_io = FLAGS_async_io; + read_opts.adaptive_readahead = FLAGS_adaptive_readahead; WriteOptions write_opts; if (FLAGS_rate_limit_auto_wal_flush) { write_opts.rate_limiter_priority = Env::IO_USER; diff --git a/tools/db_crashtest.py b/tools/db_crashtest.py index b6b3a6d744d6e37cfb4db48eebdb11e4de0a9574..0252eda39fe84432db36dcbbc7d401efa30209c3 100644 --- a/tools/db_crashtest.py +++ b/tools/db_crashtest.py @@ -163,6 +163,8 @@ default_params = { "memtable_prefix_bloom_size_ratio": lambda: random.choice([0.001, 0.01, 0.1, 0.5]), "memtable_whole_key_filtering": lambda: random.randint(0, 1), "detect_filter_construct_corruption": lambda: random.choice([0, 1]), + "adaptive_readahead": lambda: random.choice([0, 1]), + "async_io": lambda: random.choice([0, 1]), } _TEST_DIR_ENV_VAR = 'TEST_TMPDIR'