From b242c565c07ffc6754c5ce798ee030ae046dbdef Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Wed, 6 Jun 2012 21:27:38 -0700 Subject: [PATCH] OSD: on pg_removal, project_pg_history to get current interval 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 --- src/osd/OSD.cc | 12 +++++++++--- src/osd/OSD.h | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index a0617be956896..6c744dfa4b36b 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -1511,7 +1511,8 @@ void OSD::calc_priors_during(pg_t pgid, epoch_t start, epoch_t end, set& ps * and same_primary_since. */ void OSD::project_pg_history(pg_t pgid, pg_history_t& h, epoch_t from, - vector& currentup, vector& currentacting) + const vector& currentup, + const vector& 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 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(); } diff --git a/src/osd/OSD.h b/src/osd/OSD.h index c552a959072de..cb4c474d04bfb 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -717,7 +717,7 @@ protected: void load_pgs(); void calc_priors_during(pg_t pgid, epoch_t start, epoch_t end, set& pset); void project_pg_history(pg_t pgid, pg_history_t& h, epoch_t from, - vector& lastup, vector& lastacting); + const vector& lastup, const vector& lastacting); void wake_pg_waiters(pg_t pgid) { if (waiting_for_pg.count(pgid)) { -- 2.39.5