From: Casey Bodley Date: Tue, 22 Jan 2019 17:04:43 +0000 (-0500) Subject: rgw: bucket full sync handles delete markers X-Git-Tag: v13.2.6~37^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=73d4d5fd27ddfd9ce111589f1ca0ef0fc16510e6;p=ceph.git rgw: bucket full sync handles delete markers full sync uses CLS_RGW_OP_LINK_OLH_DM for delete markers instead of trying to fetch them from the source zone Fixes: http://tracker.ceph.com/issues/38007 Signed-off-by: Casey Bodley (cherry picked from commit 5ffd34c5a6a9bbdba086eb57cded915b879513d4) --- diff --git a/src/rgw/rgw_data_sync.cc b/src/rgw/rgw_data_sync.cc index a740c4914672..1aa05b562308 100644 --- a/src/rgw/rgw_data_sync.cc +++ b/src/rgw/rgw_data_sync.cc @@ -2342,6 +2342,16 @@ struct bucket_list_entry { JSONDecoder::decode_json("VersionedEpoch", versioned_epoch, obj); JSONDecoder::decode_json("RgwxTag", rgw_tag, obj); } + + RGWModifyOp get_modify_op() const { + if (delete_marker) { + return CLS_RGW_OP_LINK_OLH_DM; + } else if (!key.instance.empty() && key.instance != "null") { + return CLS_RGW_OP_LINK_OLH; + } else { + return CLS_RGW_OP_ADD; + } + } }; struct bucket_list_result { @@ -2744,7 +2754,6 @@ class RGWBucketShardFullSyncCR : public RGWCoroutine { RGWBucketFullSyncShardMarkerTrack marker_tracker; rgw_obj_key list_marker; bucket_list_entry *entry{nullptr}; - RGWModifyOp op{CLS_RGW_OP_ADD}; int total_entries{0}; @@ -2818,12 +2827,11 @@ int RGWBucketShardFullSyncCR::operate() if (!marker_tracker.start(entry->key, total_entries, real_time())) { tn->log(0, SSTR("ERROR: cannot start syncing " << entry->key << ". Duplicate entry?")); } else { - op = (entry->key.instance.empty() || entry->key.instance == "null" ? CLS_RGW_OP_ADD : CLS_RGW_OP_LINK_OLH); using SyncCR = RGWBucketSyncSingleEntryCR; yield spawn(new SyncCR(sync_env, bucket_info, bs, entry->key, false, /* versioned, only matters for object removal */ entry->versioned_epoch, entry->mtime, - entry->owner, op, CLS_RGW_STATE_COMPLETE, + entry->owner, entry->get_modify_op(), CLS_RGW_STATE_COMPLETE, entry->key, &marker_tracker, zones_trace, tn), false); }