From 5450567a6769b64ace385140ffb645d9d805e354 Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Fri, 6 Jul 2012 14:38:57 -0700 Subject: [PATCH] ReplicatedPG,PG: dump recovery/backfill state on pg query Signed-off-by: Samuel Just --- src/osd/PG.cc | 6 ++- src/osd/PG.h | 17 +++++++ src/osd/ReplicatedPG.h | 102 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 124 insertions(+), 1 deletion(-) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index d048e20da7dfd..14c5d581a3980 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -152,7 +152,6 @@ void PG::IndexedLog::trim(ObjectStore::Transaction& t, eversion_t s) tail = s; } - /********* PG **********/ void PG::proc_master_log(ObjectStore::Transaction& t, pg_info_t &oinfo, pg_log_t &olog, pg_missing_t& omissing, int from) @@ -4749,6 +4748,11 @@ boost::statechart::result PG::RecoveryState::Active::react(const QueryState& q) } q.f->close_section(); } + { + q.f->open_object_section("recovery_progress"); + pg->dump_recovery_info(q.f); + q.f->close_section(); + } { q.f->open_object_section("scrub"); diff --git a/src/osd/PG.h b/src/osd/PG.h index c885c29148e0f..f5a1070beed6b 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -589,6 +589,22 @@ protected: else begin = objects.begin()->first; } + + /// dump + void dump(Formatter *f) const { + f->dump_stream("begin") << begin; + f->dump_stream("end") << end; + f->open_array_section("objects"); + for (map::const_iterator i = objects.begin(); + i != objects.end(); + ++i) { + f->open_object_section("object"); + f->dump_stream("object") << i->first; + f->dump_stream("version") << i->second; + f->close_section(); + } + f->close_section(); + } }; BackfillInterval backfill_info; @@ -656,6 +672,7 @@ public: bool all_unfound_are_queried_or_lost(const OSDMapRef osdmap) const; virtual void mark_all_unfound_lost(int how) = 0; + virtual void dump_recovery_info(Formatter *f) const = 0; bool calc_min_last_complete_ondisk() { eversion_t min = last_complete_ondisk; diff --git a/src/osd/ReplicatedPG.h b/src/osd/ReplicatedPG.h index 8c7112110e048..e886b17d902ff 100644 --- a/src/osd/ReplicatedPG.h +++ b/src/osd/ReplicatedPG.h @@ -562,6 +562,19 @@ protected: struct PushInfo { ObjectRecoveryProgress recovery_progress; ObjectRecoveryInfo recovery_info; + + void dump(Formatter *f) const { + { + f->open_object_section("recovery_progress"); + recovery_progress.dump(f); + f->close_section(); + } + { + f->open_object_section("recovery_info"); + recovery_info.dump(f); + f->close_section(); + } + } }; map > pushing; @@ -570,6 +583,19 @@ protected: ObjectRecoveryProgress recovery_progress; ObjectRecoveryInfo recovery_info; + void dump(Formatter *f) const { + { + f->open_object_section("recovery_progress"); + recovery_progress.dump(f); + f->close_section(); + } + { + f->open_object_section("recovery_info"); + recovery_info.dump(f); + f->close_section(); + } + } + bool is_complete() const { return recovery_progress.is_complete(recovery_info); } @@ -619,6 +645,82 @@ protected: set backfills_in_flight; map pending_backfill_updates; + void dump_recovery_info(Formatter *f) const { + f->dump_int("backfill_target", get_backfill_target()); + f->dump_int("waiting_on_backfill", waiting_on_backfill); + f->dump_stream("backfill_pos") << backfill_pos; + { + f->open_object_section("backfill_info"); + backfill_info.dump(f); + f->close_section(); + } + { + f->open_object_section("peer_backfill_info"); + peer_backfill_info.dump(f); + f->close_section(); + } + { + f->open_array_section("backfills_in_flight"); + for (set::const_iterator i = backfills_in_flight.begin(); + i != backfills_in_flight.end(); + ++i) { + f->dump_stream("object") << *i; + } + f->close_section(); + } + { + f->open_array_section("pull_from_peer"); + for (map >::const_iterator i = pull_from_peer.begin(); + i != pull_from_peer.end(); + ++i) { + f->open_object_section("pulling_from"); + f->dump_int("pull_from", i->first); + { + f->open_array_section("pulls"); + for (set::const_iterator j = i->second.begin(); + j != i->second.end(); + ++j) { + f->open_object_section("pull_info"); + assert(pulling.count(*j)); + pulling.find(*j)->second.dump(f); + f->close_section(); + } + f->close_section(); + } + f->close_section(); + } + f->close_section(); + } + { + f->open_array_section("pushing"); + for (map >::const_iterator i = + pushing.begin(); + i != pushing.end(); + ++i) { + f->open_object_section("object"); + f->dump_stream("pushing") << i->first; + { + f->open_array_section("pushing_to"); + for (map::const_iterator j = i->second.begin(); + j != i->second.end(); + ++j) { + f->open_object_section("push_progress"); + f->dump_stream("object_pushing") << j->first; + { + f->open_object_section("push_info"); + j->second.dump(f); + f->close_section(); + } + f->close_section(); + } + f->close_section(); + } + f->close_section(); + } + f->close_section(); + } + } + /// leading edge of backfill hobject_t backfill_pos; -- 2.39.5