]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: sync: object sync info oid depends on pipe
authorYehuda Sadeh <yehuda@redhat.com>
Tue, 26 Nov 2019 20:40:11 +0000 (12:40 -0800)
committerYehuda Sadeh <yehuda@redhat.com>
Tue, 28 Jan 2020 18:20:39 +0000 (10:20 -0800)
The object sync info object (used in cloud sync module) depends on pipe. Different
oid is crafted if source and destination buckets are not the same.

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_data_sync.cc
src/rgw/rgw_data_sync.h
src/rgw/rgw_sync_module_aws.cc

index 03793eccb26349d6c077f24c439934e74d63c812..02cb1c5b1a27d6a9394da8428f823e54546acef2 100644 (file)
@@ -2443,8 +2443,6 @@ public:
 
 RGWCoroutine *RGWDefaultDataSyncModule::sync_object(RGWDataSyncCtx *sc, rgw_bucket_sync_pipe& sync_pipe, rgw_obj_key& key, std::optional<uint64_t> versioned_epoch, rgw_zone_set *zones_trace)
 {
-  auto sync_env = sc->env;
-
   return new RGWObjFetchCR(sc, sync_pipe, key, std::nullopt, versioned_epoch, zones_trace);
 }
 
@@ -4825,12 +4823,16 @@ string RGWBucketPipeSyncStatusManager::status_oid(const rgw_zone_id& source_zone
   }
 }
 
-string RGWBucketPipeSyncStatusManager::obj_status_oid(const rgw_zone_id& source_zone,
-                                                  const rgw_obj& obj)
+string RGWBucketPipeSyncStatusManager::obj_status_oid(const rgw_bucket_sync_pipe& sync_pipe,
+                                                      const rgw_zone_id& source_zone,
+                                                      const rgw_obj& obj)
 {
-#warning FIXME
-  return object_status_oid_prefix + "." + source_zone.id + ":" + obj.bucket.get_key() + ":" +
-         obj.key.name + ":" + obj.key.instance;
+  string prefix = object_status_oid_prefix + "." + source_zone.id + ":" + obj.bucket.get_key();
+  if (sync_pipe.source_bucket_info.bucket !=
+      sync_pipe.dest_bucket_info.bucket) {
+    prefix += string("/") + sync_pipe.dest_bucket_info.bucket.get_key();
+  }
+  return prefix + ":" + obj.key.name + ":" + obj.key.instance;
 }
 
 class RGWCollectBucketSyncStatusCR : public RGWShardCollectCR {
index a8ea0e083d120d2dbb42841308ff6c1e6e3bd163..abf112e36c08e5ff0eccd7fe6a4b2407510e7a65 100644 (file)
@@ -632,7 +632,8 @@ public:
   int init_sync_status();
 
   static string status_oid(const rgw_zone_id& source_zone, const rgw_bucket_sync_pair_info& bs);
-  static string obj_status_oid(const rgw_zone_id& source_zone, const rgw_obj& obj); /* specific source obj sync status,
+  static string obj_status_oid(const rgw_bucket_sync_pipe& sync_pipe,
+                               const rgw_zone_id& source_zone, const rgw_obj& obj); /* specific source obj sync status,
                                                                                        can be used by sync modules */
 
   // implements DoutPrefixProvider
index e479b5347810b94be4751588c36817b08a4718b5..845fb74a48f3587440eb63a7915c517f0aa51db0 100644 (file)
@@ -1412,6 +1412,7 @@ class RGWAWSStreamObjToCloudMultipartCR : public RGWCoroutine {
 
 public:
   RGWAWSStreamObjToCloudMultipartCR(RGWDataSyncCtx *_sc,
+                                   rgw_bucket_sync_pipe& _sync_pipe,
                                 AWSSyncConfig& _conf,
                                 RGWRESTConn *_source_conn,
                                 const rgw_obj& _src_obj,
@@ -1431,7 +1432,7 @@ public:
                                                    src_properties(_src_properties),
                                                    rest_obj(_rest_obj),
                                                    status_obj(sync_env->svc->zone->get_zone_params().log_pool,
-                                                              RGWBucketPipeSyncStatusManager::obj_status_oid(sc->source_zone, src_obj)) {
+                                                              RGWBucketPipeSyncStatusManager::obj_status_oid(_sync_pipe, sc->source_zone, src_obj)) {
   }
 
 
@@ -1685,7 +1686,7 @@ public:
             ldout(sc->cct, 0) << "ERROR: failed to decode rest obj out of headers=" << headers << ", attrs=" << attrs << dendl;
             return set_cr_error(-EINVAL);
           }
-          call(new RGWAWSStreamObjToCloudMultipartCR(sc, instance.conf, source_conn, src_obj,
+          call(new RGWAWSStreamObjToCloudMultipartCR(sc, sync_pipe, instance.conf, source_conn, src_obj,
                                                      target, dest_obj, size, src_properties, rest_obj));
         }
       }