From ecefa07a260097e6b1c5e76977104bdb4a76b78f Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Sun, 4 Aug 2013 22:25:03 -0700 Subject: osd: handle limited osdmap history in project_pg_history Handle the case where we run out of map history in project_pg_history. When that happens, assume that the oldest epoch we have is the epoch where any acting/primary/whatever changed, if we haven't already identified a later epoch. This matches what we do with the creation epoch base case. Fixes: #5869 Signed-off-by: Sage Weil --- src/osd/OSD.cc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 69c181862cc..469520ec72c 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -2373,9 +2373,14 @@ void OSD::project_pg_history(pg_t pgid, pg_history_t& h, epoch_t from, << ", start " << h << dendl; + epoch_t stop = from; + if (from < superblock.oldest_map) { + stop = superblock.oldest_map; + dout(15) << " will stop at first_map " << stop << dendl; + } epoch_t e; for (e = osdmap->get_epoch(); - e > from; + e > stop; e--) { // verify during intermediate epoch (e-1) OSDMapRef oldmap = get_map(e-1); @@ -2417,8 +2422,8 @@ void OSD::project_pg_history(pg_t pgid, pg_history_t& h, epoch_t from, } // base case: these floors should be the creation epoch if we didn't - // find any changes. - if (e == h.epoch_created) { + // find any changes, or we ran out of map history. + if (e == h.epoch_created || from < superblock.oldest_map) { if (!h.same_interval_since) h.same_interval_since = e; if (!h.same_up_since) -- cgit v1.2.1