]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/cloudtransition: Allow multisite zones to sync cloudtiered objects
authorSoumya Koduri <skoduri@redhat.com>
Wed, 19 Apr 2023 18:03:28 +0000 (23:33 +0530)
committerSoumya Koduri <skoduri@redhat.com>
Fri, 21 Jun 2024 17:58:44 +0000 (23:28 +0530)
In a multisite configuration, zones should be able to fetch & sync
cloud-transitioned objects as well. To allow this, a new header
'x-rgwx-sync-cloudtiered' is added to be used by sync client to GET
such objects.

Signed-off-by: Soumya Koduri <skoduri@redhat.com>
(cherry picked from commit cec19b09efc5a56a5f5600000675b951428b98ce)
(cherry picked from commit f7e3e94fb4e5f9d70ae58e6e4bab43d019ec4bba)

src/rgw/rgw_op.cc
src/rgw/rgw_op.h
src/rgw/rgw_rados.cc
src/rgw/rgw_rest_conn.cc
src/rgw/rgw_rest_conn.h
src/rgw/rgw_rest_s3.cc

index 16e407ecd1d0b0e38b4e8cf47b927ba0b2c3296e..1e3b517f7171b68bd26cc447bae4c2ce01525be3 100644 (file)
@@ -2214,7 +2214,7 @@ void RGWGetObj::execute(optional_yield y)
     RGWObjManifest m;
     try {
       decode(m, attr_iter->second);
-      if (m.get_tier_type() == "cloud-s3") {
+      if (m.get_tier_type() == "cloud-s3" && !sync_cloudtiered) {
         /* XXX: Instead send presigned redirect or read-through */
         op_ret = -ERR_INVALID_OBJECT_STATE;
         s->err.message = "This object was transitioned to cloud-s3";
index cf6c7a867f503c9b00549b762ba27435a231de27..1f9ce1b7d84f4abb943ea0686e86dd336ff58e11 100644 (file)
@@ -354,6 +354,7 @@ protected:
   bool range_parsed;
   bool skip_manifest;
   bool skip_decrypt{false};
+  bool sync_cloudtiered{false};
   utime_t gc_invalidate_time;
   bool is_slo;
   std::string lo_etag;
index 954bf8e0482cc7dc94b67197e0dbb114d41885eb..aa683b26a38b96bb5424701bbf8ff1bfbff1118c 100644 (file)
@@ -3844,10 +3844,11 @@ int RGWRados::stat_remote_obj(const DoutPrefixProvider *dpp,
   constexpr bool rgwx_stat = true;
   constexpr bool sync_manifest = true;
   constexpr bool skip_decrypt = true;
+  constexpr bool sync_cloudtiered = true;
   int ret = conn->get_obj(dpp, user_id, info, src_obj, pmod, unmod_ptr,
                       dest_mtime_weight.zone_short_id, dest_mtime_weight.pg_ver,
                       prepend_meta, get_op, rgwx_stat,
-                      sync_manifest, skip_decrypt,
+                      sync_manifest, skip_decrypt, sync_cloudtiered,
                       true, &cb, &in_stream_req);
   if (ret < 0) {
     return ret;
@@ -4058,10 +4059,11 @@ int RGWRados::fetch_remote_obj(RGWObjectCtx& obj_ctx,
   static constexpr bool rgwx_stat = false;
   static constexpr bool sync_manifest = true;
   static constexpr bool skip_decrypt = true;
+  static constexpr bool sync_cloudtiered = true;
   ret = conn->get_obj(dpp, user_id, info, src_obj, pmod, unmod_ptr,
                       dest_mtime_weight.zone_short_id, dest_mtime_weight.pg_ver,
                       prepend_meta, get_op, rgwx_stat,
-                      sync_manifest, skip_decrypt,
+                      sync_manifest, skip_decrypt, sync_cloudtiered,
                       true,
                       &cb, &in_stream_req);
   if (ret < 0) {
index ea42f3d2604dbdf3b24896a7595660b03b10d05f..6fa267e2f453d68d4b65f95199f67dd1411fcd72 100644 (file)
@@ -241,6 +241,7 @@ int RGWRESTConn::get_obj(const DoutPrefixProvider *dpp, const rgw_user& uid, req
                          uint32_t mod_zone_id, uint64_t mod_pg_ver,
                          bool prepend_metadata, bool get_op, bool rgwx_stat,
                          bool sync_manifest, bool skip_decrypt,
+                         bool sync_cloudtiered,
                          bool send, RGWHTTPStreamRWRequest::ReceiveCB *cb, RGWRESTStreamRWRequest **req)
 {
   get_obj_params params;
@@ -253,6 +254,7 @@ int RGWRESTConn::get_obj(const DoutPrefixProvider *dpp, const rgw_user& uid, req
   params.rgwx_stat = rgwx_stat;
   params.sync_manifest = sync_manifest;
   params.skip_decrypt = skip_decrypt;
+  params.sync_cloudtiered = sync_cloudtiered;
   params.cb = cb;
   return get_obj(dpp, obj, params, send, req);
 }
@@ -275,6 +277,9 @@ int RGWRESTConn::get_obj(const DoutPrefixProvider *dpp, const rgw::sal::Object*
   if (in_params.sync_manifest) {
     params.push_back(param_pair_t(RGW_SYS_PARAM_PREFIX "sync-manifest", ""));
   }
+  if (in_params.sync_cloudtiered) {
+    params.push_back(param_pair_t(RGW_SYS_PARAM_PREFIX "sync-cloudtiered", ""));
+  }
   if (in_params.skip_decrypt) {
     params.push_back(param_pair_t(RGW_SYS_PARAM_PREFIX "skip-decrypt", ""));
   }
index 68a2e78ec551410e82dc6e0e3803a56c6ec23203..866b96d7b03b8716397d9684f38b27fdcff7afff 100644 (file)
@@ -170,6 +170,7 @@ public:
     bool get_op{false};
     bool rgwx_stat{false};
     bool sync_manifest{false};
+    bool sync_cloudtiered{false};
 
     bool skip_decrypt{true};
     RGWHTTPStreamRWRequest::ReceiveCB *cb{nullptr};
@@ -185,7 +186,8 @@ public:
               const ceph::real_time *mod_ptr, const ceph::real_time *unmod_ptr,
               uint32_t mod_zone_id, uint64_t mod_pg_ver,
               bool prepend_metadata, bool get_op, bool rgwx_stat, bool sync_manifest,
-              bool skip_decrypt, bool send, RGWHTTPStreamRWRequest::ReceiveCB *cb, RGWRESTStreamRWRequest **req);
+              bool skip_decrypt, bool sync_cloudtiered,
+              bool send, RGWHTTPStreamRWRequest::ReceiveCB *cb, RGWRESTStreamRWRequest **req);
   int complete_request(RGWRESTStreamRWRequest *req,
                        std::string *etag,
                        ceph::real_time *mtime,
index 868324ccfd07a8749f204da77250174998a51426..cb8a7dc3d108d6d36013ee8bc1a64edb68c109d8 100644 (file)
@@ -301,6 +301,9 @@ int RGWGetObj_ObjStore_S3::get_params(optional_yield y)
     skip_decrypt = s->info.args.exists(RGW_SYS_PARAM_PREFIX "skip-decrypt");
   }
 
+  // multisite sync requests should fetch cloudtiered objects
+  sync_cloudtiered = s->info.args.exists(RGW_SYS_PARAM_PREFIX "sync-cloudtiered");
+
   return RGWGetObj_ObjStore::get_params(y);
 }