diff options
author | Casey Bodley <cbodley@redhat.com> | 2015-12-08 17:10:49 +0100 |
---|---|---|
committer | Yehuda Sadeh <yehuda@redhat.com> | 2016-02-12 01:13:51 +0100 |
commit | b72530bc4b3a352463cfed55b2daf84c23991506 (patch) | |
tree | 9d25ec0970e6505c2425ced9c2bdde1f1542f1a1 /src/rgw/rgw_period_pusher.cc | |
parent | rgw: period commit updates sync status before writing the object (diff) | |
download | ceph-b72530bc4b3a352463cfed55b2daf84c23991506.tar.xz ceph-b72530bc4b3a352463cfed55b2daf84c23991506.zip |
rgw: start pushing current period on startup
Signed-off-by: Casey Bodley <cbodley@redhat.com>
Diffstat (limited to 'src/rgw/rgw_period_pusher.cc')
-rw-r--r-- | src/rgw/rgw_period_pusher.cc | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/rgw/rgw_period_pusher.cc b/src/rgw/rgw_period_pusher.cc index 7669631f10b..e6c87f794be 100644 --- a/src/rgw/rgw_period_pusher.cc +++ b/src/rgw/rgw_period_pusher.cc @@ -152,7 +152,23 @@ class RGWPeriodPusher::CRThread { RGWPeriodPusher::RGWPeriodPusher(RGWRados* store) : cct(store->ctx()), store(store) -{} +{ + const auto& realm = store->realm; + auto& realm_id = realm.get_id(); + if (realm_id.empty()) // no realm configuration + return; + + // always send out the current period on startup + RGWPeriod period; + int r = period.init(cct, store, realm_id, realm.get_name()); + if (r < 0) { + lderr(cct) << "failed to load period for realm " << realm_id << dendl; + return; + } + + std::lock_guard<std::mutex> lock(mutex); + handle_notify(std::move(period)); +} // destructor is here because CRThread is incomplete in the header RGWPeriodPusher::~RGWPeriodPusher() = default; |