From: Ronen Friedman Date: Thu, 2 Dec 2021 13:05:38 +0000 (+0000) Subject: osd/scrub: cluster-logging unsolicited DigestUpdate events X-Git-Tag: v17.2.1~91^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=28805a80444da8102010cc5a58859b1adaa49b70;p=ceph.git osd/scrub: cluster-logging unsolicited DigestUpdate events ... and not just to the OSD's log Signed-off-by: Ronen Friedman (cherry picked from commit 84fe3622b887b645ffdb0b110963b89755c3c0f9) Conflicts: src/osd/scrubber/pg_scrubber.h src/osd/scrubber/scrub_machine.cc conflict resolution (performed automatically by the IDE): pg_scrubber.h: removing the irrelevant get_snaps() that was picked; scrub_machine.cc: no non-empty lines involved Two missing lines will be included in the following commit. --- diff --git a/src/osd/scrubber/pg_scrubber.cc b/src/osd/scrubber/pg_scrubber.cc index 712a3c328f83..ca674bda5943 100644 --- a/src/osd/scrubber/pg_scrubber.cc +++ b/src/osd/scrubber/pg_scrubber.cc @@ -2297,6 +2297,11 @@ std::ostream& PgScrubber::gen_prefix(std::ostream& out) const } } +void PgScrubber::log_cluster_warning(const std::string& warning) const +{ + m_osds->clog->do_log(CLOG_WARN, warning); +} + ostream& PgScrubber::show(ostream& out) const { return out << " [ " << m_pg_id << ": " << m_flags << " ] "; diff --git a/src/osd/scrubber/pg_scrubber.h b/src/osd/scrubber/pg_scrubber.h index f32fb23191cd..e223ae213ab7 100644 --- a/src/osd/scrubber/pg_scrubber.h +++ b/src/osd/scrubber/pg_scrubber.h @@ -444,6 +444,8 @@ class PgScrubber : public ScrubPgIF, public ScrubMachineListener { utime_t scrub_begin_stamp; std::ostream& gen_prefix(std::ostream& out) const final; + void log_cluster_warning(const std::string& warning) const final; + protected: bool state_test(uint64_t m) const { return m_pg->state_test(m); } void state_set(uint64_t m) { m_pg->state_set(m); } diff --git a/src/osd/scrubber/scrub_machine.cc b/src/osd/scrubber/scrub_machine.cc index 2610bf351a15..7987559d0261 100644 --- a/src/osd/scrubber/scrub_machine.cc +++ b/src/osd/scrubber/scrub_machine.cc @@ -435,6 +435,15 @@ sc::result WaitReplicas::react(const GotReplicas&) } } +sc::result WaitReplicas::react(const DigestUpdate&) +{ + DECLARE_LOCALS; // 'scrbr' & 'pg_id' aliases + std::string warn_msg = "WaitReplicas::react(const DigestUpdate&): Unexpected DigestUpdate event"; + dout(10) << warn_msg << dendl; + scrbr->log_cluster_warning(warn_msg); + return discard_event(); +} + // ----------------------- WaitDigestUpdate ----------------------------------- WaitDigestUpdate::WaitDigestUpdate(my_context ctx) : my_base(ctx) diff --git a/src/osd/scrubber/scrub_machine_lstnr.h b/src/osd/scrubber/scrub_machine_lstnr.h index 2fed0a399f16..f26d5faebbf1 100644 --- a/src/osd/scrubber/scrub_machine_lstnr.h +++ b/src/osd/scrubber/scrub_machine_lstnr.h @@ -186,4 +186,7 @@ struct ScrubMachineListener { /// exposed to be used by the scrub_machine logger virtual std::ostream& gen_prefix(std::ostream& out) const = 0; + + /// sending cluster-log warnings + virtual void log_cluster_warning(const std::string& msg) const = 0; };