From: Casey Bodley Date: Thu, 5 Jan 2017 18:10:50 +0000 (-0500) Subject: rgw: RGWCloneMetaLogCoroutine uses RGWMetadataLogInfoCompletion X-Git-Tag: v12.0.0~173^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F12605%2Fhead;p=ceph.git rgw: RGWCloneMetaLogCoroutine uses RGWMetadataLogInfoCompletion Fixes: http://tracker.ceph.com/issues/18412 Signed-off-by: Casey Bodley --- diff --git a/src/rgw/rgw_sync.cc b/src/rgw/rgw_sync.cc index 590b3f9eb39e0..c47dd4b799719 100644 --- a/src/rgw/rgw_sync.cc +++ b/src/rgw/rgw_sync.cc @@ -1198,8 +1198,8 @@ class RGWCloneMetaLogCoroutine : public RGWCoroutine { int max_entries = CLONE_MAX_ENTRIES; RGWRESTReadResource *http_op = nullptr; + boost::intrusive_ptr completion; - int req_ret = 0; RGWMetadataLogInfo shard_info; rgw_mdlog_shard_data data; @@ -1217,6 +1217,9 @@ public: if (http_op) { http_op->put(); } + if (completion) { + completion->cancel(); + } } int operate(); @@ -2062,7 +2065,22 @@ int RGWCloneMetaLogCoroutine::state_init() int RGWCloneMetaLogCoroutine::state_read_shard_status() { - int ret = mdlog->get_info_async(shard_id, &shard_info, stack->get_completion_mgr(), (void *)stack, &req_ret); + const bool add_ref = false; // default constructs with refs=1 + + completion.reset(new RGWMetadataLogInfoCompletion( + [this](int ret, const cls_log_header& header) { + if (ret < 0) { + ldout(cct, 1) << "ERROR: failed to read mdlog info with " + << cpp_strerror(ret) << dendl; + } else { + shard_info.marker = header.max_marker; + shard_info.last_update = header.max_time.to_real_time(); + } + // wake up parent stack + stack->get_completion_mgr()->complete(nullptr, stack); + }), add_ref); + + int ret = mdlog->get_info_async(shard_id, completion.get()); if (ret < 0) { ldout(cct, 0) << "ERROR: mdlog->get_info_async() returned ret=" << ret << dendl; return set_cr_error(ret); @@ -2073,6 +2091,8 @@ int RGWCloneMetaLogCoroutine::state_read_shard_status() int RGWCloneMetaLogCoroutine::state_read_shard_status_complete() { + completion.reset(); + ldout(cct, 20) << "shard_id=" << shard_id << " marker=" << shard_info.marker << " last_update=" << shard_info.last_update << dendl; marker = shard_info.marker;