]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/cloud-restore: Read size once restore is completed 65023/head
authorSoumya Koduri <skoduri@redhat.com>
Mon, 3 Nov 2025 08:44:45 +0000 (14:14 +0530)
committerSoumya Koduri <skoduri@redhat.com>
Tue, 4 Nov 2025 08:32:57 +0000 (14:02 +0530)
Include `size` param in the restore API to read the actual object
size once restore is completed. This is needed to send bucket
notification to the client.

Signed-off-by: Soumya Koduri <skoduri@redhat.com>
13 files changed:
src/rgw/driver/daos/rgw_sal_daos.cc
src/rgw/driver/daos/rgw_sal_daos.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/rgw_restore.cc
src/rgw/rgw_sal.h
src/rgw/rgw_sal_filter.cc
src/rgw/rgw_sal_filter.h
src/rgw/rgw_sal_store.h

index c1cdc5978912b52d9af9ef31b605309785412b0e..d04a0b3b92d4eb479923457281d6d9841555314b 100644 (file)
@@ -1035,6 +1035,7 @@ int DaosObject::restore_obj_from_cloud(Bucket* bucket,
           uint64_t olh_epoch,
           std::optional<uint64_t> days,
          bool& in_progress,
+         uint64_t& size,
           const DoutPrefixProvider* dpp, 
           optional_yield y)
 {
index ab525b72170666b0020d22db88b4d5725c9c5492..b95c6e49c5c6e2811d923ceb07043cfd583da753 100644 (file)
@@ -661,6 +661,7 @@ class DaosObject : public StoreObject {
                           uint64_t olh_epoch,
                           std::optional<uint64_t> days,
                           bool& in_progress,
+                          uint64_t& size,
                           const DoutPrefixProvider* dpp,
                           optional_yield y) override;
   virtual bool placement_rules_match(rgw_placement_rule& r1,
index e3bf6838ad6e2395b8153217e0bc87cf85589ac7..68f5f05990042575a66150fdac114594fc5f19ef 100644 (file)
@@ -3243,6 +3243,7 @@ int POSIXObject::restore_obj_from_cloud(Bucket* bucket,
          CephContext* cct,
           std::optional<uint64_t> days,
           bool& in_progress,
+         uint64_t& size,
           const DoutPrefixProvider* dpp, 
           optional_yield y)
 {
index 0253ac785eb1486987bed4fd291c444d71ded88c..443842838b5d18de1bf45f1f8f9600b46bf1a55e 100644 (file)
@@ -1080,6 +1080,7 @@ public:
                           CephContext* cct,
                           std::optional<uint64_t> days,
                           bool& in_progress,
+                          uint64_t& size,
                           const DoutPrefixProvider* dpp,
                           optional_yield y) override;
   virtual bool placement_rules_match(rgw_placement_rule& r1, rgw_placement_rule& r2) override;
index 94e6ac03dc50b0fc1173f24f268261e81bbaa73d..c50355d7ae2650bbdf89370911ff113db8f31705 100644 (file)
@@ -5472,6 +5472,7 @@ int RGWRados::restore_obj_from_cloud(RGWLCCloudTierCtx& tier_ctx,
                              RGWObjTier& tier_config,
                              std::optional<uint64_t> days,
                             bool& in_progress,
+                            uint64_t& size,
                              const DoutPrefixProvider *dpp,
                              optional_yield y) {
 
@@ -5693,8 +5694,9 @@ int RGWRados::restore_obj_from_cloud(RGWLCCloudTierCtx& tier_ctx,
     return ret;
   }
 
-  // this returned size can be used to send bucket notification
-  return accounted_size; 
+  // set size to be used to send bucket notification
+  size = accounted_size;
+  return 0;
 }
 
 int RGWRados::check_bucket_empty(const DoutPrefixProvider *dpp, RGWBucketInfo& bucket_info, optional_yield y)
index c0f72bc730fed9c29251b6907e085466333fd38d..8a6e39e97f88ea80167597d6ce79fbe2a81ec268 100644 (file)
@@ -1294,6 +1294,7 @@ int restore_obj_from_cloud(RGWLCCloudTierCtx& tier_ctx,
                              RGWObjTier& tier_config,
                              std::optional<uint64_t> days,
                             bool& in_progress,
+                            uint64_t& size,
                              const DoutPrefixProvider *dpp,
                              optional_yield y);
 
index ef1c3f56b58225adadc50713a48fdfaa58c1cd03..da4cbd32a53983ff41caf163776b90e142d52ff8 100644 (file)
@@ -3079,6 +3079,7 @@ int RadosObject::restore_obj_from_cloud(Bucket* bucket,
                                  CephContext* cct,
                                   std::optional<uint64_t> days,
                                  bool& in_progress,
+                                 uint64_t& size,
                                   const DoutPrefixProvider* dpp, 
                                   optional_yield y)
 {
@@ -3154,7 +3155,7 @@ int RadosObject::restore_obj_from_cloud(Bucket* bucket,
    * avoid any races */
   ret = store->getRados()->restore_obj_from_cloud(tier_ctx, *rados_ctx,
                                 bucket->get_info(), get_obj(),
-                                tier_config, days, in_progress, dpp, y);
+                                tier_config, days, in_progress, size, dpp, y);
 
   if (ret < 0) { //failed to restore
     ldpp_dout(dpp, 0) << "Restoring object(" << get_key() << ") from the cloud endpoint(" << endpoint << ") failed, ret=" << ret << dendl;
index e236e60c022583c745c085e08844cd22b64fef3a..5fa42b6c4d45a119b3e34d45d1b6e37dedabdcd7 100644 (file)
@@ -644,6 +644,7 @@ class RadosObject : public StoreObject {
                           CephContext* cct,
                           std::optional<uint64_t> days,
                           bool& in_progress,
+                          uint64_t& size,
                           const DoutPrefixProvider* dpp,
                           optional_yield y) override;
     virtual bool placement_rules_match(rgw_placement_rule& r1, rgw_placement_rule& r2) override;
index 54c96a3c05044bfdf12195af8da02bc87a2d5a00..c3ef799b941a0e8e39fa72d146edd895e55e2943 100644 (file)
@@ -514,9 +514,9 @@ int Restore::process_restore_entry(RestoreEntry& entry, optional_yield y)
     goto done;
   }
 
+  uint64_t size;
   // now go ahead with restoring object
-  // XXX: first check if its already restored?
-  ret = obj->restore_obj_from_cloud(bucket.get(), tier.get(), cct, days, in_progress,
+  ret = obj->restore_obj_from_cloud(bucket.get(), tier.get(), cct, days, in_progress, size, 
                                      this, y);
   if (ret < 0) {
     ldpp_dout(this, -1) << __PRETTY_FUNCTION__ << ": Restore of object(" << obj->get_key() << ") failed" << ret << dendl;        
@@ -540,7 +540,6 @@ int Restore::process_restore_entry(RestoreEntry& entry, optional_yield y)
       etag = rgw_bl_str(attr_iter->second);
     }
 
-    uint64_t size = ret;
     // send notification in case the restore is successfully completed
     send_notification(this, driver, obj.get(), bucket.get(), etag, size,
                       obj->get_key().instance,
index 02b293bac5354382dc7f9b4b47f419069e2b9058..2d820af5dea8a48c4dd210fceb6037de7f207602 100644 (file)
@@ -1283,6 +1283,7 @@ class Object {
                           CephContext* cct,
                           std::optional<uint64_t> days,
                           bool& in_progress,
+                          uint64_t& size,
                           const DoutPrefixProvider* dpp,
                           optional_yield y) = 0;
     /** Check to see if two placement rules match */
index 48298a3f4a08623562b75312f5bf390c2eaccf50..0cc849ce905304cf5e93bb8e045061627689cab3 100644 (file)
@@ -1150,11 +1150,12 @@ int FilterObject::restore_obj_from_cloud(Bucket* bucket,
                          CephContext* cct,
                          std::optional<uint64_t> days,
                          bool& in_progress,
+                         uint64_t& size,
                          const DoutPrefixProvider* dpp,
                          optional_yield y)
 {
   return next->restore_obj_from_cloud(nextBucket(bucket), nextPlacementTier(tier),
-           cct, days, in_progress, dpp, y);
+           cct, days, in_progress, size, dpp, y);
 }
 
 bool FilterObject::placement_rules_match(rgw_placement_rule& r1, rgw_placement_rule& r2)
index 7199da21e6c9ffa7f4487eea4b95d875467345cc..c3f628badedb5df7fc2c14f46eee4fa6f2813bd5 100644 (file)
@@ -840,6 +840,7 @@ public:
                           CephContext* cct,
                           std::optional<uint64_t> days,
                           bool& in_progress,
+                          uint64_t& size,
                           const DoutPrefixProvider* dpp,
                           optional_yield y) override;
   virtual bool placement_rules_match(rgw_placement_rule& r1, rgw_placement_rule& r2) override;
index a6a7a4c8e90632c1bf8fc54eb8cdec580512bf2b..d64403d7f1d06107c68447163f32897a2af6c299 100644 (file)
@@ -373,6 +373,7 @@ class StoreObject : public Object {
                           CephContext* cct,
                           std::optional<uint64_t> days,
                           bool& in_progress,
+                          uint64_t& size,
                           const DoutPrefixProvider* dpp,
                           optional_yield y) override {
       return -1;