]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: start pushing current period on startup
authorCasey Bodley <cbodley@redhat.com>
Tue, 8 Dec 2015 16:10:49 +0000 (11:10 -0500)
committerYehuda Sadeh <yehuda@redhat.com>
Fri, 12 Feb 2016 00:13:51 +0000 (16:13 -0800)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_period_pusher.cc

index 7669631f10b3f075a8b92e75ed56dd7951ee9925..e6c87f794be851199ca5a70f9f78816451ed7728 100644 (file)
@@ -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;