summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2012-04-27 14:30:17 -0700
committerSage Weil <sage.weil@dreamhost.com>2012-04-28 07:46:42 -0700
commit12d1675ca0e2d63c1a4c36400614d3c4f2eefecf (patch)
tree94aa141cfdf7a339fc5b1106a39ec703e9afa809
parent90dae62b9c672218419d2ac4685cff44dedde376 (diff)
downloadceph-12d1675ca0e2d63c1a4c36400614d3c4f2eefecf.tar.gz
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 <sage@newdream.net>
-rw-r--r--src/osd/PG.cc23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/osd/PG.cc b/src/osd/PG.cc
index 813f992786b..2bba57d1b67 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<epoch_t,pg_interval_t>::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<epoch_t,pg_interval_t>::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);