]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: rebuild past intervals when needed; tolerate partial info
authorSage Weil <sage@newdream.net>
Mon, 1 Dec 2008 23:13:25 +0000 (15:13 -0800)
committerSage Weil <sage@newdream.net>
Mon, 1 Dec 2008 23:43:38 +0000 (15:43 -0800)
Tolerate missing past_intervals attr.

Also, if only some past intervals are missing, rebuild them all; don't
assume that if any are there then all are there.

src/osd/PG.cc

index 7aaa7563b4c14962457f743072cf4c075d951ae3..af12629d9ffe9192467a8f043e8a9360fcfce024 100644 (file)
@@ -773,7 +773,8 @@ void PG::build_prior()
 
   // generate past intervals, if we don't have them.
   if (info.history.same_since > info.history.last_epoch_started &&
-      past_intervals.empty())
+      (past_intervals.empty() ||
+       past_intervals.begin()->first > info.history.last_epoch_started))
     generate_past_intervals();
   
   for (map<epoch_t,Interval>::reverse_iterator p = past_intervals.rbegin();
@@ -1652,8 +1653,10 @@ void PG::read_state(ObjectStore *store)
   // past_intervals
   bl.clear();
   store->collection_getattr(info.pgid.to_coll(), "past_intervals", bl);
-  p = bl.begin();
-  ::decode(past_intervals, p);
+  if (bl.length()) {
+    p = bl.begin();
+    ::decode(past_intervals, p);
+  }
 
   read_log(store);
 }