]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/scrub: cluster-logging unsolicited DigestUpdate events
authorRonen Friedman <rfriedma@redhat.com>
Thu, 2 Dec 2021 13:05:38 +0000 (13:05 +0000)
committerRonen Friedman <rfriedma@redhat.com>
Thu, 24 Mar 2022 07:21:43 +0000 (07:21 +0000)
... and not just to the OSD's log

Signed-off-by: Ronen Friedman <rfriedma@redhat.com>
(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.

src/osd/scrubber/pg_scrubber.cc
src/osd/scrubber/pg_scrubber.h
src/osd/scrubber/scrub_machine.cc
src/osd/scrubber/scrub_machine_lstnr.h

index 712a3c328f838e39856212cd64e477cbd8f133b7..ca674bda5943e5c9badd1b1ed38f4a0827a8c28c 100644 (file)
@@ -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 << " ] ";
index f32fb23191cd3e596ad1b7eceaa7d6d2ea1dae37..e223ae213ab753fc2232657b6c7fdce20c25eedc 100644 (file)
@@ -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); }
index 2610bf351a15029e0d2f79375197178d06072701..7987559d0261f1cd399fd3fc5daa7ae1a0ca2d38 100644 (file)
@@ -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)
index 2fed0a399f160519abcd14d7288cd5ec822009d2..f26d5faebbf151b143f61d91258f527c480c4fc7 100644 (file)
@@ -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;
 };