Skip to content

Commit b1ddd68

Browse files
committed
rgw/cloud-restore: Add new tier-type & options related to S3 Glacier
Unlike regular S3 cloud services, restoring objects from S3/Tape or AWS Glacier services would require special handling. We need to first restore the object using Glacier `RestoreObject` API and then download it using `GET`. https://docs.aws.amazon.com/cli/latest/reference/s3api/restore-object.html A new cloud tier-type `s3-glacier` is added to handle S3 Glacier endpoints along with below tier-config options - `glacier_restore_days` - lifetime of the restored copy on the Glacier endpoint ; default: 1 day `glacier_restore_tier_type` - Retrieval tier at which the restore will be processed. Only "Standard" (default) and "Expedited" options are supported. In addition, a new option `restore_storage_class` is added to configure the storage class the objects need to be restored to. Default value: STANDARD Design doc: https://docs.google.com/document/d/1rzLJAzHK6cLuzJswgoplgugNOFCKi8NrjPOGfgVrIFg/edit?tab=t.0#heading=h.sgrmb31roboc Signed-off-by: Soumya Koduri <[email protected]>
1 parent ad8a617 commit b1ddd68

19 files changed

+204
-34
lines changed

src/rgw/driver/daos/rgw_sal_daos.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,8 +377,11 @@ class DaosPlacementTier : public StorePlacementTier {
377377
virtual ~DaosPlacementTier() = default;
378378

379379
virtual const std::string& get_tier_type() { return tier.tier_type; }
380+
virtual bool is_tier_type_s3() { return (tier.is_tier_type_s3()); }
380381
virtual const std::string& get_storage_class() { return tier.storage_class; }
381382
virtual bool retain_head_object() { return tier.retain_head_object; }
383+
virtual bool allow_read_through() { return tier.allow_read_through; }
384+
virtual uint64_t get_read_through_restore_days() { return tier.read_through_restore_days; }
382385
RGWZoneGroupPlacementTier& get_rt() { return tier; }
383386
};
384387

src/rgw/driver/motr/rgw_sal_motr.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,11 @@ class MotrPlacementTier: public StorePlacementTier {
419419
virtual ~MotrPlacementTier() = default;
420420

421421
virtual const std::string& get_tier_type() { return tier.tier_type; }
422+
virtual bool is_tier_type_s3() { return (tier.is_tier_type_s3()); }
422423
virtual const std::string& get_storage_class() { return tier.storage_class; }
423424
virtual bool retain_head_object() { return tier.retain_head_object; }
425+
virtual bool allow_read_through() { return tier.allow_read_through; }
426+
virtual uint64_t get_read_through_restore_days() { return tier.read_through_restore_days; }
424427
RGWZoneGroupPlacementTier& get_rt() { return tier; }
425428
};
426429

68 KB
Binary file not shown.

