]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: Add objects expirer API to the SAL interface 60647/head
authorSoumya Koduri <skoduri@redhat.com>
Wed, 6 Nov 2024 17:05:38 +0000 (22:35 +0530)
committerSoumya Koduri <skoduri@redhat.com>
Fri, 17 Jan 2025 19:12:32 +0000 (00:42 +0530)
Add the API `process_expired_objects` which is used to process and
delete the expired objects (swift or temporarily restored from cloud)
to the Zipper interface.

Signed-off-by: Soumya Koduri <skoduri@redhat.com>
17 files changed:
src/rgw/driver/daos/rgw_sal_daos.cc
src/rgw/driver/daos/rgw_sal_daos.h
src/rgw/driver/motr/rgw_sal_motr.cc
src/rgw/driver/motr/rgw_sal_motr.h
src/rgw/driver/posix/rgw_sal_posix.cc
src/rgw/driver/posix/rgw_sal_posix.h
src/rgw/driver/rados/rgw_rados.cc
src/rgw/driver/rados/rgw_rados.h
src/rgw/driver/rados/rgw_sal_rados.cc
src/rgw/driver/rados/rgw_sal_rados.h
src/rgw/radosgw-admin/radosgw-admin.cc
src/rgw/rgw_lc.cc
src/rgw/rgw_sal.h
src/rgw/rgw_sal_dbstore.cc
src/rgw/rgw_sal_dbstore.h
src/rgw/rgw_sal_filter.cc
src/rgw/rgw_sal_filter.h

index 92dd7afe2fbc0cf6b83e815e73eba8f87fa21837..9cd8c352267ff46889f1eae3485e4c3bb554ed10 100644 (file)
@@ -2322,6 +2322,12 @@ std::unique_ptr<Lifecycle> DaosStore::get_lifecycle(void) {
   return 0;
 }
 
