]> git-server-git.apps.pok.os.sepia.ceph.com Git - rocksdb.git/commitdiff
Prevent db_stress failure when io_uring is disabled (#11045)
authoranand76 <anand76@devvm4702.ftw0.facebook.com>
Mon, 19 Dec 2022 19:38:42 +0000 (11:38 -0800)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Mon, 19 Dec 2022 19:38:42 +0000 (11:38 -0800)
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

index 7f86ee8a6828c68907d9d7f89e4a27b70513d42b..7c73a08ba0e3ae8c96cca532494cbc78f2260ea2 100644 (file)
@@ -29,8 +29,7 @@
 namespace ROCKSDB_NAMESPACE {
 namespace {
 static std::shared_ptr<ROCKSDB_NAMESPACE::Env> env_guard;
-static std::shared_ptr<ROCKSDB_NAMESPACE::CompositeEnvWrapper>
-    env_wrapper_guard;
+static std::shared_ptr<ROCKSDB_NAMESPACE::Env> env_wrapper_guard;
 static std::shared_ptr<ROCKSDB_NAMESPACE::CompositeEnvWrapper>
     dbsl_env_wrapper_guard;
 static std::shared_ptr<CompositeEnvWrapper> fault_env_guard;
@@ -99,6 +98,13 @@ int db_stress_tool(int argc, char** argv) {
 
   env_wrapper_guard = std::make_shared<CompositeEnvWrapper>(
       raw_env, std::make_shared<DbStressFSWrapper>(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<EnvWrapper>(env_wrapper_guard);
+  }
   db_stress_env = env_wrapper_guard.get();
 
   FLAGS_rep_factory = StringToRepFactory(FLAGS_memtablerep.c_str());