From 4bc01379bbf946d2f5963dcca6b071914117ce4a Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 16 Aug 2018 12:30:02 -0500 Subject: [PATCH] osd: base project_pg_history on is_new_interval Signed-off-by: Sage Weil --- src/osd/OSD.cc | 30 +++++++++++------------------- src/osd/OSD.h | 2 +- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 0e302c385fe33..3e3e5129f4506 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -4370,7 +4370,7 @@ void OSD::build_initial_pg_history( * and same_primary_since. */ bool OSD::project_pg_history(spg_t pgid, pg_history_t& h, epoch_t from, - const OSDMap& endmap, + const OSDMapRef& endmap, const vector& currentup, int currentupprimary, const vector& currentacting, @@ -4391,7 +4391,6 @@ bool OSD::project_pg_history(spg_t pgid, pg_history_t& h, epoch_t from, dout(15) << __func__ << ": found map gap, returning false" << dendl; return false; } - ceph_assert(oldmap->have_pg_pool(pgid.pool())); int upprimary, actingprimary; vector up, acting; @@ -4402,25 +4401,18 @@ bool OSD::project_pg_history(spg_t pgid, pg_history_t& h, epoch_t from, &acting, &actingprimary); - // acting set change? - if ((actingprimary != currentactingprimary || - upprimary != currentupprimary || - acting != currentacting || - up != currentup) && e > h.same_interval_since) { - dout(15) << "project_pg_history " << pgid << " acting|up changed in " << e - << " from " << acting << "/" << up - << " " << actingprimary << "/" << upprimary - << " -> " << currentacting << "/" << currentup - << " " << currentactingprimary << "/" << currentupprimary - << dendl; - h.same_interval_since = e; - } - // split? - if (pgid.is_split(oldmap->get_pg_num(pgid.pool()), - endmap->get_pg_num(pgid.pool()), - 0) && e > h.same_interval_since) { + if (e > h.same_interval_since && + PastIntervals::is_new_interval( + actingprimary, currentactingprimary, + acting, currentacting, + upprimary, currentupprimary, + up, currentup, + oldmap, endmap, + pgid.pgid)) { + dout(15) << "project_pg_history " << pgid << " interval changed in " << e << dendl; h.same_interval_since = e; } + // up set change? if ((up != currentup || upprimary != currentupprimary) && e > h.same_up_since) { diff --git a/src/osd/OSD.h b/src/osd/OSD.h index 1e1e529a187e8..cace749e139b4 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -1926,7 +1926,7 @@ protected: /// project pg history from from to now bool project_pg_history( spg_t pgid, pg_history_t& h, epoch_t from, - const OSDMap &osdmap, + const OSDMapRef &osdmap, const vector& lastup, int lastupprimary, const vector& lastacting, -- 2.39.5