]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/d4n: fixing the 'get' call hanging issues and
authorCasey Bodley <cbodley@redhat.com>
Mon, 5 Feb 2024 07:05:49 +0000 (12:35 +0530)
committerPritha Srivastava <prsrivas@redhat.com>
Tue, 2 Apr 2024 15:54:52 +0000 (21:24 +0530)
Operation Canceled errors, by wrapping async_exec
call in boost::asio::dispatch() call.

Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/driver/d4n/d4n_directory.cc
src/rgw/driver/d4n/d4n_policy.cc
src/rgw/rgw_redis_driver.cc

index a3dbc0b3bf90cb849940933e315d582c3da0d843..2e9f9ad80cf8e37c5b1ef0156649394ef4234d65 100644 (file)
@@ -8,15 +8,18 @@ namespace rgw { namespace d4n {
 // initiate a call to async_exec() on the connection's executor
 struct initiate_exec {
   std::shared_ptr<boost::redis::connection> conn;
-  boost::redis::request req;
 
   using executor_type = boost::redis::connection::executor_type;
   executor_type get_executor() const noexcept { return conn->get_executor(); }
 
   template <typename Handler, typename Response>
-  void operator()(Handler handler, Response& resp)
+  void operator()(Handler handler, const boost::redis::request& req, Response& resp)
   {
-    conn->async_exec(req, resp, boost::asio::consign(std::move(handler), conn));
+    auto h = boost::asio::consign(std::move(handler), conn);
+    return boost::asio::dispatch(get_executor(),
+        [c = conn, &req, &resp, h = std::move(h)] {
+            return c->async_exec(req, resp, std::move(h));
+    });
   }
 };
 
@@ -27,7 +30,7 @@ auto async_exec(std::shared_ptr<connection> conn,
 {
   return boost::asio::async_initiate<CompletionToken,
          void(boost::system::error_code, std::size_t)>(
-      initiate_exec{std::move(conn), req}, token, resp);
+      initiate_exec{std::move(conn)}, token, req, resp);
 }
 
 template <typename T>
index b2d4a725cac08943a6d9f18b3809fd1578c98624..5adba67db01c7f6595519b2269c6f522b100a11b 100644 (file)
@@ -10,15 +10,17 @@ namespace rgw { namespace d4n {
 // initiate a call to async_exec() on the connection's executor
 struct initiate_exec {
   std::shared_ptr<boost::redis::connection> conn;
-  boost::redis::request req;
 
   using executor_type = boost::redis::connection::executor_type;
   executor_type get_executor() const noexcept { return conn->get_executor(); }
 
   template <typename Handler, typename Response>
-  void operator()(Handler handler, Response& resp)
+  void operator()(Handler handler, const boost::redis::request& req, Response& resp)
   {
-    conn->async_exec(req, resp, boost::asio::consign(std::move(handler), conn));
+    auto h = boost::asio::consign(std::move(handler), conn);
+    return boost::asio::dispatch(get_executor(), [c=conn, &req, &resp, h=std::move(h)] {
+      c->async_exec(req, resp, std::move(h));
+    });
   }
 };
 
@@ -29,7 +31,7 @@ auto async_exec(std::shared_ptr<connection> conn,
 {
   return boost::asio::async_initiate<CompletionToken,
          void(boost::system::error_code, std::size_t)>(
-      initiate_exec{std::move(conn), req}, token, resp);
+      initiate_exec{std::move(conn)}, token, req, resp);
 }
 
 template <typename T>
index caad53a24262da69bae4a0ee24666ce96de89ebe..554e68ad17f7f226c06b2bcbf82ca1f1cf657cf1 100644 (file)
@@ -26,15 +26,18 @@ std::list<std::string> build_attrs(const rgw::sal::Attrs& binary)
 // initiate a call to async_exec() on the connection's executor
 struct initiate_exec {
   std::shared_ptr<boost::redis::connection> conn;
-  boost::redis::request req;
 
   using executor_type = boost::redis::connection::executor_type;
   executor_type get_executor() const noexcept { return conn->get_executor(); }
   
   template <typename Handler, typename Response>
-  void operator()(Handler handler, Response& resp)
+  void operator()(Handler handler, const boost::redis::request& req, Response& resp)
   {
-    conn->async_exec(req, resp, boost::asio::consign(std::move(handler), conn));
+    auto h = boost::asio::consign(std::move(handler), conn);
+    return boost::asio::dispatch(get_executor(),
+        [c=conn, &req, &resp, h=std::move(h)] {
+          return c->async_exec(req, resp, std::move(h));
+          });
   } 
 };
 
@@ -45,7 +48,7 @@ auto async_exec(std::shared_ptr<connection> conn,
 {
   return boost::asio::async_initiate<CompletionToken,
          void(boost::system::error_code, std::size_t)>(
-      initiate_exec{std::move(conn), req}, token, resp);
+      initiate_exec{std::move(conn)}, token, req, resp);
 }
 
 template <typename T>