From aaab1ec2f736248b3557f42b4108e91b45f6b407 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Mon, 23 Jan 2017 16:38:48 -0500 Subject: [PATCH] rgw: RGWSyncLogTrimThread runs mdlog trim Signed-off-by: Casey Bodley --- src/rgw/rgw_rados.cc | 17 ++++++++++++++--- src/rgw/rgw_sync.cc | 9 +++++++++ src/rgw/rgw_sync.h | 4 ++++ 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 5667ebd9817d..facbc129a271 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -3223,9 +3223,20 @@ public: return http.set_threaded(); } int process() override { - crs.run(create_data_log_trim_cr(store, &http, - cct->_conf->rgw_data_log_num_shards, - trim_interval)); + list stacks; + auto meta = new RGWCoroutinesStack(store->ctx(), &crs); + meta->call(create_meta_log_trim_cr(store, &http, + cct->_conf->rgw_md_log_max_shards, + trim_interval)); + stacks.push_back(meta); + + auto data = new RGWCoroutinesStack(store->ctx(), &crs); + data->call(create_data_log_trim_cr(store, &http, + cct->_conf->rgw_data_log_num_shards, + trim_interval)); + stacks.push_back(data); + + crs.run(stacks); return 0; } }; diff --git a/src/rgw/rgw_sync.cc b/src/rgw/rgw_sync.cc index f6c46e34dc32..f402916fcdfe 100644 --- a/src/rgw/rgw_sync.cc +++ b/src/rgw/rgw_sync.cc @@ -2953,3 +2953,12 @@ class MetaPeerTrimPollCR : public MetaTrimPollCR { env(store, http, num_shards) {} }; + +RGWCoroutine* create_meta_log_trim_cr(RGWRados *store, RGWHTTPManager *http, + int num_shards, utime_t interval) +{ + if (store->is_meta_master()) { + return new MetaMasterTrimPollCR(store, http, num_shards, interval); + } + return new MetaPeerTrimPollCR(store, http, num_shards, interval); +} diff --git a/src/rgw/rgw_sync.h b/src/rgw/rgw_sync.h index 7a39bd68eea2..0f1719b279fb 100644 --- a/src/rgw/rgw_sync.h +++ b/src/rgw/rgw_sync.h @@ -450,4 +450,8 @@ public: int operate() override; }; +// MetaLogTrimCR factory function +RGWCoroutine* create_meta_log_trim_cr(RGWRados *store, RGWHTTPManager *http, + int num_shards, utime_t interval); + #endif -- 2.47.3