From: Casey Bodley Date: Tue, 9 Aug 2016 21:32:36 +0000 (-0400) Subject: rgw: move timelog trim wrapper to header X-Git-Tag: v12.0.3~20^2~22 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=db79bfabc87884ca5ae92a0685ec217a99af4597;p=ceph.git rgw: move timelog trim wrapper to header Signed-off-by: Casey Bodley --- diff --git a/src/rgw/rgw_cr_rados.cc b/src/rgw/rgw_cr_rados.cc index 489ef589172..6c748dabc98 100644 --- a/src/rgw/rgw_cr_rados.cc +++ b/src/rgw/rgw_cr_rados.cc @@ -722,6 +722,29 @@ int RGWRadosTimelogTrimCR::request_complete() return r; } + +RGWSyncLogTrimCR::RGWSyncLogTrimCR(RGWRados *store, const std::string& oid, + const std::string& to_marker, + std::string *last_trim_marker) + : RGWRadosTimelogTrimCR(store, oid, real_time{}, real_time{}, + std::string{}, to_marker), + cct(store->ctx()), last_trim_marker(last_trim_marker) +{ +} + +int RGWSyncLogTrimCR::request_complete() +{ + int r = RGWRadosTimelogTrimCR::request_complete(); + if (r < 0 && r != -ENODATA) { + return r; + } + if (*last_trim_marker < to_marker) { + *last_trim_marker = to_marker; + } + return 0; +} + + int RGWAsyncStatObj::_send_request() { rgw_raw_obj raw_obj; diff --git a/src/rgw/rgw_cr_rados.h b/src/rgw/rgw_cr_rados.h index 8496201e0cd..52cacde3bdf 100644 --- a/src/rgw/rgw_cr_rados.h +++ b/src/rgw/rgw_cr_rados.h @@ -1091,6 +1091,16 @@ class RGWRadosTimelogTrimCR : public RGWSimpleCoroutine { int request_complete() override; }; +// wrapper to update last_trim_marker on success +class RGWSyncLogTrimCR : public RGWRadosTimelogTrimCR { + CephContext *cct; + std::string *last_trim_marker; + public: + RGWSyncLogTrimCR(RGWRados *store, const std::string& oid, + const std::string& to_marker, std::string *last_trim_marker); + int request_complete() override; +}; + class RGWAsyncStatObj : public RGWAsyncRadosRequest { RGWRados *store; RGWBucketInfo bucket_info; diff --git a/src/rgw/rgw_data_sync.cc b/src/rgw/rgw_data_sync.cc index a1698b5fffd..ea69374b074 100644 --- a/src/rgw/rgw_data_sync.cc +++ b/src/rgw/rgw_data_sync.cc @@ -2936,29 +2936,6 @@ void take_min_markers(IterIn first, IterIn last, IterOut dest) } } -// wrapper to update last_trim_marker on success -class LastTimelogTrimCR : public RGWRadosTimelogTrimCR { - CephContext *cct; - std::string *last_trim_marker; - public: - LastTimelogTrimCR(RGWRados *store, const std::string& oid, - const std::string& to_marker, std::string *last_trim_marker) - : RGWRadosTimelogTrimCR(store, oid, real_time{}, real_time{}, - std::string{}, to_marker), - cct(store->ctx()), last_trim_marker(last_trim_marker) - {} - int request_complete() override { - int r = RGWRadosTimelogTrimCR::request_complete(); - if (r < 0 && r != -ENODATA) { - ldout(cct, 1) << "failed to trim datalog: " << cpp_strerror(r) << dendl; - return r; - } - ldout(cct, 10) << "datalog trimmed to marker " << to_marker << dendl; - *last_trim_marker = to_marker; - return 0; - } -}; - class DataLogTrimCR : public RGWCoroutine { RGWRados *store; RGWHTTPManager *http; @@ -3036,7 +3013,7 @@ int DataLogTrimCR::operate() ldout(cct, 10) << "trimming log shard " << i << " at marker=" << stable << " last_trim=" << last_trim[i] << dendl; - using TrimCR = LastTimelogTrimCR; + using TrimCR = RGWSyncLogTrimCR; spawn(new TrimCR(store, store->data_log->get_oid(i), stable, &last_trim[i]), true); diff --git a/src/rgw/rgw_sync.h b/src/rgw/rgw_sync.h index bb245aedceb..7a39bd68eea 100644 --- a/src/rgw/rgw_sync.h +++ b/src/rgw/rgw_sync.h @@ -450,5 +450,4 @@ public: int operate() override; }; - #endif