From 692d6be3586fd03ba955f8afe8cdccadf742cc58 Mon Sep 17 00:00:00 2001 From: anand76 Date: Mon, 19 Dec 2022 11:38:42 -0800 Subject: [PATCH] Prevent db_stress failure when io_uring is disabled (#11045) Summary: The IO uring usage is disabled in RocksDB by default and, as a result, PosixRandomAccessFile::ReadAsync returns a NotSupported() status. This was causing stress test failures with MultiGet and async_io combination. Fix it by relying on redirection of ReadAsync to Read when default Env is used in db_stress. Pull Request resolved: https://github.com/facebook/rocksdb/pull/11045 Reviewed By: akankshamahajan15 Differential Revision: D42136213 Pulled By: anand1976 fbshipit-source-id: fc7904d8ece74d7e8f2e1a34c3d70bd5774fb45f --- db_stress_tool/db_stress_tool.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/db_stress_tool/db_stress_tool.cc b/db_stress_tool/db_stress_tool.cc index 7f86ee8a6..7c73a08ba 100644 --- a/db_stress_tool/db_stress_tool.cc +++ b/db_stress_tool/db_stress_tool.cc @@ -29,8 +29,7 @@ namespace ROCKSDB_NAMESPACE { namespace { static std::shared_ptr env_guard; -static std::shared_ptr - env_wrapper_guard; +static std::shared_ptr env_wrapper_guard; static std::shared_ptr dbsl_env_wrapper_guard; static std::shared_ptr fault_env_guard; @@ -99,6 +98,13 @@ int db_stress_tool(int argc, char** argv) { env_wrapper_guard = std::make_shared( raw_env, std::make_shared(raw_env->GetFileSystem())); + if (!env_opts) { + // If using the default Env (Posix), wrap DbStressEnvWrapper with the + // legacy EnvWrapper. This is a temporary fix for the ReadAsync interface + // not being properly supported with Posix and db_stress. The EnvWrapper + // has a default implementation of ReadAsync that redirects to Read. + env_wrapper_guard = std::make_shared(env_wrapper_guard); + } db_stress_env = env_wrapper_guard.get(); FLAGS_rep_factory = StringToRepFactory(FLAGS_memtablerep.c_str());