From: Casey Bodley Date: Mon, 5 Feb 2024 07:05:49 +0000 (+0530) Subject: rgw/d4n: fixing the 'get' call hanging issues and X-Git-Tag: v20.0.0~2219^2~13 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=fb5d01a602526fb091c14a06bbd4ddb7342a6091;p=ceph.git rgw/d4n: fixing the 'get' call hanging issues and Operation Canceled errors, by wrapping async_exec call in boost::asio::dispatch() call. Signed-off-by: Casey Bodley --- diff --git a/src/rgw/driver/d4n/d4n_directory.cc b/src/rgw/driver/d4n/d4n_directory.cc index a3dbc0b3bf90..2e9f9ad80cf8 100644 --- a/src/rgw/driver/d4n/d4n_directory.cc +++ b/src/rgw/driver/d4n/d4n_directory.cc @@ -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 conn; - boost::redis::request req; using executor_type = boost::redis::connection::executor_type; executor_type get_executor() const noexcept { return conn->get_executor(); } template - 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 conn, { return boost::asio::async_initiate( - initiate_exec{std::move(conn), req}, token, resp); + initiate_exec{std::move(conn)}, token, req, resp); } template diff --git a/src/rgw/driver/d4n/d4n_policy.cc b/src/rgw/driver/d4n/d4n_policy.cc index b2d4a725cac0..5adba67db01c 100644 --- a/src/rgw/driver/d4n/d4n_policy.cc +++ b/src/rgw/driver/d4n/d4n_policy.cc @@ -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 conn; - boost::redis::request req; using executor_type = boost::redis::connection::executor_type; executor_type get_executor() const noexcept { return conn->get_executor(); } template - 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 conn, { return boost::asio::async_initiate( - initiate_exec{std::move(conn), req}, token, resp); + initiate_exec{std::move(conn)}, token, req, resp); } template diff --git a/src/rgw/rgw_redis_driver.cc b/src/rgw/rgw_redis_driver.cc index caad53a24262..554e68ad17f7 100644 --- a/src/rgw/rgw_redis_driver.cc +++ b/src/rgw/rgw_redis_driver.cc @@ -26,15 +26,18 @@ std::list build_attrs(const rgw::sal::Attrs& binary) // initiate a call to async_exec() on the connection's executor struct initiate_exec { std::shared_ptr conn; - boost::redis::request req; using executor_type = boost::redis::connection::executor_type; executor_type get_executor() const noexcept { return conn->get_executor(); } template - 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 conn, { return boost::asio::async_initiate( - initiate_exec{std::move(conn), req}, token, resp); + initiate_exec{std::move(conn)}, token, req, resp); } template