+bool DaosStore::process_expired_objects(const DoutPrefixProvider *dpp,
+                                       optional_yield y) {
+  DAOS_NOT_IMPLEMENTED_LOG(nullptr);
+  return 0;
+}
+
 std::unique_ptr<Notification> DaosStore::get_notification(
     rgw::sal::Object* obj, rgw::sal::Object* src_obj, struct req_state* s,
     rgw::notify::EventType event_type, const std::string* object_name) {
index 5515579a441070bb2d5d1a45569ee6c043e45056..f7ab8a4e40e9e10bb189417cc1192ea9406eb23f 100644 (file)
@@ -934,6 +934,7 @@ class DaosStore : public StoreDriver {
   virtual std::string zone_unique_trans_id(const uint64_t unique_num) override;
   virtual int cluster_stat(RGWClusterStat& stats) override;
   virtual std::unique_ptr<Lifecycle> get_lifecycle(void) override;
+  virtual bool process_expired_objects(const DoutPrefixProvider *dpp, optional_yield y) override;
   virtual std::unique_ptr<Notification> get_notification(
       rgw::sal::Object* obj, rgw::sal::Object* src_obj, struct req_state* s,
       rgw::notify::EventType event_type, optional_yield y,
index 463ea8c5b11a57d0d1cd3dbd4083d32a385cd159..98ddaf9dcb9d129bd6a06fd606d2a152eb0255a9 100644 (file)
@@ -3328,6 +3328,12 @@ std::unique_ptr<Lifecycle> MotrStore::get_lifecycle(void)
   return 0;
 }
 
+bool MotrStore::process_expired_objects(const DoutPrefixProvider *dpp,
+                                       optional_yield y)
+{
+  return 0;
+}
+
 std::unique_ptr<Notification> MotrStore::get_notification(Object* obj, Object* src_obj, req_state* s,
     rgw::notify::EventType event_type, optional_yield y, const string* object_name)
 {
index 0f99ae48e862c88c61c8c91f6c1e2a78bcf26ed1..98dc77aaf050a9af429127b756033c128b6aea6d 100644 (file)
@@ -1002,6 +1002,7 @@ class MotrStore : public StoreDriver {
     virtual int list_all_zones(const DoutPrefixProvider* dpp, std::list<std::string>& zone_ids) override;
     virtual int cluster_stat(RGWClusterStat& stats) override;
     virtual std::unique_ptr<Lifecycle> get_lifecycle(void) override;
+    virtual bool process_expired_objects(const DoutPrefixProvider *dpp, optional_yield y) override;
     virtual std::unique_ptr<Notification> get_notification(rgw::sal::Object* obj, rgw::sal::Object* src_obj,
         req_state* s, rgw::notify::EventType event_type, optional_yield y, const std::string* object_name=nullptr) override;
     virtual std::unique_ptr<Notification> get_notification(
index 9d76462baa093cc9959241a3999bafcba6b77501..129be22b63283f8d8c7dd09991e4b2d566243672 100644 (file)
@@ -2010,6 +2010,11 @@ void POSIXDriver::register_admin_apis(RGWRESTMgr* mgr)
   return next->register_admin_apis(mgr);
 }
 
+bool POSIXDriver::process_expired_objects(const DoutPrefixProvider *dpp,
+                                                                 optional_yield y) {
+  return next->process_expired_objects(dpp, y);
+}
+
 std::unique_ptr<Notification> POSIXDriver::get_notification(rgw::sal::Object* obj,
                              rgw::sal::Object* src_obj, struct req_state* s,
                              rgw::notify::EventType event_type, optional_yield y,
index bf3478ad6aba8f1de43ba235f231969e6347bf49..ac3e17ca93f5e88b69803170761fff922e430b95 100644 (file)
@@ -401,6 +401,8 @@ public:
   virtual void finalize(void) override;
   virtual void register_admin_apis(RGWRESTMgr* mgr) override;
 
+  virtual bool process_expired_objects(const DoutPrefixProvider *dpp,
+                                       optional_yield y) override;
   virtual std::unique_ptr<Notification> get_notification(rgw::sal::Object* obj,
                                 rgw::sal::Object* src_obj, struct req_state* s,
                                 rgw::notify::EventType event_type, optional_yield y,
index 69075c506f190db5930c5ffad77080eaa94683e6..3b86a49471acec6ef80ad46316389ce7b30fa187 100644 (file)
@@ -9708,7 +9708,7 @@ int RGWRados::process_lc(const std::unique_ptr<rgw::sal::Bucket>& optional_bucke
   return ret;
 }
 
-bool RGWRados::process_expire_objects(const DoutPrefixProvider *dpp, optional_yield y)
+bool RGWRados::process_expired_objects(const DoutPrefixProvider *dpp, optional_yield y)
 {
   return obj_expirer->inspect_all_shards(dpp, utime_t(), ceph_clock_now(), y);
 }
index fe79916392fcef8403a7ac4fb3b1c2bac52daf54..217159487bf5369b1bceae2a36623d0e8e3b2d6e 100644 (file)
@@ -1587,7 +1587,7 @@ public:
 
   int list_gc_objs(int *index, std::string& marker, uint32_t max, bool expired_only, std::list<cls_rgw_gc_obj_info>& result, bool *truncated, bool& processing_queue);
   int process_gc(bool expired_only, optional_yield y);
-  bool process_expire_objects(const DoutPrefixProvider *dpp, optional_yield y);
+  bool process_expired_objects(const DoutPrefixProvider *dpp, optional_yield y);
   int defer_gc(const DoutPrefixProvider *dpp, RGWObjectCtx* ctx, RGWBucketInfo& bucket_info, const rgw_obj& obj, optional_yield y);
 
   int process_lc(const std::unique_ptr<rgw::sal::Bucket>& optional_bucket);
index 4c67d0ee71a523edcce2e52917e076477f59cdfd..9b53a5eac0b5efe55af1e2b9e25300e8f0389fbe 100644 (file)
@@ -1844,6 +1844,12 @@ std::unique_ptr<Lifecycle> RadosStore::get_lifecycle(void)
   return std::make_unique<RadosLifecycle>(this);
 }
 
+bool RadosStore::process_expired_objects(const DoutPrefixProvider *dpp,
+                                        optional_yield y)
+{
+  return getRados()->process_expired_objects(dpp, y);
+}
+
 std::unique_ptr<Notification> RadosStore::get_notification(
   rgw::sal::Object* obj, rgw::sal::Object* src_obj, req_state* s, rgw::notify::EventType event_type, optional_yield y, const std::string* object_name)
 {
index 85ea247e3452298211cca47fc0600303c1834ea5..6bfbbf74d64a3f65adfc4eaae62c0db23b2eca26 100644 (file)
@@ -279,6 +279,7 @@ class RadosStore : public StoreDriver {
     virtual int list_all_zones(const DoutPrefixProvider* dpp, std::list<std::string>& zone_ids) override;
     virtual int cluster_stat(RGWClusterStat& stats) override;
     virtual std::unique_ptr<Lifecycle> get_lifecycle(void) override;
+    virtual bool process_expired_objects(const DoutPrefixProvider *dpp, optional_yield y) override;
     virtual std::unique_ptr<Notification> get_notification(rgw::sal::Object* obj, rgw::sal::Object* src_obj, req_state* s, rgw::notify::EventType event_type, optional_yield y, const std::string* object_name=nullptr) override;
     virtual std::unique_ptr<Notification> get_notification(
         const DoutPrefixProvider* dpp,
index 182e42b8e31f71c6eb81bc6a6a22ca84d2478829..994fbefbf5f473abac8706e392ae042fb1be907f 100644 (file)
@@ -8386,8 +8386,8 @@ next:
   } // OPT::OBJECT_REINDEX
 
   if (opt_cmd == OPT::OBJECTS_EXPIRE) {
-    if (!static_cast<rgw::sal::RadosStore*>(driver)->getRados()->process_expire_objects(dpp(), null_yield)) {
-      cerr << "ERROR: process_expire_objects() processing returned error." << std::endl;
+    if (!driver->process_expired_objects(dpp(), null_yield)) {
+      cerr << "ERROR: process_expired_objects() processing returned error." << std::endl;
       return 1;
     }
   }
index c9fb4765d59d728cab1bf0943b0c0862644f2700..0b3c92db924319a85e2927a6de11c54ef75e02a3 100644 (file)
@@ -2000,9 +2000,9 @@ int RGWLC::process(LCWorker* worker,
     }
   }
 
-  ret = static_cast<rgw::sal::RadosStore*>(driver)->getRados()->process_expire_objects(this, null_yield);
+  ret = driver->process_expired_objects(this, null_yield);
   if (ret < 0) {
-    ldpp_dout(this, 5) << "RGWLC::process_expire_objects: failed, "
+    ldpp_dout(this, 5) << "RGWLC::process_expired_objects: failed, "
                  << " worker ix: " << worker->ix << dendl;
   }
 
index 4b94f74b851a3e4124a1ae1a6ae53007bcb6c9e7..843d96f632f2846fcc870bf9d210ef7ff3a9dc16 100644 (file)
@@ -466,6 +466,8 @@ class Driver {
     virtual int cluster_stat(RGWClusterStat& stats) = 0;
     /** Get a @a Lifecycle object. Used to manage/run lifecycle transitions */
     virtual std::unique_ptr<Lifecycle> get_lifecycle(void) = 0;
+    /** Reset the temporarily restored objects which are expired */
+    virtual bool process_expired_objects(const DoutPrefixProvider *dpp, optional_yield y) = 0;
 
      /** Get a @a Notification object.  Used to communicate with non-RGW daemons, such as
       * management/tracking software */
index 02fd7a49cdad4ea6dbf8f5521724dec2fc41c912..e9abfc0a8c5dbb0c9f3598b9d1ec84449811000c 100644 (file)
@@ -1854,6 +1854,12 @@ namespace rgw::sal {
     return std::make_unique<DBLifecycle>(this);
   }
 
+  bool DBStore::process_expired_objects(const DoutPrefixProvider *dpp,
+                                       optional_yield y)
+  {
+    return 0;
+  }
+
   int DBLifecycle::get_entry(const DoutPrefixProvider* dpp, optional_yield y,
                              const std::string& oid, const std::string& marker,
                              LCEntry& entry)
index 4df10d1dce1a5b313d9e8a8fa14ed243d7a6825d..2530f3e9ff7b990d925d0213829899991a2c885c 100644 (file)
@@ -885,6 +885,7 @@ public:
       virtual int list_all_zones(const DoutPrefixProvider* dpp, std::list<std::string>& zone_ids) override;
       virtual int cluster_stat(RGWClusterStat& stats) override;
       virtual std::unique_ptr<Lifecycle> get_lifecycle(void) override;
+      virtual bool process_expired_objects(const DoutPrefixProvider *dpp, optional_yield y) override;
 
   virtual std::unique_ptr<Notification> get_notification(
     rgw::sal::Object* obj, rgw::sal::Object* src_obj, req_state* s,
index 15da580988eb141621104ad758077e0096cf03ff..60fa37d3c843378f39a64e14bc88f9a6f1a43880 100644 (file)
@@ -435,6 +435,11 @@ std::unique_ptr<Lifecycle> FilterDriver::get_lifecycle(void)
   return std::make_unique<FilterLifecycle>(std::move(lc));
 }
 
+bool FilterDriver::process_expired_objects(const DoutPrefixProvider *dpp,
+                                          optional_yield y) {
+  return next->process_expired_objects(dpp, y);
+}
+
 std::unique_ptr<Notification> FilterDriver::get_notification(rgw::sal::Object* obj,
                                rgw::sal::Object* src_obj, req_state* s,
                                rgw::notify::EventType event_type, optional_yield y,
index 947ce9d4bf59b3be7dc5463c6783ba45d18f1d32..648e2238ff82b79539e89eac96cb54f03c8eae35 100644 (file)
@@ -289,6 +289,7 @@ public:
   }
   virtual int cluster_stat(RGWClusterStat& stats) override;
   virtual std::unique_ptr<Lifecycle> get_lifecycle(void) override;
+  virtual bool process_expired_objects(const DoutPrefixProvider *dpp, optional_yield y) override;
 
   virtual std::unique_ptr<Notification> get_notification(rgw::sal::Object* obj,
                                 rgw::sal::Object* src_obj, struct req_state* s,