diff options
author | Sage Weil <sage@inktank.com> | 2013-08-04 22:25:03 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-08-04 22:25:03 -0700 |
commit | ecefa07a260097e6b1c5e76977104bdb4a76b78f (patch) | |
tree | 973b7ef3f5868d55d66ed2e3764a1f7605a916d8 | |
parent | e5d9ac64df6569c801f644c222547b7ee623e15f (diff) | |
download | ceph-ecefa07a260097e6b1c5e76977104bdb4a76b78f.tar.gz |
osd: handle limited osdmap history in project_pg_historywip-5869
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 <sage@inktank.com>
-rw-r--r-- | src/osd/OSD.cc | 11 |
1 files 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) |