From 5ffd34c5a6a9bbdba086eb57cded915b879513d4 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Tue, 22 Jan 2019 12:04:43 -0500 Subject: [PATCH] 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 --- src/rgw/rgw_data_sync.cc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/rgw/rgw_data_sync.cc b/src/rgw/rgw_data_sync.cc index 0e534cca684cc..d4152864b27f7 100644 --- a/src/rgw/rgw_data_sync.cc +++ b/src/rgw/rgw_data_sync.cc @@ -2270,6 +2270,16 @@ struct bucket_list_entry { key.instance.clear(); } } + + 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 { @@ -2659,7 +2669,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}; @@ -2728,12 +2737,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); } -- 2.39.5