From cdea03eb4be050c0b252a65c84b6447a4478f8db Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 3 Dec 2008 16:42:38 -0800 Subject: [PATCH] osd: fix problems with propagation of info.stats during recovery merge_log() is called on replicas, do don't use peer_info (which is primary-only)! --- src/osd/OSD.cc | 4 ++-- src/osd/PG.cc | 20 ++++++++++---------- src/osd/PG.h | 6 +++--- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index d116dfa12ed7a..51f47a770978e 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -2795,7 +2795,7 @@ void OSD::_process_pg_info(epoch_t epoch, int from, if (pg->peer_log_requested.count(from) || pg->peer_summary_requested.count(from)) { if (!pg->is_active()) { - pg->proc_replica_log(t, log, missing, from); + pg->proc_replica_log(t, info, log, missing, from); // peer map< int, map > query_map; @@ -2813,7 +2813,7 @@ void OSD::_process_pg_info(epoch_t epoch, int from, // i am REPLICA // merge log - pg->merge_log(t, log, missing, from); + pg->merge_log(t, info, log, missing, from); // ok activate! pg->activate(t, info_map); diff --git a/src/osd/PG.cc b/src/osd/PG.cc index f2f156e2af7a5..e7f76b5e94255 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -166,7 +166,7 @@ void PG::trim_write_ahead() } -void PG::proc_replica_log(ObjectStore::Transaction& t, Log &olog, Missing& omissing, int from) +void PG::proc_replica_log(ObjectStore::Transaction& t, Info &oinfo, Log &olog, Missing& omissing, int from) { dout(10) << "proc_replica_log for osd" << from << ": " << olog << " " << omissing << dendl; assert(!is_active()); @@ -177,7 +177,7 @@ void PG::proc_replica_log(ObjectStore::Transaction& t, Log &olog, Missing& omiss peer_missing[from] = omissing; // merge log into our own log - merge_log(t, olog, omissing, from); + merge_log(t, oinfo, olog, omissing, from); proc_replica_missing(olog, omissing, from); } else { // i'm just building missing lists. @@ -185,7 +185,7 @@ void PG::proc_replica_log(ObjectStore::Transaction& t, Log &olog, Missing& omiss // iterate over peer log. in reverse. list::reverse_iterator pp = olog.log.rbegin(); - eversion_t lu = peer_info[from].last_update; + eversion_t lu = oinfo.last_update; while (pp != olog.log.rend()) { if (!log.logged_object(pp->oid)) { if (!log.backlog) { @@ -228,9 +228,9 @@ void PG::proc_replica_log(ObjectStore::Transaction& t, Log &olog, Missing& omiss lu = olog.bottom; } - if (lu < peer_info[from].last_update) { + if (lu < oinfo.last_update) { dout(10) << " peer osd" << from << " last_update now " << lu << dendl; - peer_info[from].last_update = lu; + oinfo.last_update = lu; if (lu < oldest_update) { dout(10) << " oldest_update now " << lu << dendl; oldest_update = lu; @@ -296,16 +296,16 @@ void PG::merge_old_entry(ObjectStore::Transaction& t, Log::Entry& oe) } } -void PG::merge_log(ObjectStore::Transaction& t, Log &olog, Missing &omissing, int fromosd) +void PG::merge_log(ObjectStore::Transaction& t, Info &oinfo, Log &olog, Missing &omissing, int fromosd) { dout(10) << "merge_log " << olog << " from osd" << fromosd << " into " << log << dendl; bool changed = false; - dout(15) << "log"; + dout(15) << "log = "; log.print(*_dout); *_dout << dendl; - dout(15) << "olog"; + dout(15) << "olog = "; olog.print(*_dout); *_dout << dendl; @@ -366,7 +366,7 @@ void PG::merge_log(ObjectStore::Transaction& t, Log &olog, Missing &omissing, in info.last_update = log.top = olog.top; info.log_bottom = log.bottom = olog.bottom; info.log_backlog = log.backlog = olog.backlog; - info.stats = peer_info[fromosd].stats; + info.stats = oinfo.stats; changed = true; } @@ -453,7 +453,7 @@ void PG::merge_log(ObjectStore::Transaction& t, Log &olog, Missing &omissing, in olog.log, from, to); info.last_update = log.top = olog.top; - info.stats = peer_info[fromosd].stats; + info.stats = oinfo.stats; // process divergent items if (!divergent.empty()) { diff --git a/src/osd/PG.h b/src/osd/PG.h index 6118a668257f6..e5bb933b1700c 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -644,9 +644,9 @@ public: return false; } - void proc_replica_log(ObjectStore::Transaction& t, Log &olog, Missing& omissing, int from); + void proc_replica_log(ObjectStore::Transaction& t, Info &oinfo, Log &olog, Missing& omissing, int from); void merge_old_entry(ObjectStore::Transaction& t, Log::Entry& oe); - void merge_log(ObjectStore::Transaction& t, Log &olog, Missing& omissing, int from); + void merge_log(ObjectStore::Transaction& t, Info &oinfo, Log &olog, Missing& omissing, int from); void proc_replica_missing(Log &olog, Missing &omissing, int fromosd); void generate_backlog(); @@ -809,7 +809,7 @@ WRITE_CLASS_ENCODER(PG::Interval) inline ostream& operator<<(ostream& out, const PG::Info::History& h) { - return out << " ec=" << h.epoch_created + return out << "ec=" << h.epoch_created << " les=" << h.last_epoch_started << " " << h.same_since << "/" << h.same_primary_since << "/" << h.same_acker_since; } -- 2.39.5