From 5adae5b821fd0b9444f7d983d0a0261d1dcb777e Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Fri, 30 Oct 2015 16:37:43 -0400 Subject: [PATCH] rgw: add RGWRealm::notify_new_period() Signed-off-by: Casey Bodley --- src/rgw/rgw_admin.cc | 2 +- src/rgw/rgw_rados.cc | 8 ++++++-- src/rgw/rgw_rados.h | 5 +++++ src/rgw/rgw_rest_realm.cc | 4 ++-- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 395cece766bce..85d1532eb5bbc 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -1412,7 +1412,7 @@ static int commit_period(RGWRealm& realm, RGWPeriod& period, cerr << "Error updating period epoch: " << cpp_strerror(ret) << std::endl; return ret; } - realm.notify_zone(); + realm.notify_new_period(period); return ret; } diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 162be7ae8cd7d..c997e892a4ae3 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -792,6 +792,10 @@ int RGWRealm::notify_zone() return 0; } +int RGWRealm::notify_new_period(const RGWPeriod& period) +{ + return notify_zone(); +} int RGWPeriod::init(CephContext *_cct, RGWRados *_store, const string& period_realm_id, const string& period_realm_name, bool setup_obj) @@ -1209,7 +1213,7 @@ int RGWPeriod::commit(RGWRealm& realm, const RGWPeriod& current_period) } ldout(cct, 4) << "Promoted to master zone and committed new period " << id << dendl; - realm.notify_zone(); + realm.notify_new_period(*this); return 0; } // period must be based on predecessor's current epoch @@ -1236,7 +1240,7 @@ int RGWPeriod::commit(RGWRealm& realm, const RGWPeriod& current_period) } ldout(cct, 4) << "Committed new epoch " << epoch << " for period " << id << dendl; - realm.notify_zone(); + realm.notify_new_period(*this); return 0; } diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index d26fabef44588..b2f914722d6b2 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -1273,6 +1273,8 @@ struct objexp_hint_entry { }; WRITE_CLASS_ENCODER(objexp_hint_entry) +class RGWPeriod; + class RGWRealm : public RGWSystemMetaObj { string master_zonegroup; @@ -1322,7 +1324,10 @@ public: int set_current_period(const string& period_id); string get_control_oid(); + /// send a notify on the realm control object int notify_zone(); + /// notify the zone of a new period + int notify_new_period(const RGWPeriod& period); }; WRITE_CLASS_ENCODER(RGWRealm) diff --git a/src/rgw/rgw_rest_realm.cc b/src/rgw/rgw_rest_realm.cc index bc51d14804a44..e988ca991da69 100644 --- a/src/rgw/rgw_rest_realm.cc +++ b/src/rgw/rgw_rest_realm.cc @@ -148,7 +148,7 @@ void RGWOp_Period_Post::execute() ldout(cct, 4) << "current period " << current_period.get_id() << " is period " << period.get_id() << "'s predecessor, " "updating current period and notifying zone" << dendl; - realm.notify_zone(); + realm.notify_new_period(period); return; } @@ -175,7 +175,7 @@ void RGWOp_Period_Post::execute() ldout(cct, 4) << "period epoch " << period.get_epoch() << " is newer than current epoch " << current_period.get_epoch() << ", updating latest epoch and notifying zone" << dendl; - realm.notify_zone(); + realm.notify_new_period(period); } class RGWHandler_Period : public RGWHandler_Auth_S3 { -- 2.39.5