From 12d1675ca0e2d63c1a4c36400614d3c4f2eefecf Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 27 Apr 2012 14:30:17 -0700 Subject: [PATCH] osd: fix check for whether to recalculate past_intervals We may not recalculate all the way back to last_interval_clean due to the oldest_map floor. Figure out what we want and could calculate before deciding whether what we have is insufficient. Also, print something if we discard and recalculate so it is clear what is happening and why. Signed-off-by: Sage Weil --- src/osd/PG.cc | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 813f992786bb..2bba57d1b676 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -678,17 +678,6 @@ bool PG::needs_recovery() const void PG::generate_past_intervals() { - // Do we already have the intervals we want? - map::const_iterator pif = past_intervals.begin(); - if (pif != past_intervals.end()) { - if (pif->first <= info.history.last_epoch_clean) { - dout(10) << __func__ << ": already have past intervals back to " - << info.history.last_epoch_clean << dendl; - return; - } - past_intervals.clear(); - } - epoch_t first_epoch = 0; epoch_t stop = MAX(info.history.epoch_created, info.history.last_epoch_clean); if (stop < osd->superblock.oldest_map) @@ -701,6 +690,18 @@ void PG::generate_past_intervals() return; } + // Do we already have the intervals we want? + map::const_iterator pif = past_intervals.begin(); + if (pif != past_intervals.end()) { + if (pif->first <= stop) { + dout(10) << __func__ << " already have past intervals back to " + << stop << dendl; + return; + } + dout(10) << __func__ << " only have past intervals back to " << pif->first << ", recalculating" << dendl; + past_intervals.clear(); + } + dout(10) << __func__ << " over epochs " << stop << "-" << last_epoch << dendl; OSDMapRef nextmap = osd->get_map(last_epoch); -- 2.47.3