From 7ae60b49ce5da0c15e8b71d9e9ff19f1f370b1d4 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 1 Dec 2008 15:13:25 -0800 Subject: [PATCH] osd: rebuild past intervals when needed; tolerate partial info 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 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 7aaa7563b4c14..af12629d9ffe9 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -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::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); } -- 2.39.5