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());