summaryrefslogtreecommitdiffstats
path: root/src/rgw/driver/rados/rgw_data_sync.cc
diff options
context:
space:
mode:
authorCasey Bodley <cbodley@users.noreply.github.com>2023-05-25 17:46:14 +0200
committerGitHub <noreply@github.com>2023-05-25 17:46:14 +0200
commit856b743d8b9b5e14cdcb48579a9a6dc7ac069a33 (patch)
tree3c5156954724a991617a1fce137b217b59d98144 /src/rgw/driver/rados/rgw_data_sync.cc
parentMerge pull request #51219 from smanjara/wip-archive-delete-bucket (diff)
parentrgw/archive: avoid duplicating objects when syncing from multiple zones (diff)
downloadceph-856b743d8b9b5e14cdcb48579a9a6dc7ac069a33.tar.xz
ceph-856b743d8b9b5e14cdcb48579a9a6dc7ac069a33.zip
Merge pull request #50841 from smanjara/fix-duplicate-objects-archive
rgw/archive: avoid duplicating objects when syncing from multiple zones Reviewed-by: Casey Bodley <cbodley@redhat.com>
Diffstat (limited to 'src/rgw/driver/rados/rgw_data_sync.cc')
-rw-r--r--src/rgw/driver/rados/rgw_data_sync.cc17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/rgw/driver/rados/rgw_data_sync.cc b/src/rgw/driver/rados/rgw_data_sync.cc
index 4af21dc870f..651aa811eb5 100644
--- a/src/rgw/driver/rados/rgw_data_sync.cc
+++ b/src/rgw/driver/rados/rgw_data_sync.cc
@@ -2792,6 +2792,7 @@ class RGWObjFetchCR : public RGWCoroutine {
rgw_obj_key& key;
std::optional<rgw_obj_key> dest_key;
std::optional<uint64_t> versioned_epoch;
+ bool stat_follow_olh;
const rgw_zone_set_entry& source_trace_entry;
rgw_zone_set *zones_trace;
@@ -2821,6 +2822,7 @@ public:
rgw_obj_key& _key,
std::optional<rgw_obj_key> _dest_key,
std::optional<uint64_t> _versioned_epoch,
+ bool _stat_follow_olh,
const rgw_zone_set_entry& source_trace_entry,
rgw_zone_set *_zones_trace) : RGWCoroutine(_sc->cct),
sc(_sc), sync_env(_sc->env),
@@ -2828,6 +2830,7 @@ public:
key(_key),
dest_key(_dest_key),
versioned_epoch(_versioned_epoch),
+ stat_follow_olh(_stat_follow_olh),
source_trace_entry(source_trace_entry),
zones_trace(_zones_trace) {
}
@@ -2949,11 +2952,12 @@ public:
call(new RGWFetchRemoteObjCR(sync_env->async_rados, sync_env->driver, sc->source_zone,
nullopt,
- sync_pipe.info.source_bs.bucket,
+ sync_pipe.source_bucket_info.bucket,
std::nullopt, sync_pipe.dest_bucket_info,
key, dest_key, versioned_epoch,
true,
std::static_pointer_cast<RGWFetchObjFilter>(filter),
+ stat_follow_olh,
source_trace_entry, zones_trace,
sync_env->counters, dpp));
}
@@ -2981,7 +2985,8 @@ RGWCoroutine *RGWDefaultDataSyncModule::sync_object(const DoutPrefixProvider *dp
const rgw_zone_set_entry& source_trace_entry,
rgw_zone_set *zones_trace)
{
- return new RGWObjFetchCR(sc, sync_pipe, key, std::nullopt, versioned_epoch,
+ bool stat_follow_olh = false;
+ return new RGWObjFetchCR(sc, sync_pipe, key, std::nullopt, versioned_epoch, stat_follow_olh,
source_trace_entry, zones_trace);
}
@@ -3048,10 +3053,16 @@ RGWCoroutine *RGWArchiveDataSyncModule::sync_object(const DoutPrefixProvider *dp
ldout(sc->cct, 5) << "SYNC_ARCHIVE: sync_object: b=" << sync_pipe.info.source_bs.bucket << " k=" << key << " versioned_epoch=" << versioned_epoch.value_or(0) << dendl;
std::optional<rgw_obj_key> dest_key;
+ bool stat_follow_olh = false;
+
if (versioned_epoch.value_or(0) == 0) { /* force version if not set */
+ stat_follow_olh = true;
versioned_epoch = 0;
dest_key = key;
+ if (key.instance.empty()) {
+ sync_env->driver->getRados()->gen_rand_obj_instance_name(&(*dest_key));
+ }
}
if (key.instance.empty()) {
@@ -3060,7 +3071,7 @@ RGWCoroutine *RGWArchiveDataSyncModule::sync_object(const DoutPrefixProvider *dp
}
return new RGWObjFetchCR(sc, sync_pipe, key, dest_key, versioned_epoch,
- source_trace_entry, zones_trace);
+ stat_follow_olh, source_trace_entry, zones_trace);
}
RGWCoroutine *RGWArchiveDataSyncModule::remove_object(const DoutPrefixProvider *dpp, RGWDataSyncCtx *sc, rgw_bucket_sync_pipe& sync_pipe, rgw_obj_key& key,