diff options
author | Casey Bodley <cbodley@redhat.com> | 2018-08-14 19:39:32 +0200 |
---|---|---|
committer | Casey Bodley <cbodley@redhat.com> | 2018-08-14 19:39:32 +0200 |
commit | 6c6917bca167819e890d1df3aa52b31a8f070e26 (patch) | |
tree | a1005f645054860845e10ed2401549efeede5089 | |
parent | rgw: return errors from RGWInitBucketShardSyncStatusCoroutine (diff) | |
download | ceph-6c6917bca167819e890d1df3aa52b31a8f070e26.tar.xz ceph-6c6917bca167819e890d1df3aa52b31a8f070e26.zip |
rgw: bucket sync crs mutate rgw_bucket_shard_sync_info in place
Signed-off-by: Casey Bodley <cbodley@redhat.com>
-rw-r--r-- | src/rgw/rgw_data_sync.cc | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/src/rgw/rgw_data_sync.cc b/src/rgw/rgw_data_sync.cc index b3da95a9f5c..a61fb9bc29b 100644 --- a/src/rgw/rgw_data_sync.cc +++ b/src/rgw/rgw_data_sync.cc @@ -2717,7 +2717,7 @@ class RGWBucketShardFullSyncCR : public RGWCoroutine { boost::intrusive_ptr<RGWContinuousLeaseCR> lease_cr; bucket_list_result list_result; list<bucket_list_entry>::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}; @@ -2738,11 +2738,11 @@ 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, RGWSyncTraceNodeRef tn_parent) : 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); @@ -2761,9 +2761,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(); @@ -2839,10 +2839,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<string, bufferlist> 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), @@ -2876,7 +2875,7 @@ class RGWBucketShardIncrementalSyncCR : public RGWCoroutine { list<rgw_bi_log_entry> list_result; list<rgw_bi_log_entry>::iterator entries_iter; map<pair<string, string>, pair<real_time, RGWModifyOp> > 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; @@ -2899,11 +2898,13 @@ 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, RGWSyncTraceNodeRef& _tn_parent) : 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"); @@ -2929,9 +2930,9 @@ int RGWBucketShardIncrementalSyncCR::operate() tn->log(0, "ERROR: lease is not taken, abort"); return set_cr_error(-ECANCELED); } - tn->log(20, SSTR("listing bilog for incremental sync" << inc_marker.position)); - set_status() << "listing bilog; position=" << inc_marker.position; - yield call(new RGWListBucketIndexLogCR(sync_env, bs, inc_marker.position, + tn->log(20, SSTR("listing bilog for incremental sync" << sync_info.inc_marker.position)); + 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(); @@ -2991,7 +2992,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; @@ -3246,20 +3247,19 @@ 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, tn)); + sync_status, tn)); if (retcode < 0) { tn->log(5, SSTR("full sync on bucket failed, retcode=" << retcode)); lease_cr->go_down(); 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, tn)); + sync_status, tn)); if (retcode < 0) { tn->log(5, SSTR("incremental sync on bucket failed, retcode=" << retcode)); lease_cr->go_down(); |