From b473e2228a83dea5b9a1beb25d147c24b00a89ed Mon Sep 17 00:00:00 2001 From: Prashant D Date: Tue, 31 May 2022 06:07:47 +0100 Subject: [PATCH] osd/scrub: Reintroduce scrub starts message Whenever the scrubbing process starts for a PG, We used to log scrub/deep-scrub "starts" message in the cluster log. We are not seeing scrub "starts" messages anymore. Reintroduce scrub starts message in order to calculate exact time taken to scrub/deep-scrub the PG. Fixes: https://tracker.ceph.com/issues/55798 Signed-off-by: Prashant D (cherry picked from commit 2f6272ac8546070cbc78447c558db47dbdff113c) Conflicts: src/osd/osd_types_fmt.h: Add formatter for pg_t. Remove formatter for spg_t, pg_history_t, pg_info_t and others as they are not part of quincy yet. --- src/osd/osd_types_fmt.h | 11 +++++++++++ src/osd/scrubber/pg_scrubber.cc | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/src/osd/osd_types_fmt.h b/src/osd/osd_types_fmt.h index deac85c5a57..23c0e8a3b81 100644 --- a/src/osd/osd_types_fmt.h +++ b/src/osd/osd_types_fmt.h @@ -104,3 +104,14 @@ struct fmt::formatter { return fmt::format_to(ctx.out(), ")"); } }; + +template <> +struct fmt::formatter { + constexpr auto parse(format_parse_context& ctx) { return ctx.begin(); } + + template + auto format(const pg_t& pg, FormatContext& ctx) + { + return fmt::format_to(ctx.out(), "{}.{:x}", pg.pool(), pg.m_seed); + } +}; diff --git a/src/osd/scrubber/pg_scrubber.cc b/src/osd/scrubber/pg_scrubber.cc index a070245c4ee..220d2933cd0 100644 --- a/src/osd/scrubber/pg_scrubber.cc +++ b/src/osd/scrubber/pg_scrubber.cc @@ -2128,6 +2128,10 @@ PgScrubber::PgScrubber(PG* pg) void PgScrubber::set_scrub_begin_time() { scrub_begin_stamp = ceph_clock_now(); + m_osds->clog->debug() << fmt::format( + "{} {} starts", + m_pg->info.pgid.pgid, + m_mode_desc); } void PgScrubber::set_scrub_duration() -- 2.47.3