From: lvshuhua Date: Wed, 7 Dec 2016 07:47:47 +0000 (+0800) Subject: rgw: fix versioned bucket data sync fail when upload is busy X-Git-Tag: v11.2.1~45^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F16163%2Fhead;p=ceph.git rgw: fix versioned bucket data sync fail when upload is busy Fixes: http://tracker.ceph.com/issues/18208 Signed-off-by: lvshuhua (cherry picked from commit ce7d00ac1642d84c1d9111156a544c37801c5adf) --- diff --git a/src/rgw/rgw_data_sync.cc b/src/rgw/rgw_data_sync.cc index be9e25d4751..af0b1726e21 100644 --- a/src/rgw/rgw_data_sync.cc +++ b/src/rgw/rgw_data_sync.cc @@ -2436,7 +2436,7 @@ class RGWBucketShardIncrementalSyncCR : public RGWCoroutine { boost::intrusive_ptr lease_cr; list list_result; list::iterator entries_iter; - map > squash_map; + map, pair > squash_map; rgw_bucket_shard_inc_sync_marker& inc_marker; rgw_obj_key key; rgw_bi_log_entry *entry{nullptr}; @@ -2496,11 +2496,8 @@ int RGWBucketShardIncrementalSyncCR::operate() if (e.state != CLS_RGW_STATE_COMPLETE) { continue; } - auto& squash_entry = squash_map[e.object]; - if (squash_entry.first == e.timestamp && - e.op == CLS_RGW_OP_DEL) { - squash_entry.second = e.op; - } else if (squash_entry.first < e.timestamp) { + auto& squash_entry = squash_map[make_pair(e.object, e.instance)]; + if (squash_entry.first <= e.timestamp) { squash_entry = make_pair<>(e.timestamp, e.op); } } @@ -2553,7 +2550,7 @@ int RGWBucketShardIncrementalSyncCR::operate() marker_tracker.try_update_high_marker(cur_id, 0, entry->timestamp); continue; } - if (make_pair<>(entry->timestamp, entry->op) != squash_map[entry->object]) { + if (make_pair<>(entry->timestamp, entry->op) != squash_map[make_pair(entry->object, entry->instance)]) { set_status() << "squashed operation, skipping"; ldout(sync_env->cct, 20) << "[inc sync] skipping object: " << bucket_shard_str{bs} << "/" << key << ": squashed operation" << dendl;