rgw: fixes for period puller

* reset epoch=0 before RGWPeriod::init() so we get the latest_epoch
* if we're the metadata master, don't try to pull periods from ourself

Fixes: http://tracker.ceph.com/issues/16939

Signed-off-by: Casey Bodley <cbodley@redhat.com>
This commit is contained in:
Casey Bodley 2016-08-05 11:28:13 -04:00
parent 367cb8407b
commit 06c384f1c5

View File

@ -57,8 +57,15 @@ int RGWPeriodPuller::pull(const std::string& period_id, RGWPeriod& period)
{
// try to read the period from rados
period.set_id(period_id);
period.set_epoch(0);
int r = period.init(store->ctx(), store);
if (r < 0) {
if (store->is_meta_master()) {
// can't pull if we're the master
ldout(store->ctx(), 1) << "metadata master failed to read period "
<< period_id << " from local storage: " << cpp_strerror(r) << dendl;
return r;
}
ldout(store->ctx(), 14) << "pulling period " << period_id
<< " from master" << dendl;
// request the period from the master zone