From: Sage Weil Date: Fri, 11 Mar 2011 20:30:35 +0000 (-0800) Subject: osd: avoid setting up_thru on new PGs X-Git-Tag: v0.26~186 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e731885d2550ee985bf875ab5bb5faf28f1693eb;p=ceph.git osd: avoid setting up_thru on new PGs 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 --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index ceac8b72b3bd..a8845f1a3d51 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -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; diff --git a/src/osd/PG.cc b/src/osd/PG.cc index d3ca5aeb99a9..57a23c892c5a 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -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& 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;