From: Casey Bodley Date: Fri, 15 Sep 2017 18:09:14 +0000 (-0400) Subject: rgw: start BucketTrimManager in RGWRados X-Git-Tag: v13.0.1~210^2~11 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=74aedaef0757f56a77671d6de59628538cfa0bbb;p=ceph.git rgw: start BucketTrimManager in RGWRados Signed-off-by: Casey Bodley --- diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 684bd1041c21..c61ae9dc28a2 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -3190,15 +3190,18 @@ class RGWSyncLogTrimThread : public RGWSyncProcessorThread { RGWCoroutinesManager crs; RGWRados *store; + rgw::BucketTrimManager *bucket_trim; RGWHTTPManager http; const utime_t trim_interval; uint64_t interval_msec() override { return 0; } void stop_process() override { crs.stop(); } public: - RGWSyncLogTrimThread(RGWRados *store, int interval) + RGWSyncLogTrimThread(RGWRados *store, rgw::BucketTrimManager *bucket_trim, + int interval) : RGWSyncProcessorThread(store, "sync-log-trim"), crs(store->ctx(), store->get_cr_registry()), store(store), + bucket_trim(bucket_trim), http(store->ctx(), crs.get_completion_mgr()), trim_interval(interval, 0) {} @@ -3220,6 +3223,10 @@ public: trim_interval)); stacks.push_back(data); + auto bucket = new RGWCoroutinesStack(store->ctx(), &crs); + bucket->call(bucket_trim->create_bucket_trim_cr(&http)); + stacks.push_back(bucket); + crs.run(stacks); return 0; } @@ -3630,6 +3637,7 @@ void RGWRados::finalize() data_sync_processor_threads.clear(); delete sync_log_trimmer; sync_log_trimmer = nullptr; + bucket_trim = boost::none; } if (finisher) { finisher->stop(); @@ -4495,6 +4503,17 @@ int RGWRados::init_complete() } meta_sync_processor_thread->start(); + // configure the bucket trim manager + rgw::BucketTrimConfig config; + rgw::configure_bucket_trim(cct, config); + + bucket_trim.emplace(this, config); + ret = bucket_trim->init(); + if (ret < 0) { + ldout(cct, 0) << "ERROR: failed to start bucket trim manager" << dendl; + return ret; + } + Mutex::Locker dl(data_sync_thread_lock); for (auto iter : zone_data_sync_from_map) { ldout(cct, 5) << "starting data sync thread for zone " << iter.first << dendl; @@ -4509,7 +4528,7 @@ int RGWRados::init_complete() } auto interval = cct->_conf->rgw_sync_log_trim_interval; if (interval > 0) { - sync_log_trimmer = new RGWSyncLogTrimThread(this, interval); + sync_log_trimmer = new RGWSyncLogTrimThread(this, &*bucket_trim, interval); ret = sync_log_trimmer->init(); if (ret < 0) { ldout(cct, 0) << "ERROR: failed to initialize sync log trim thread" << dendl; diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index 61a685e7edfa..7ac701301f27 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -23,6 +23,7 @@ #include "rgw_meta_sync_status.h" #include "rgw_period_puller.h" #include "rgw_sync_module.h" +#include "rgw_sync_log_trim.h" class RGWWatcher; class SafeTimer; @@ -2280,6 +2281,7 @@ class RGWRados RGWSyncTraceManager *sync_tracer; map data_sync_processor_threads; + boost::optional bucket_trim; RGWSyncLogTrimThread *sync_log_trimmer{nullptr}; Mutex meta_sync_thread_lock;