diff --git a/src/osd/PG.cc b/src/osd/PG.cc index f6f46361035..4109fafbf19 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -6170,6 +6170,28 @@ void PG::handle_query_state(Formatter *f) dout(10) << "handle_query_state" << dendl; PeeringState::QueryState q(f); recovery_state.handle_event(q, 0); + + if (is_primary() && is_active()) { + f->open_object_section("scrub"); + f->dump_stream("scrubber.epoch_start") << scrubber.epoch_start; + f->dump_bool("scrubber.active", scrubber.active); + f->dump_string("scrubber.state", PG::Scrubber::state_string(scrubber.state)); + f->dump_stream("scrubber.start") << scrubber.start; + f->dump_stream("scrubber.end") << scrubber.end; + f->dump_stream("scrubber.max_end") << scrubber.max_end; + f->dump_stream("scrubber.subset_last_update") << scrubber.subset_last_update; + f->dump_bool("scrubber.deep", scrubber.deep); + { + f->open_array_section("scrubber.waiting_on_whom"); + for (set::iterator p = scrubber.waiting_on_whom.begin(); + p != scrubber.waiting_on_whom.end(); + ++p) { + f->dump_stream("shard") << *p; + } + f->close_section(); + } + f->close_section(); + } } void PG::on_pool_change() diff --git a/src/osd/PG.h b/src/osd/PG.h index e5853066a35..b58c4f18f8c 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -940,7 +940,7 @@ protected: void _update_calc_stats(); void _update_blocked_by(); friend class TestOpsSocketHook; - void publish_stats_to_osd(); + void publish_stats_to_osd() override; bool needs_recovery() const; bool needs_backfill() const; diff --git a/src/osd/PeeringState.cc b/src/osd/PeeringState.cc index 2f4f0b21bac..7a94ac477cf 100644 --- a/src/osd/PeeringState.cc +++ b/src/osd/PeeringState.cc @@ -2443,28 +2443,6 @@ boost::statechart::result PeeringState::Active::react(const QueryState& q) q.f->close_section(); } - { - q.f->open_object_section("scrub"); - q.f->dump_stream("scrubber.epoch_start") << pg->scrubber.epoch_start; - q.f->dump_bool("scrubber.active", pg->scrubber.active); - q.f->dump_string("scrubber.state", PG::Scrubber::state_string(pg->scrubber.state)); - q.f->dump_stream("scrubber.start") << pg->scrubber.start; - q.f->dump_stream("scrubber.end") << pg->scrubber.end; - q.f->dump_stream("scrubber.max_end") << pg->scrubber.max_end; - q.f->dump_stream("scrubber.subset_last_update") << pg->scrubber.subset_last_update; - q.f->dump_bool("scrubber.deep", pg->scrubber.deep); - { - q.f->open_array_section("scrubber.waiting_on_whom"); - for (set::iterator p = pg->scrubber.waiting_on_whom.begin(); - p != pg->scrubber.waiting_on_whom.end(); - ++p) { - q.f->dump_stream("shard") << *p; - } - q.f->close_section(); - } - q.f->close_section(); - } - q.f->close_section(); return forward_event(); } diff --git a/src/osd/PeeringState.h b/src/osd/PeeringState.h index 7c78db7aab3..bf8dd01a018 100644 --- a/src/osd/PeeringState.h +++ b/src/osd/PeeringState.h @@ -84,6 +84,7 @@ public: virtual void queue_want_pg_temp(const vector &wanted) = 0; virtual void clear_want_pg_temp() = 0; + virtual void publish_stats_to_osd() = 0; virtual void clear_publish_stats() = 0; virtual void check_recovery_sources(const OSDMapRef& newmap) = 0;