summaryrefslogtreecommitdiffstats
path: root/src/rgw/rgw_rest_s3.cc
diff options
context:
space:
mode:
authorSoumya Koduri <skoduri@redhat.com>2024-10-03 04:33:20 +0200
committerSoumya Koduri <skoduri@redhat.com>2024-10-03 10:28:32 +0200
commit0e0222d0162bcb7d49f79f73311e01cd19b0248c (patch)
treeedf843410964d33e8266e129c1243540e210d667 /src/rgw/rgw_rest_s3.cc
parentMerge pull request #60039 from zdover23/wip-doc-2024-09-29-rados-tshooting-ts... (diff)
downloadceph-0e0222d0162bcb7d49f79f73311e01cd19b0248c.tar.xz
ceph-0e0222d0162bcb7d49f79f73311e01cd19b0248c.zip
rgw/cloudtier: Restore object from cloud endpoint
1)Add functionality to restore cloud-transitioned objects on demand. Current commit has below - * Given <bucket,object>, fetch the object from the cloud endpoint. * if days provided and > 0, the restore is marked temporary with expiry date. * Without <days>, it is marked as permanent restore. 2)Use ObjectExpirer/delete_at attr to delete temp objects For temporarily restored objects, set delete_at attr to the expiration time. This will add those objects to ObjectExpirer list. Use LC worker thread to scan that list and delete expired objects. By delete here, it means to delete restored object data and reset HEAD object as Cloud-transitioned object as it was before restore. In addition below changes are done - * If temporary, object is still marked RGWObj::CloudTiered and mtime is set same as transition time. * If permanent, object is marked RGWObj::Main and mtime is set to restore time (now()). * rgw_restore_debug_interval option added to set configure restore Days (similar to rgw_lc_debug_interval) There is an issue with ObjectExpirer code where in if an object is added to ObjectExpirer list and is re-written, it is not deleted from the expirer list and hence the new object may get deleted. Fixed the same and also addressed minor review comments. 3)Design doc added 4) ObjCategory should be set to CloudTiered only for cloud-transitioned objects and temporarily restored objects. Permanent copies are to be treated as regular objects. Signed-off-by: Soumya Koduri <skoduri@redhat.com>
Diffstat (limited to 'src/rgw/rgw_rest_s3.cc')
-rw-r--r--src/rgw/rgw_rest_s3.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/rgw/rgw_rest_s3.cc b/src/rgw/rgw_rest_s3.cc
index 4a50baf1cb2..0289aca6773 100644
--- a/src/rgw/rgw_rest_s3.cc
+++ b/src/rgw/rgw_rest_s3.cc
@@ -519,6 +519,22 @@ int RGWGetObj_ObjStore_S3::send_response_data(bufferlist& bl, off_t bl_ofs,
}
}
} /* checksum_mode */
+ auto attr_iter = attrs.find(RGW_ATTR_RESTORE_TYPE);
+ if (attr_iter != attrs.end()) {
+ rgw::sal::RGWRestoreType rt;
+ bufferlist bl = attr_iter->second;
+ auto iter = bl.cbegin();
+ decode(rt, iter);
+
+ if (rt == rgw::sal::RGWRestoreType::Temporary) {
+ // temporary restore; set storage-class to cloudtier storage class
+ auto c_iter = attrs.find(RGW_ATTR_CLOUDTIER_STORAGE_CLASS);
+
+ if (c_iter != attrs.end()) {
+ attrs[RGW_ATTR_STORAGE_CLASS] = c_iter->second;
+ }
+ }
+ }
for (struct response_attr_param *p = resp_attr_params; p->param; p++) {
bool exists;