]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Merge pull request #50841 from smanjara/fix-duplicate-objects-archive
authorCasey Bodley <cbodley@users.noreply.github.com>
Thu, 25 May 2023 15:46:14 +0000 (11:46 -0400)
committerGitHub <noreply@github.com>
Thu, 25 May 2023 15:46:14 +0000 (11:46 -0400)
rgw/archive: avoid duplicating objects when syncing from multiple zones

Reviewed-by: Casey Bodley <cbodley@redhat.com>
1  2 
src/rgw/driver/rados/rgw_data_sync.cc
src/rgw/driver/rados/rgw_rados.cc
src/rgw/driver/rados/rgw_rados.h

index 4af21dc870f88e55e964444a34fa6f69cf128322,7e6e08fec35516568bc9e370d544aa91e602db95..651aa811eb5e8ef3b6119942da1629cbf528aba5
@@@ -3046,12 -3051,28 +3051,18 @@@ RGWCoroutine *RGWArchiveDataSyncModule:
  {
    auto sync_env = sc->env;
    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;
 -  if (!sync_pipe.dest_bucket_info.versioned() ||
 -     (sync_pipe.dest_bucket_info.flags & BUCKET_VERSIONS_SUSPENDED)) {
 -      ldout(sc->cct, 0) << "SYNC_ARCHIVE: sync_object: enabling object versioning for archive bucket" << dendl;
 -      sync_pipe.dest_bucket_info.flags = (sync_pipe.dest_bucket_info.flags & ~BUCKET_VERSIONS_SUSPENDED) | BUCKET_VERSIONED;
 -      int op_ret = sync_env->driver->getRados()->put_bucket_instance_info(sync_pipe.dest_bucket_info, false, real_time(), NULL, sync_env->dpp, null_yield);
 -      if (op_ret < 0) {
 -         ldpp_dout(sync_env->dpp, 0) << "SYNC_ARCHIVE: sync_object: error versioning archive bucket" << dendl;
 -         return NULL;
 -      }
 -  }
  
    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()) {
Simple merge
Simple merge