Skip to content

Commit 5e2d2b5

Browse files
committed
rgw/cloud-restore: Read size once restore is completed
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 <[email protected]>
1 parent 0059d5b commit 5e2d2b5

File tree

13 files changed

+19
-7
lines changed

13 files changed

+19
-7
lines changed

src/rgw/driver/daos/rgw_sal_daos.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,6 +1035,7 @@ int DaosObject::restore_obj_from_cloud(Bucket* bucket,
10351035
uint64_t olh_epoch,
10361036
std::optional<uint64_t> days,
10371037
bool& in_progress,
1038+
uint64_t& size,
10381039
const DoutPrefixProvider* dpp,
10391040
optional_yield y)
10401041
{

src/rgw/driver/daos/rgw_sal_daos.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,7 @@ class DaosObject : public StoreObject {
661661
uint64_t olh_epoch,
662662
std::optional<uint64_t> days,
663663
bool& in_progress,
664+
uint64_t& size,
664665
const DoutPrefixProvider* dpp,
665666
optional_yield y) override;
666667
virtual bool placement_rules_match(rgw_placement_rule& r1,

src/rgw/driver/posix/rgw_sal_posix.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3243,6 +3243,7 @@ int POSIXObject::restore_obj_from_cloud(Bucket* bucket,
32433243
CephContext* cct,
32443244
std::optional<uint64_t> days,
32453245
bool& in_progress,
3246+
uint64_t& size,
32463247
const DoutPrefixProvider* dpp,
32473248
optional_yield y)
32483249
{

src/rgw/driver/posix/rgw_sal_posix.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,6 +1080,7 @@ class POSIXObject : public StoreObject {
10801080
CephContext* cct,
10811081
std::optional<uint64_t> days,
10821082
bool& in_progress,
1083+
uint64_t& size,
10831084
const DoutPrefixProvider* dpp,
10841085
optional_yield y) override;
10851086
virtual bool placement_rules_match(rgw_placement_rule& r1, rgw_placement_rule& r2) override;

src/rgw/driver/rados/rgw_rados.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5472,6 +5472,7 @@ int RGWRados::restore_obj_from_cloud(RGWLCCloudTierCtx& tier_ctx,
54725472
RGWObjTier& tier_config,
54735473
std::optional<uint64_t> days,
54745474
bool& in_progress,
5475+
uint64_t& size,
54755476
const DoutPrefixProvider *dpp,
54765477
optional_yield y) {
54775478

@@ -5693,8 +5694,9 @@ int RGWRados::restore_obj_from_cloud(RGWLCCloudTierCtx& tier_ctx,
56935694
return ret;
56945695
}
56955696

5696-
// this returned size can be used to send bucket notification
5697-
return accounted_size;
5697+
// set size to be used to send bucket notification
5698+
size = accounted_size;
5699+
return 0;
56985700
}
56995701

57005702
int RGWRados::check_bucket_empty(const DoutPrefixProvider *dpp, RGWBucketInfo& bucket_info, optional_yield y)

src/rgw/driver/rados/rgw_rados.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1294,6 +1294,7 @@ int restore_obj_from_cloud(RGWLCCloudTierCtx& tier_ctx,
12941294
RGWObjTier& tier_config,
12951295
std::optional<uint64_t> days,
12961296
bool& in_progress,
1297+
uint64_t& size,
12971298
const DoutPrefixProvider *dpp,
12981299
optional_yield y);
12991300

src/rgw/driver/rados/rgw_sal_rados.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3079,6 +3079,7 @@ int RadosObject::restore_obj_from_cloud(Bucket* bucket,
30793079
CephContext* cct,
30803080
std::optional<uint64_t> days,
30813081
bool& in_progress,
3082+
uint64_t& size,
30823083
const DoutPrefixProvider* dpp,
30833084
optional_yield y)
30843085
{
@@ -3154,7 +3155,7 @@ int RadosObject::restore_obj_from_cloud(Bucket* bucket,
31543155
* avoid any races */
31553156
ret = store->getRados()->restore_obj_from_cloud(tier_ctx, *rados_ctx,
31563157
bucket->get_info(), get_obj(),
3157-
tier_config, days, in_progress, dpp, y);
3158+
tier_config, days, in_progress, size, dpp, y);
31583159

31593160
if (ret < 0) { //failed to restore
31603161
ldpp_dout(dpp, 0) << "Restoring object(" << get_key() << ") from the cloud endpoint(" << endpoint << ") failed, ret=" << ret << dendl;

src/rgw/driver/rados/rgw_sal_rados.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,7 @@ class RadosObject : public StoreObject {
644644
CephContext* cct,
645645
std::optional<uint64_t> days,
646646
bool& in_progress,
647+
uint64_t& size,
647648
const DoutPrefixProvider* dpp,
648649
optional_yield y) override;
649650
virtual bool placement_rules_match(rgw_placement_rule& r1, rgw_placement_rule& r2) override;

src/rgw/rgw_restore.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -514,9 +514,9 @@ int Restore::process_restore_entry(RestoreEntry& entry, optional_yield y)
514514
goto done;
515515
}
516516

517+
uint64_t size;
517518
// now go ahead with restoring object
518-
// XXX: first check if its already restored?
519-
ret = obj->restore_obj_from_cloud(bucket.get(), tier.get(), cct, days, in_progress,
519+
ret = obj->restore_obj_from_cloud(bucket.get(), tier.get(), cct, days, in_progress, size,
520520
this, y);
521521
if (ret < 0) {
522522
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)
540540
etag = rgw_bl_str(attr_iter->second);
541541
}
542542

543-
uint64_t size = ret;
544543
// send notification in case the restore is successfully completed
545544
send_notification(this, driver, obj.get(), bucket.get(), etag, size,
546545
obj->get_key().instance,

src/rgw/rgw_sal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,6 +1283,7 @@ class Object {
12831283
CephContext* cct,
12841284
std::optional<uint64_t> days,
12851285
bool& in_progress,
1286+
uint64_t& size,
12861287
const DoutPrefixProvider* dpp,
12871288
optional_yield y) = 0;
12881289
/** Check to see if two placement rules match */

0 commit comments

Comments
 (0)