]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/cache: Remove `del` method
authorSamarah <samarah.uriarte@ibm.com>
Thu, 17 Oct 2024 17:20:34 +0000 (17:20 +0000)
committerPritha Srivastava <prsrivas@redhat.com>
Mon, 21 Apr 2025 04:04:07 +0000 (09:34 +0530)
Signed-off-by: Samarah <samarah.uriarte@ibm.com>
src/rgw/rgw_cache_driver.h
src/rgw/rgw_redis_driver.cc
src/rgw/rgw_redis_driver.h
src/rgw/rgw_ssd_driver.h
src/test/rgw/test_redis_driver.cc

index f8d9747cb5fcf699c4a7fa5bdbacc81e780bed5d..2ca91538fb95c1dfa8c5b5d0fa9a4cc18a4e64a8 100644 (file)
@@ -43,7 +43,6 @@ class CacheDriver {
     virtual int initialize(const DoutPrefixProvider* dpp) = 0;
     virtual int put(const DoutPrefixProvider* dpp, const std::string& key, const bufferlist& bl, uint64_t len, const rgw::sal::Attrs& attrs, optional_yield y) = 0;
     virtual int get(const DoutPrefixProvider* dpp, const std::string& key, off_t offset, uint64_t len, bufferlist& bl, rgw::sal::Attrs& attrs, optional_yield y) = 0;
-    virtual int del(const DoutPrefixProvider* dpp, const std::string& key, optional_yield y) = 0;
     virtual rgw::AioResultList get_async (const DoutPrefixProvider* dpp, optional_yield y, rgw::Aio* aio, const std::string& key, off_t ofs, uint64_t len, uint64_t cost, uint64_t id) = 0;
     virtual rgw::AioResultList put_async(const DoutPrefixProvider* dpp, optional_yield y, rgw::Aio* aio, const std::string& key, const bufferlist& bl, uint64_t len, const rgw::sal::Attrs& attrs, uint64_t cost, uint64_t id) = 0;
     virtual int append_data(const DoutPrefixProvider* dpp, const::std::string& key, const bufferlist& bl_data, optional_yield y) = 0;
index d785a405a19dfd6cf593545f1f5d358e33178cd6..3fb93583b61a1a4c69cd1d67d1d5a7bbb2b398fc 100644 (file)
@@ -162,41 +162,6 @@ int RedisDriver::get(const DoutPrefixProvider* dpp, const std::string& key, off_
   return 0;
 }
 
-int RedisDriver::del(const DoutPrefixProvider* dpp, const std::string& key, optional_yield y)
-{
-  std::string entry = partition_info.location + key;
-  response<int> resp;
-
-  try {
-    boost::system::error_code ec;
-    response<
-      ignore_t,
-      ignore_t,
-      ignore_t,
-      response<std::optional<int>, std::optional<int>>
-    > resp;
-    request req;
-    req.push("MULTI");
-    req.push("HSTRLEN", entry, "data");
-    req.push("DEL", entry);
-    req.push("EXEC");
-
-    redis_exec(conn, ec, req, resp, y);
-
-    if (ec) {
-      ldpp_dout(dpp, 0) << "RedisDriver::" << __func__ << "(): ERROR: " << ec.what() << dendl;
-      return -ec.value();
-    }
-
-    this->free_space += std::get<0>(std::get<3>(resp).value()).value().value();
-  } catch (std::exception &e) {
-    ldpp_dout(dpp, 0) << "RedisDriver::" << __func__ << "(): ERROR: " << e.what() << dendl;
-    return -EINVAL;
-  }
-
-  return 0; 
-}
-
 int RedisDriver::append_data(const DoutPrefixProvider* dpp, const::std::string& key, const bufferlist& bl_data, optional_yield y) 
 {
   std::string value = "";
@@ -251,19 +216,20 @@ int RedisDriver::append_data(const DoutPrefixProvider* dpp, const::std::string&
 int RedisDriver::delete_data(const DoutPrefixProvider* dpp, const::std::string& key, optional_yield y) 
 {
   std::string entry = partition_info.location + key;
+  response<int> resp;
 
   try {
     boost::system::error_code ec;
-    request req;
     response<
       ignore_t,
       ignore_t,
       ignore_t,
       response<std::optional<int>, std::optional<int>>
     > resp;
+    request req;
     req.push("MULTI");
     req.push("HSTRLEN", entry, "data");
-    req.push("HDEL", entry, "data");
+    req.push("DEL", entry);
     req.push("EXEC");
 
     redis_exec(conn, ec, req, resp, y);
@@ -279,7 +245,7 @@ int RedisDriver::delete_data(const DoutPrefixProvider* dpp, const::std::string&
     return -EINVAL;
   }
 
-  return 0;
+  return 0; 
 }
 
 int RedisDriver::rename(const DoutPrefixProvider* dpp, const::std::string& oldKey, const::std::string& newKey, optional_yield y) {
index e100976cace31556018686da58193b88fc015171..7889e8fc7d77e391174fee94c49cba951745344a 100644 (file)
@@ -36,7 +36,6 @@ class RedisDriver : public CacheDriver {
                                           const rgw::sal::Attrs& attrs, uint64_t cost, uint64_t id) override;
     virtual int get(const DoutPrefixProvider* dpp, const std::string& key, off_t offset, uint64_t len, bufferlist& bl, rgw::sal::Attrs& attrs, optional_yield y) override;
     virtual rgw::AioResultList get_async(const DoutPrefixProvider* dpp, optional_yield y, rgw::Aio* aio, const std::string& key, off_t ofs, uint64_t len, uint64_t cost, uint64_t id) override;
-    virtual int del(const DoutPrefixProvider* dpp, const std::string& key, optional_yield y) override;
     virtual int append_data(const DoutPrefixProvider* dpp, const::std::string& key, const bufferlist& bl_data, optional_yield y) override;
     virtual int delete_data(const DoutPrefixProvider* dpp, const::std::string& key, optional_yield y) override;
     virtual int rename(const DoutPrefixProvider* dpp, const::std::string& oldKey, const::std::string& newKey, optional_yield y) override;
index f8a74fb6ab3385810aaebac031065d1899684567..dedf539e0fffc9f5ed0236ccb97490c28545d62c 100644 (file)
@@ -14,7 +14,6 @@ public:
   virtual int initialize(const DoutPrefixProvider* dpp) override;
   virtual int put(const DoutPrefixProvider* dpp, const std::string& key, const bufferlist& bl, uint64_t len, const rgw::sal::Attrs& attrs, optional_yield y) override;
   virtual int get(const DoutPrefixProvider* dpp, const std::string& key, off_t offset, uint64_t len, bufferlist& bl, rgw::sal::Attrs& attrs, optional_yield y) override;
-  virtual int del(const DoutPrefixProvider* dpp, const std::string& key, optional_yield y) override { return -1; } // TODO: implement
   virtual rgw::AioResultList get_async (const DoutPrefixProvider* dpp, optional_yield y, rgw::Aio* aio, const std::string& key, off_t ofs, uint64_t len, uint64_t cost, uint64_t id) override;
   virtual rgw::AioResultList put_async(const DoutPrefixProvider* dpp, optional_yield y, rgw::Aio* aio, const std::string& key, const bufferlist& bl, uint64_t len, const rgw::sal::Attrs& attrs, uint64_t cost, uint64_t id) override;
   virtual int append_data(const DoutPrefixProvider* dpp, const::std::string& key, const bufferlist& bl_data, optional_yield y) override;
index 8aefe7fbc398f175321fae6af88c436f01c76644..a811ff031b9f4b6174ddebe84d04a7fa24967677 100644 (file)
@@ -246,7 +246,7 @@ TEST_F(RedisDriverFixture, GetAsyncYield)
   io.run();
 }
 
-TEST_F(RedisDriverFixture, DelYield)
+TEST_F(RedisDriverFixture, DeleteDataYield)
 {
   boost::asio::spawn(io, [this] (boost::asio::yield_context yield) {
     ASSERT_EQ(0, cacheDriver->put(env->dpp, "testName", bl, bl.length(), attrs, yield));
@@ -263,7 +263,7 @@ TEST_F(RedisDriverFixture, DelYield)
       EXPECT_EQ(std::get<0>(resp).value(), 1);
     }
 
-    ASSERT_EQ(0, cacheDriver->del(env->dpp, "testName", yield));
+    ASSERT_EQ(0, cacheDriver->delete_data(env->dpp, "testName", yield));
     cacheDriver->shutdown();
 
     {
@@ -327,45 +327,6 @@ TEST_F(RedisDriverFixture, AppendDataYield)
   io.run();
 }
 
-TEST_F(RedisDriverFixture, DeleteDataYield)
-{
-  boost::asio::spawn(io, [this] (boost::asio::yield_context yield) {
-    ASSERT_EQ(0, cacheDriver->put(env->dpp, "testName", bl, bl.length(), attrs, yield));
-
-    {
-      boost::system::error_code ec;
-      request req;
-      req.push("HEXISTS", "RedisCache/testName", "data");
-      response<int> resp;
-
-      conn->async_exec(req, resp, yield[ec]);
-
-      ASSERT_EQ((bool)ec, false);
-      EXPECT_EQ(std::get<0>(resp).value(), 1);
-    }
-
-    ASSERT_EQ(0, cacheDriver->delete_data(env->dpp, "testName", yield));
-    cacheDriver->shutdown();
-
-    {
-      boost::system::error_code ec;
-      request req;
-      req.push("HEXISTS", "RedisCache/testName", "data");
-      req.push("FLUSHALL");
-      response<int, boost::redis::ignore_t> resp;
-
-      conn->async_exec(req, resp, yield[ec]);
-
-      ASSERT_EQ((bool)ec, false);
-      EXPECT_EQ(std::get<0>(resp).value(), 0);
-    }
-
-    conn->cancel();
-  }, rethrow);
-
-  io.run();
-}
-
 TEST_F(RedisDriverFixture, RenameYield)
 {
   boost::asio::spawn(io, [this] (boost::asio::yield_context yield) {