]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: fix check for whether to recalculate past_intervals
authorSage Weil <sage@newdream.net>
Fri, 27 Apr 2012 21:30:17 +0000 (14:30 -0700)
committerSage Weil <sage.weil@dreamhost.com>
Sat, 28 Apr 2012 14:46:42 +0000 (07:46 -0700)
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>
src/osd/PG.cc

index 813f992786bbd13aef6808b1aac8bd88b28e4a22..2bba57d1b67684c42f13e55dc26f8a58eea2a4d7 100644 (file)
@@ -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);