Skip to content

Commit

Permalink
Add 'adaptive_readahead' and 'async_io' options to db_stress (faceboo…
Browse files Browse the repository at this point in the history
…k#9750)

Summary:
Same as title

Pull Request resolved: facebook#9750

Test Plan:
export CRASH_TEST_EXT_ARGS=" --async_io=1 --adaptive_readahead=1;
make -j crash_test

Reviewed By: jay-zhuang

Differential Revision: D35114326

Pulled By: akankshamahajan15

fbshipit-source-id: 8b05c95be09f7aff6cb9eb757aa20a6520349d45
  • Loading branch information
akankshamahajan15 authored and facebook-github-bot committed Mar 30, 2022
1 parent 60106b9 commit fd66005
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions db_stress_tool/db_stress_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 7 additions & 0 deletions db_stress_tool/db_stress_gflags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions db_stress_tool/db_stress_test_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions tools/db_crashtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@
"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'
Expand Down

0 comments on commit fd66005

Please sign in to comment.