From 76581bdf43fd0a9b07bc25bb9dd15bb1f0898e1f 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 Resolves: rhbz#2094955 Signed-off-by: Prashant D (cherry picked from commit 2f6272ac8546070cbc78447c558db47dbdff113c) --- 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 deac85c5a570c..23c0e8a3b81af 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 25e4a83d9e8b4..33cee84380ce9 100644 --- a/src/osd/scrubber/pg_scrubber.cc +++ b/src/osd/scrubber/pg_scrubber.cc @@ -2130,6 +2130,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.39.5