src/rgw/driver/rados/rgw_lc_tier.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ struct RGWLCCloudTierCtx {
2222
rgw::sal::Driver *driver;
2323
RGWBucketInfo& bucket_info;
2424
std::string storage_class;
25+
std::string restore_storage_class;
26+
std::string tier_type;
2527

2628
rgw::sal::Object *obj;
2729

src/rgw/driver/rados/rgw_obj_manifest.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ void RGWObjManifest::dump(Formatter *f) const
347347
::encode_json("tail_placement", tail_placement, f);
348348
::encode_json("tier_type", tier_type, f);
349349

350-
if (tier_type == "cloud-s3") {
350+
if (tier_type == "cloud-s3" || tier_type == "cloud-s3-glacier") {
351351
::encode_json("tier_config", tier_config, f);
352352
}
353353

src/rgw/driver/rados/rgw_obj_manifest.h

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -471,16 +471,24 @@ class RGWObjManifest {
471471
return tier_type;
472472
}
473473

474+
bool is_tier_type_s3() {
475+
return (tier_type == "cloud-s3" || tier_type == "cloud-s3-glacier");
476+
}
477+
478+
bool is_tier_type_s3_glacier() {
479+
return (tier_type == "cloud-s3-glacier");
480+
}
481+
474482
inline void set_tier_type(std::string value) {
475-
/* Only "cloud-s3" tier-type is supported for now */
476-
if (value == "cloud-s3") {
483+
/* Only "cloud-s3" & "cloud-s3-glacier" tier-type is supported for now */
484+
if (value == "cloud-s3" || value == "cloud-s3-glacier") {
477485
tier_type = value;
478486
}
479487
}
480488

481489
inline void set_tier_config(RGWObjTier t) {
482-
/* Set only if tier_type set to "cloud-s3" */
483-
if (tier_type != "cloud-s3")
490+
/* Set only if tier_type set to "cloud-s3" or "cloud-s3-glacier" */
491+
if (!is_tier_type_s3())
484492
return;
485493

486494
tier_config.name = t.name;
@@ -489,7 +497,7 @@ class RGWObjManifest {
489497
}
490498

491499
inline const void get_tier_config(RGWObjTier* t) {
492-
if (tier_type != "cloud-s3")
500+
if (!is_tier_type_s3())
493501
return;
494502

495503
t->name = tier_config.name;

src/rgw/driver/rados/rgw_putobj_processor.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ int read_cloudtier_info_from_attrs(rgw::sal::Attrs& attrs, RGWObjCategory& categ
4545
auto i = attr_iter->second;
4646
string m = i.to_str();
4747

48-
if (m == "cloud-s3") {
48+
if (m == "cloud-s3" || m == "cloud-s3-glacier") {
4949
category = RGWObjCategory::CloudTiered;
50-
manifest.set_tier_type("cloud-s3");
50+
manifest.set_tier_type(m);
5151

5252
auto config_iter = attrs.find(RGW_ATTR_CLOUD_TIER_CONFIG);
5353
if (config_iter != attrs.end()) {

src/rgw/driver/rados/rgw_rados.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5287,15 +5287,16 @@ int RGWRados::restore_obj_from_cloud(RGWLCCloudTierCtx& tier_ctx,
52875287
}
52885288
boost::optional<RGWPutObj_Compress> compressor;
52895289
CompressorRef plugin;
5290+
dest_placement.storage_class = tier_ctx.restore_storage_class;
52905291
RGWRadosPutObj cb(dpp, cct, plugin, compressor, &processor, progress_cb, progress_data,
52915292
[&](map<string, bufferlist> obj_attrs) {
5292-
// XXX: do we need filter() like in fetch_remote_obj() cb
5293+
// XXX: do we need filter() lke in fetch_remote_obj() cb
52935294
dest_placement.inherit_from(dest_bucket_info.placement_rule);
52945295
/* For now we always restore to STANDARD storage-class.
52955296
* Later we will add support to take restore-target-storage-class
52965297
* for permanent restore
52975298
*/
5298-
dest_placement.storage_class = RGW_STORAGE_CLASS_STANDARD;
5299+
// dest_placement.storage_class = RGW_STORAGE_CLASS_STANDARD;
52995300

53005301
processor.set_tail_placement(dest_placement);
53015302

@@ -5420,7 +5421,7 @@ int RGWRados::restore_obj_from_cloud(RGWLCCloudTierCtx& tier_ctx,
54205421
// set tier-config only for temp restored objects, as
54215422
// permanent copies will be treated as regular objects
54225423
{
5423-
t.append("cloud-s3");
5424+
t.append(tier_ctx.tier_type);
54245425
encode(tier_config, t_tier);
54255426
attrs[RGW_ATTR_CLOUD_TIER_TYPE] = t;
54265427
attrs[RGW_ATTR_CLOUD_TIER_CONFIG] = t_tier;

src/rgw/driver/rados/rgw_sal_rados.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2916,6 +2916,8 @@ int RadosObject::restore_obj_from_cloud(Bucket* bucket,
29162916
const rgw::sal::ZoneGroup& zonegroup = store->get_zone()->get_zonegroup();
29172917
int ret = 0;
29182918
string src_storage_class = o.meta.storage_class; // or take src_placement also as input
2919+
// update tier_config in case tier params are updated
2920+
tier_config.tier_placement = rtier->get_rt();
29192921

29202922
if (bucket_name.empty()) {
29212923
bucket_name = "rgwx-" + zonegroup.get_name() + "-" + tier->get_storage_class() +
@@ -2933,6 +2935,8 @@ int RadosObject::restore_obj_from_cloud(Bucket* bucket,
29332935
tier_ctx.multipart_min_part_size = rtier->get_rt().t.s3.multipart_min_part_size;
29342936
tier_ctx.multipart_sync_threshold = rtier->get_rt().t.s3.multipart_sync_threshold;
29352937
tier_ctx.storage_class = tier->get_storage_class();
2938+
tier_ctx.restore_storage_class = rtier->get_rt().restore_storage_class;
2939+
tier_ctx.tier_type = rtier->get_rt().tier_type;
29362940

29372941
ldpp_dout(dpp, 20) << "Restoring object(" << o.key << ") from the cloud endpoint(" << endpoint << ")" << dendl;
29382942

@@ -3242,7 +3246,7 @@ int RadosObject::write_cloud_tier(const DoutPrefixProvider* dpp,
32423246
tier_config.tier_placement = rtier->get_rt();
32433247
tier_config.is_multipart_upload = is_multipart_upload;
32443248

3245-
pmanifest->set_tier_type("cloud-s3");
3249+
pmanifest->set_tier_type(rtier->get_rt().tier_type);
32463250
pmanifest->set_tier_config(tier_config);
32473251

32483252
/* check if its necessary */

src/rgw/driver/rados/rgw_sal_rados.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,11 @@ class RadosPlacementTier: public StorePlacementTier {
4343
virtual ~RadosPlacementTier() = default;
4444

4545
virtual const std::string& get_tier_type() { return tier.tier_type; }
46+
virtual bool is_tier_type_s3() { return (tier.is_tier_type_s3()); }
4647
virtual const std::string& get_storage_class() { return tier.storage_class; }
4748
virtual bool retain_head_object() { return tier.retain_head_object; }
49+
virtual bool allow_read_through() { return tier.allow_read_through; }
50+
virtual uint64_t get_read_through_restore_days() { return tier.read_through_restore_days; }
4851
RGWZoneGroupPlacementTier& get_rt() { return tier; }
4952
};
5053

0 commit comments

Comments
 (0)