]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/d4n: Shutdown Redis connection in `shutdown()`
authorAdam C. Emerson <aemerson@redhat.com>
Tue, 8 Apr 2025 17:29:46 +0000 (13:29 -0400)
committerAdam C. Emerson <aemerson@redhat.com>
Fri, 11 Apr 2025 16:27:12 +0000 (12:27 -0400)
Since we changed the shutdown logic to let Asio tasks finish, make
sure we finish.

Fixes: https://tracker.ceph.com/issues/70771
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
src/rgw/driver/d4n/rgw_sal_d4n.cc
src/rgw/driver/d4n/rgw_sal_d4n.h

index 65145fb833bfb3dd046516fcd97c410bbe25f386..3b9ee0581b3dc664b61a757fbe06144253f1aa62 100644 (file)
@@ -36,36 +36,26 @@ static inline Object* nextObject(Object* t)
 D4NFilterDriver::D4NFilterDriver(Driver* _next, boost::asio::io_context& io_context) : FilterDriver(_next),
                                                                                        io_context(io_context) 
 {
-  conn = std::make_shared<connection>(boost::asio::make_strand(io_context));
-
   rgw::cache::Partition partition_info;
   partition_info.location = g_conf()->rgw_d4n_l1_datacache_persistent_path;
   partition_info.name = "d4n";
   partition_info.type = "read-cache";
   partition_info.size = g_conf()->rgw_d4n_l1_datacache_size;
-
   cacheDriver = new rgw::cache::SSDDriver(partition_info);
-  objDir = new rgw::d4n::ObjectDirectory(conn);
-  blockDir = new rgw::d4n::BlockDirectory(conn);
-  policyDriver = new rgw::d4n::PolicyDriver(conn, cacheDriver, "lfuda");
 }
 
-D4NFilterDriver::~D4NFilterDriver()
-{
-  // call cancel() on the connection's executor
-  boost::asio::dispatch(conn->get_executor(), [c = conn] { c->cancel(); });
-
-  delete cacheDriver;
-  delete objDir; 
-  delete blockDir; 
-  delete policyDriver;
-}
+D4NFilterDriver::~D4NFilterDriver() = default;
 
 int D4NFilterDriver::initialize(CephContext *cct, const DoutPrefixProvider *dpp)
 {
   namespace net = boost::asio;
   using boost::redis::config;
 
+  conn = std::make_shared<connection>(boost::asio::make_strand(io_context));
+  objDir = new rgw::d4n::ObjectDirectory(conn);
+  blockDir = new rgw::d4n::BlockDirectory(conn);
+  policyDriver = new rgw::d4n::PolicyDriver(conn, cacheDriver, "lfuda");
+
   std::string address = cct->_conf->rgw_d4n_address;
   config cfg;
   cfg.addr.host = address.substr(0, address.find(":"));
@@ -260,6 +250,19 @@ std::unique_ptr<Writer> D4NFilterDriver::get_atomic_writer(const DoutPrefixProvi
   return std::make_unique<D4NFilterWriter>(std::move(writer), this, obj, dpp, true, y);
 }
 
+void D4NFilterDriver::shutdown()
+{
+  // call cancel() on the connection's executor
+  boost::asio::dispatch(conn->get_executor(), [c = conn] { c->cancel(); });
+
+  delete cacheDriver;
+  delete objDir;
+  delete blockDir;
+  delete policyDriver;
+
+  next->shutdown();
+}
+
 std::unique_ptr<Object::ReadOp> D4NFilterObject::get_read_op()
 {
   std::unique_ptr<ReadOp> r = next->get_read_op();
index 2d852b33ecc3709c88233c91a09cb3dbf149e135..d6c1c85b8e8d6b57345a8d581397c01c12765abc 100644 (file)
@@ -68,6 +68,7 @@ class D4NFilterDriver : public FilterDriver {
     rgw::d4n::ObjectDirectory* get_obj_dir() { return objDir; }
     rgw::d4n::BlockDirectory* get_block_dir() { return blockDir; }
     rgw::d4n::PolicyDriver* get_policy_driver() { return policyDriver; }
+    void shutdown() override;
 };
 
 class D4NFilterUser : public FilterUser {