]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
OSD: on pg_removal, project_pg_history to get current interval
authorSamuel Just <sam.just@inktank.com>
Thu, 7 Jun 2012 04:27:38 +0000 (21:27 -0700)
committerSamuel Just <sam.just@inktank.com>
Thu, 5 Jul 2012 17:15:00 +0000 (10:15 -0700)
First, we don't really want to remove the pg if we can use it.  Second,
there might be messages in the pg peering queue for the next interval.
If one of those happens to be an info request or notify, we would lose
the peering message.

If the message falls in the current interval as determined by the
current osdmap, than we know that any messages currently queued must be
obsolete and can safetly be discarded.

Signed-off-by: Samuel Just <sam.just@inktank.com>
src/osd/OSD.cc
src/osd/OSD.h

index a0617be956896364576c2a2b5ab1907696a1da5c..6c744dfa4b36b0c5df64f15c95fb708aa4fdfc14 100644 (file)
@@ -1511,7 +1511,8 @@ void OSD::calc_priors_during(pg_t pgid, epoch_t start, epoch_t end, set<int>& ps
  * and same_primary_since.
  */
 void OSD::project_pg_history(pg_t pgid, pg_history_t& h, epoch_t from,
-                            vector<int>& currentup, vector<int>& currentacting)
+                            const vector<int>& currentup,
+                            const vector<int>& currentacting)
 {
   dout(15) << "project_pg_history " << pgid
            << " from " << from << " to " << osdmap->get_epoch()
@@ -4669,7 +4670,12 @@ void OSD::handle_pg_remove(OpRequestRef op)
     }
     dout(5) << "queue_pg_for_deletion: " << pgid << dendl;
     PG *pg = _lookup_lock_pg(pgid);
-    if (pg->info.history.same_interval_since <= m->get_epoch()) {
+    pg_history_t history = pg->info.history;
+    vector<int> up, acting;
+    osdmap->pg_to_up_acting_osds(pgid, up, acting);
+    project_pg_history(pg->info.pgid, history, pg->get_osdmap()->get_epoch(),
+                      up, acting);
+    if (history.same_interval_since <= m->get_epoch()) {
       assert(pg->get_primary() == m->get_source().num());
       pg->get();
       _remove_pg(pg);
@@ -4677,7 +4683,7 @@ void OSD::handle_pg_remove(OpRequestRef op)
       pg->put();
     } else {
       dout(10) << *pg << " ignoring remove request, pg changed in epoch "
-              << pg->info.history.same_interval_since
+              << history.same_interval_since
               << " > " << m->get_epoch() << dendl;
       pg->unlock();
     }
index c552a959072de7b1dc5591e7e387345ee9085294..cb4c474d04bfb9a78e5a94d7d06382ec8c1e7f82 100644 (file)
@@ -717,7 +717,7 @@ protected:
   void load_pgs();
   void calc_priors_during(pg_t pgid, epoch_t start, epoch_t end, set<int>& pset);
   void project_pg_history(pg_t pgid, pg_history_t& h, epoch_t from,
-                         vector<int>& lastup, vector<int>& lastacting);
+                         const vector<int>& lastup, const vector<int>& lastacting);
 
   void wake_pg_waiters(pg_t pgid) {
     if (waiting_for_pg.count(pgid)) {