]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: split RGWPeriod::reflect out of set_latest_epoch
authorCasey Bodley <cbodley@redhat.com>
Thu, 7 Jan 2016 21:32:28 +0000 (16:32 -0500)
committerYehuda Sadeh <yehuda@redhat.com>
Fri, 12 Feb 2016 00:13:52 +0000 (16:13 -0800)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_admin.cc
src/rgw/rgw_rados.cc
src/rgw/rgw_rest_realm.cc

index da0cf14638ed519f08cb76f090055887727195af..0638b10ce63b1cd295a604400b19249bdc8f2a4b 100644 (file)
@@ -1430,6 +1430,11 @@ static int commit_period(RGWRealm& realm, RGWPeriod& period,
     cerr << "Error updating period epoch: " << cpp_strerror(ret) << std::endl;
     return ret;
   }
+  ret = period.reflect();
+  if (ret < 0) {
+    cerr << "Error updating local objects: " << cpp_strerror(ret) << std::endl;
+    return ret;
+  }
   realm.notify_new_period(period);
   return ret;
 }
index 3418418e6ff914afa836880ed23558c30369785c..11a1554998b29e5077d05b2b9fdba1eb12a942c5 100644 (file)
@@ -1008,17 +1008,7 @@ int RGWPeriod::set_latest_epoch(epoch_t epoch)
 
   ::encode(info, bl);
 
-  int ret = rgw_put_system_obj(store, pool, oid, bl.c_str(), bl.length(), false, NULL, 0, NULL);
-  if (ret < 0)
-    return ret;
-
-  ret = reflect();
-  if (ret < 0) {
-    ldout(cct, 0) << "ERROR: period.reflect(): " << cpp_strerror(-ret) << dendl;
-    return ret;
-  }
-
-  return 0;
+  return rgw_put_system_obj(store, pool, oid, bl.c_str(), bl.length(), false, NULL, 0, NULL);
 }
 
 int RGWPeriod::delete_obj()
@@ -1344,6 +1334,11 @@ int RGWPeriod::commit(RGWRealm& realm, const RGWPeriod& current_period)
     lderr(cct) << "failed to set latest epoch: " << cpp_strerror(-r) << dendl;
     return r;
   }
+  r = reflect();
+  if (r < 0) {
+    lderr(cct) << "failed to update local objects: " << cpp_strerror(-r) << dendl;
+    return r;
+  }
   ldout(cct, 4) << "Committed new epoch " << epoch
       << " for period " << id << dendl;
   realm.notify_new_period(*this);
index 8db20bd90b787376979d1b4e143ea226ba5594e4..9e466d6960db19e996cf5a6f56808741da875ca9 100644 (file)
@@ -171,6 +171,13 @@ void RGWOp_Period_Post::execute()
     lderr(cct) << "failed to set latest epoch" << dendl;
     return;
   }
+  // reflect the period into our local objects
+  http_ret  = period.reflect();
+  if (http_ret  < 0) {
+    lderr(cct) << "failed to update local objects: "
+        << cpp_strerror(-http_ret) << dendl;
+    return;
+  }
   ldout(cct, 4) << "period epoch " << period.get_epoch()
       << " is newer than current epoch " << current_period.get_epoch()
       << ", updating latest epoch and notifying zone" << dendl;