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>
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);
}
}
}
-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 {
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
public:
RGWAWSStreamObjToCloudMultipartCR(RGWDataSyncCtx *_sc,
+ rgw_bucket_sync_pipe& _sync_pipe,
AWSSyncConfig& _conf,
RGWRESTConn *_source_conn,
const rgw_obj& _src_obj,
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)) {
}
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));
}
}