]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: avoid setting up_thru on new PGs
authorSage Weil <sage@newdream.net>
Fri, 11 Mar 2011 20:30:35 +0000 (12:30 -0800)
committerSage Weil <sage@newdream.net>
Fri, 11 Mar 2011 20:55:14 +0000 (12:55 -0800)
This trades off the possibility of peering blockage if the OSDs in the
first interval (after pg creation) go down and stay down with avoiding
two osdmap updates for any pg creation.  I think this is reasonable given
that:

 - If the pg did go active, then it did go RW and assuming as much changed
   nothing.
 - If the pg did not go active, then it is empty, and there is no data
   lost.

To do this:

- When peering during the first ever interval, don't bother setting
  up_thru.
- Always mark that interval maybe_went_rw, even though up_thru isn't set
  as such.

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
src/osd/OSD.cc
src/osd/PG.cc

index ceac8b72b3bd8a5982e639813cd290ef888fcd3b..a8845f1a3d5193c678bbfefd7811abe0e7cd2892 100644 (file)
@@ -3147,8 +3147,9 @@ void OSD::advance_map(ObjectStore::Transaction& t)
 
       if (i.acting.size())
        i.maybe_went_rw = 
-         lastmap->get_up_thru(i.acting[0]) >= i.first &&
-         lastmap->get_up_from(i.acting[0]) <= i.first;
+         (lastmap->get_up_thru(i.acting[0]) >= i.first &&
+          lastmap->get_up_from(i.acting[0]) <= i.first) ||
+         i.first == pg->info.history.epoch_created;
       else
        i.maybe_went_rw = 0;
 
index d3ca5aeb99a9f9a4ca24392030cd3f17c6ff938f..57a23c892c5a333f3ab017f6989b8e4df3248bfe 100644 (file)
@@ -871,8 +871,9 @@ void PG::generate_past_intervals()
     i.acting.swap(tacting);
     if (i.acting.size()) {
       i.maybe_went_rw = 
-       lastmap->get_up_thru(i.acting[0]) >= first_epoch &&
-       lastmap->get_up_from(i.acting[0]) <= first_epoch;
+       (lastmap->get_up_thru(i.acting[0]) >= first_epoch &&
+        lastmap->get_up_from(i.acting[0]) <= first_epoch) ||
+       (first_epoch == info.history.epoch_created);
       dout(10) << "generate_past_intervals " << i
               << " : primary up " << lastmap->get_up_from(i.acting[0])
               << "-" << lastmap->get_up_thru(i.acting[0])
@@ -1681,7 +1682,10 @@ void PG::do_peer(ObjectStore::Transaction& t, list<Context*>& tfin,
 
   // -- do need to notify the monitor?
   if (true) {
-    if (osd->osdmap->get_up_thru(osd->whoami) < info.history.same_acting_since) {
+    // NOTE: we can skip the up_thru check if this is a new PG and there
+    // were no prior intervals.
+    if (info.history.epoch_created < info.history.same_acting_since &&
+       osd->osdmap->get_up_thru(osd->whoami) < info.history.same_acting_since) {
       dout(10) << "up_thru " << osd->osdmap->get_up_thru(osd->whoami)
               << " < same_since " << info.history.same_acting_since
               << ", must notify monitor" << dendl;