From: Casey Bodley Date: Tue, 14 Aug 2018 17:39:32 +0000 (-0400) Subject: rgw: bucket sync crs mutate rgw_bucket_shard_sync_info in place X-Git-Tag: v12.2.9~27^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5e96f0cf89a8788f312455ebd6cbb88fb9e5e873;p=ceph.git rgw: bucket sync crs mutate rgw_bucket_shard_sync_info in place Signed-off-by: Casey Bodley (cherry picked from commit 6c6917bca167819e890d1df3aa52b31a8f070e26) Conflicts: src/rgw/rgw_data_sync.cc - no "tn_parent", "_tn_parent" in luminous --- diff --git a/src/rgw/rgw_data_sync.cc b/src/rgw/rgw_data_sync.cc index 2a95f6d131a3..e11a6e573475 100644 --- a/src/rgw/rgw_data_sync.cc +++ b/src/rgw/rgw_data_sync.cc @@ -2576,7 +2576,7 @@ class RGWBucketShardFullSyncCR : public RGWCoroutine { boost::intrusive_ptr lease_cr; bucket_list_result list_result; list::iterator entries_iter; - rgw_bucket_shard_full_sync_marker& full_marker; + rgw_bucket_shard_sync_info& sync_info; RGWBucketFullSyncShardMarkerTrack marker_tracker; rgw_obj_key list_marker; bucket_list_entry *entry{nullptr}; @@ -2595,10 +2595,10 @@ public: RGWBucketInfo *_bucket_info, const std::string& status_oid, RGWContinuousLeaseCR *lease_cr, - rgw_bucket_shard_full_sync_marker& _full_marker) + rgw_bucket_shard_sync_info& sync_info) : RGWCoroutine(_sync_env->cct), sync_env(_sync_env), bs(bs), - bucket_info(_bucket_info), lease_cr(lease_cr), full_marker(_full_marker), - marker_tracker(sync_env, status_oid, full_marker), + bucket_info(_bucket_info), lease_cr(lease_cr), sync_info(sync_info), + marker_tracker(sync_env, status_oid, sync_info.full_marker), status_oid(status_oid) { logger.init(sync_env, "BucketFull", bs.get_key()); zones_trace.insert(sync_env->source_zone); @@ -2611,9 +2611,9 @@ int RGWBucketShardFullSyncCR::operate() { int ret; reenter(this) { - list_marker = full_marker.position; + list_marker = sync_info.full_marker.position; - total_entries = full_marker.count; + total_entries = sync_info.full_marker.count; do { if (!lease_cr->is_locked()) { drain_all(); @@ -2685,10 +2685,9 @@ int RGWBucketShardFullSyncCR::operate() /* update sync state to incremental */ if (sync_status == 0) { yield { - rgw_bucket_shard_sync_info sync_status; - sync_status.state = rgw_bucket_shard_sync_info::StateIncrementalSync; + sync_info.state = rgw_bucket_shard_sync_info::StateIncrementalSync; map attrs; - sync_status.encode_state_attr(attrs); + sync_info.encode_state_attr(attrs); RGWRados *store = sync_env->store; call(new RGWSimpleRadosWriteAttrsCR(sync_env->async_rados, store, rgw_raw_obj(store->get_zone_params().log_pool, status_oid), @@ -2722,7 +2721,7 @@ class RGWBucketShardIncrementalSyncCR : public RGWCoroutine { list list_result; list::iterator entries_iter; map, pair > squash_map; - rgw_bucket_shard_inc_sync_marker& inc_marker; + rgw_bucket_shard_sync_info& sync_info; rgw_obj_key key; rgw_bi_log_entry *entry{nullptr}; RGWBucketIncSyncShardMarkerTrack marker_tracker; @@ -2744,10 +2743,12 @@ public: RGWBucketInfo *_bucket_info, const std::string& status_oid, RGWContinuousLeaseCR *lease_cr, - rgw_bucket_shard_inc_sync_marker& _inc_marker) + rgw_bucket_shard_sync_info& sync_info) : RGWCoroutine(_sync_env->cct), sync_env(_sync_env), bs(bs), - bucket_info(_bucket_info), lease_cr(lease_cr), inc_marker(_inc_marker), - marker_tracker(sync_env, status_oid, inc_marker), status_oid(status_oid) , zone_id(_sync_env->store->get_zone().id){ + bucket_info(_bucket_info), lease_cr(lease_cr), sync_info(sync_info), + marker_tracker(sync_env, status_oid, sync_info.inc_marker), + status_oid(status_oid), zone_id(_sync_env->store->get_zone().id) + { set_description() << "bucket shard incremental sync bucket=" << bucket_shard_str{bs}; set_status("init"); @@ -2766,9 +2767,9 @@ int RGWBucketShardIncrementalSyncCR::operate() drain_all(); return set_cr_error(-ECANCELED); } - ldout(sync_env->cct, 20) << __func__ << "(): listing bilog for incremental sync" << inc_marker.position << dendl; - set_status() << "listing bilog; position=" << inc_marker.position; - yield call(new RGWListBucketIndexLogCR(sync_env, bs, inc_marker.position, + ldout(sync_env->cct, 20) << __func__ << "(): listing bilog for incremental sync" << sync_info.inc_marker.position << dendl; + set_status() << "listing bilog; position=" << sync_info.inc_marker.position; + yield call(new RGWListBucketIndexLogCR(sync_env, bs, sync_info.inc_marker.position, &list_result)); if (retcode < 0 && retcode != -ENOENT ) { drain_all(); @@ -2828,7 +2829,7 @@ int RGWBucketShardIncrementalSyncCR::operate() cur_id = entry->id.substr(p + 1); } } - inc_marker.position = cur_id; + sync_info.inc_marker.position = cur_id; if (entry->op == RGWModifyOp::CLS_RGW_OP_SYNCSTOP || entry->op == RGWModifyOp::CLS_RGW_OP_RESYNC) { ldout(sync_env->cct, 20) << "detected syncstop or resync on " << entries_iter->timestamp << " , skipping entry" << dendl; @@ -3082,7 +3083,7 @@ int RGWRunBucketSyncCoroutine::operate() if (sync_status.state == rgw_bucket_shard_sync_info::StateFullSync) { yield call(new RGWBucketShardFullSyncCR(sync_env, bs, &bucket_info, status_oid, lease_cr.get(), - sync_status.full_marker)); + sync_status)); if (retcode < 0) { ldout(sync_env->cct, 5) << "full sync on " << bucket_shard_str{bs} << " failed, retcode=" << retcode << dendl; @@ -3090,13 +3091,12 @@ int RGWRunBucketSyncCoroutine::operate() drain_all(); return set_cr_error(retcode); } - sync_status.state = rgw_bucket_shard_sync_info::StateIncrementalSync; } if (sync_status.state == rgw_bucket_shard_sync_info::StateIncrementalSync) { yield call(new RGWBucketShardIncrementalSyncCR(sync_env, bs, &bucket_info, status_oid, lease_cr.get(), - sync_status.inc_marker)); + sync_status)); if (retcode < 0) { ldout(sync_env->cct, 5) << "incremental sync on " << bucket_shard_str{bs} << " failed, retcode=" << retcode << dendl;