]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
osd/scrub: remove the 'planned scrub' flag set
authorRonen Friedman <rfriedma@redhat.com>
Tue, 10 Sep 2024 07:04:08 +0000 (02:04 -0500)
committerRonen Friedman <rfriedma@redhat.com>
Tue, 10 Sep 2024 07:04:08 +0000 (02:04 -0500)
Signed-off-by: Ronen Friedman <rfriedma@redhat.com>
src/osd/PG.cc
src/osd/PG.h
src/osd/PrimaryLogPG.cc
src/osd/scrubber/pg_scrubber.cc
src/osd/scrubber/pg_scrubber.h
src/osd/scrubber_common.h

index 718d7d309ba396212555452cd1cdd35d553936b7..76256df49b807070b1a118effe6c42f653c83781 100644 (file)
@@ -1318,7 +1318,7 @@ Scrub::schedule_result_t PG::start_scrubbing(
        get_pgbackend()->auto_repair_supported());
 
   return m_scrubber->start_scrub_session(
-      candidate.level, osd_restrictions, pg_cond, m_planned_scrub);
+      candidate.level, osd_restrictions, pg_cond);
 }
 
 double PG::next_deepscrub_interval() const
@@ -1351,8 +1351,7 @@ void PG::on_scrub_schedule_input_change(Scrub::delay_ready_t delay_ready)
 void PG::scrub_requested(scrub_level_t scrub_level, scrub_type_t scrub_type)
 {
   ceph_assert(m_scrubber);
-  std::ignore =
-      m_scrubber->scrub_requested(scrub_level, scrub_type, m_planned_scrub);
+  std::ignore = m_scrubber->scrub_requested(scrub_level, scrub_type);
 }
 
 void PG::clear_ready_to_merge() {
@@ -1907,11 +1906,10 @@ ostream& operator<<(ostream& out, const PG& pg)
 {
   out << pg.recovery_state;
 
-  // listing all scrub-related flags - both current and "planned next scrub"
+  // listing all scrub-related flags
   if (pg.is_scrubbing()) {
     out << *pg.m_scrubber;
   }
-  out << pg.m_planned_scrub;
 
   if (pg.recovery_ops_active)
     out << " rops=" << pg.recovery_ops_active;
index 4947dcd27de5e2f7e0b8a7713dc4c2d5388d7fa8..e12044086ef7a08d19207e821b5a70cacd0f6d44 100644 (file)
@@ -179,13 +179,6 @@ public:
   /// and be removed only in the PrimaryLogPG destructor.
   std::unique_ptr<ScrubPgIF> m_scrubber;
 
-  /// flags detailing scheduling/operation characteristics of the next scrub 
-  requested_scrub_t m_planned_scrub;
-
-  const requested_scrub_t& get_planned_scrub() const {
-    return m_planned_scrub;
-  }
-
   /// scrubbing state for both Primary & replicas
   bool is_scrub_active() const { return m_scrubber->is_scrub_active(); }
 
@@ -1387,11 +1380,6 @@ public:
 
  OSDService* get_pg_osd(ScrubberPasskey) const { return osd; }
 
- requested_scrub_t& get_planned_scrub(ScrubberPasskey)
- {
-   return m_planned_scrub;
- }
-
  void force_object_missing(ScrubberPasskey,
                            const std::set<pg_shard_t>& peer,
                            const hobject_t& oid,
index 1df284bcfc3169ed5a27c3efc67f0ce06870bf09..2f2ae4a22dbe18d700cc362432c5ffa7b8fb2cb3 100644 (file)
@@ -1055,7 +1055,7 @@ void PrimaryLogPG::do_command(
     f->close_section();
 
     if (is_primary() && is_active() && m_scrubber) {
-      m_scrubber->dump_scrubber(f.get(), m_planned_scrub);
+      m_scrubber->dump_scrubber(f.get());
     }
 
     f->open_object_section("agent_state");
@@ -1185,7 +1185,7 @@ void PrimaryLogPG::do_command(
     if (is_primary()) {
       scrub_level_t deep = (prefix == "deep-scrub") ? scrub_level_t::deep
                                                    : scrub_level_t::shallow;
-      m_scrubber->on_operator_forced_scrub(f.get(), deep, m_planned_scrub);
+      m_scrubber->on_operator_forced_scrub(f.get(), deep);
     } else {
       ss << "Not primary";
       ret = -EPERM;
@@ -13226,7 +13226,7 @@ void PrimaryLogPG::_clear_recovery_state()
 #ifdef DEBUG_RECOVERY_OIDS
   recovering_oids.clear();
 #endif
-  dout(15) << __func__ << " flags: " << m_planned_scrub << dendl;
+  dout(15) << __func__ << dendl;
 
   last_backfill_started = hobject_t();
   set<hobject_t>::iterator i = backfills_in_flight.begin();
index 38cf4531135286d6b62e8dec80fbb2f9f9ea1b78..a0b3bc517a6e38c34d996b02008a59bb73816252 100644 (file)
@@ -59,14 +59,6 @@ ostream& operator<<(ostream& out, const scrub_flags_t& sf)
   return out;
 }
 
-ostream& operator<<(ostream& out, const requested_scrub_t& sf)
-{
-  if (sf.req_scrub)
-    out << " planned REQ_SCRUB";
-
-  return out;
-}
-
 void PgScrubber::on_replica_activate()
 {
   dout(10) << __func__ << dendl;
@@ -570,8 +562,7 @@ void PgScrubber::update_scrub_job(Scrub::delay_ready_t delay_ready)
 
 scrub_level_t PgScrubber::scrub_requested(
     scrub_level_t scrub_level,
-    scrub_type_t scrub_type,
-    requested_scrub_t& req_flags)
+    scrub_type_t scrub_type)
 {
   const bool repair_requested = (scrub_type == scrub_type_t::do_repair);
   const bool deep_requested =
@@ -579,11 +570,11 @@ scrub_level_t PgScrubber::scrub_requested(
   scrub_level = deep_requested ? scrub_level_t::deep : scrub_level_t::shallow;
   dout(10) << fmt::format(
                  "{}: {}{} scrub requested. "
-                 "@entry:{},last-stamp:{:s},Registered?{}",
+                 "@entry:last-stamp:{:s},Registered?{}",
                  __func__,
                  (scrub_type == scrub_type_t::do_repair ? "repair + "
                                                         : "not-repair + "),
-                 (deep_requested ? "deep" : "shallow"), req_flags,
+                 (deep_requested ? "deep" : "shallow"),
                  m_scrub_job->get_sched_time(), registration_state())
           << dendl;
 
@@ -597,11 +588,6 @@ scrub_level_t PgScrubber::scrub_requested(
     return scrub_level_t::shallow;
   }
 
-  // modifying the planned-scrub flags - to be removed shortly
-  // User might intervene, so clear this
-  req_flags.req_scrub = true;
-  dout(20) << fmt::format("{}: planned scrub:{}", __func__, req_flags) << dendl;
-
   // update the relevant SchedTarget (either shallow or deep). Set its urgency
   // to either operator_requested or must_repair. Push it into the queue
   auto& trgt = m_scrub_job->get_target(scrub_level);
@@ -790,10 +776,9 @@ void PgScrubber::on_operator_periodic_cmd(
 // when asked to force a high-priority scrub
 void PgScrubber::on_operator_forced_scrub(
     ceph::Formatter* f,
-    scrub_level_t scrub_level,
-    requested_scrub_t& request_flags)
+    scrub_level_t scrub_level)
 {
-  auto deep_req = scrub_requested(scrub_level, scrub_type_t::not_repair, request_flags);
+  auto deep_req = scrub_requested(scrub_level, scrub_type_t::not_repair);
   asok_response_section(f, false, deep_req);
 }
 
@@ -1878,8 +1863,6 @@ void PgScrubber::scrub_finish()
   ceph_assert(m_pg->is_locked());
   ceph_assert(is_queued_or_active());
 
-  m_planned_scrub = requested_scrub_t{};
-
   // if the repair request comes from auto-repair and large number of errors,
   // we would like to cancel auto-repair
   if (m_is_repair && m_flags.auto_repair &&
@@ -2125,9 +2108,8 @@ void PgScrubber::on_mid_scrub_abort(Scrub::delay_cause_t issue)
 
   dout(10) << fmt::format(
                  "{}: executing target: {}. Session flags: {} up-to-date job: "
-                 "{} planned: {}",
-                 __func__, *m_active_target, m_flags, *m_scrub_job,
-                 m_planned_scrub)
+                 "{}",
+                 __func__, *m_active_target, m_flags, *m_scrub_job)
           << dendl;
 
   // copy the aborted target
@@ -2220,8 +2202,7 @@ void PgScrubber::requeue_penalized(
 Scrub::schedule_result_t PgScrubber::start_scrub_session(
     scrub_level_t s_or_d,
     Scrub::OSDRestrictions osd_restrictions,
-    Scrub::ScrubPGPreconds pg_cond,
-    const requested_scrub_t& requested_flags)
+    Scrub::ScrubPGPreconds pg_cond)
 {
   auto& trgt = m_scrub_job->get_target(s_or_d);
   dout(10) << fmt::format(
@@ -2361,14 +2342,9 @@ Scrub::schedule_result_t PgScrubber::start_scrub_session(
 }
 
 
-/*
- * note that the flags-set fetched from the PG (m_pg->m_planned_scrub)
- * is cleared once scrubbing starts; Some of the values dumped here are
- * thus transitory.
- */
+///\todo modify the fields dumped here to match the new scrub-job structure
 void PgScrubber::dump_scrubber(
-    ceph::Formatter* f,
-    const requested_scrub_t& request_flags) const
+    ceph::Formatter* f) const
 {
   f->open_object_section("scrubber");
 
@@ -2546,7 +2522,6 @@ PgScrubber::PgScrubber(PG* pg)
     , m_pg_id{pg->pg_id}
     , m_osds{m_pg->osd}
     , m_pg_whoami{pg->pg_whoami}
-    , m_planned_scrub{pg->get_planned_scrub(ScrubberPasskey{})}
     , preemption_data{pg}
 {
   m_fsm = std::make_unique<ScrubMachine>(m_pg, this);
index f2bbf1f0e8855035fe34891936883b216dda3407..ff8c98d387ea2afb0e875901d158e0b7c28c638f 100644 (file)
@@ -209,8 +209,7 @@ class PgScrubber : public ScrubPgIF,
   Scrub::schedule_result_t start_scrub_session(
       scrub_level_t s_or_d,
       Scrub::OSDRestrictions osd_restrictions,
-      Scrub::ScrubPGPreconds pg_cond,
-      const requested_scrub_t& requested_flags) final;
+      Scrub::ScrubPGPreconds pg_cond) final;
 
   void initiate_regular_scrub(epoch_t epoch_queued) final;
 
@@ -281,8 +280,7 @@ class PgScrubber : public ScrubPgIF,
 
   scrub_level_t scrub_requested(
       scrub_level_t scrub_level,
-      scrub_type_t scrub_type,
-      requested_scrub_t& req_flags) final;
+      scrub_type_t scrub_type) final;
 
   /**
    * let the scrubber know that a recovery operation has completed.
@@ -311,11 +309,9 @@ class PgScrubber : public ScrubPgIF,
 
   void on_operator_forced_scrub(
     ceph::Formatter* f,
-    scrub_level_t scrub_level,
-    requested_scrub_t& request_flags) final;
+    scrub_level_t scrub_level) final;
 
-  void dump_scrubber(ceph::Formatter* f,
-                    const requested_scrub_t& request_flags) const final;
+  void dump_scrubber(ceph::Formatter* f) const final;
 
   // used if we are a replica
 
@@ -747,10 +743,6 @@ class PgScrubber : public ScrubPgIF,
 
   scrub_flags_t m_flags;
 
-  /// a reference to the details of the next scrub (as requested and managed by
-  /// the PG)
-  requested_scrub_t& m_planned_scrub;
-
   bool m_active{false};
 
   /**
index 2f476585116506642642732c5a9d5a5af18dfd95..d1a0fbdccb55f9e397cb5a44cbcff764bfc33431 100644 (file)
@@ -292,38 +292,6 @@ struct PgScrubBeListener {
 }  // namespace Scrub
 
 
-/**
- * Flags affecting the scheduling and behaviour of the *next* scrub.
- *
- * we hold two of these flag collections: one
- * for the next scrub, and one frozen at initiation (i.e. in pg::queue_scrub())
- */
-struct requested_scrub_t {
-  /**
-   * scrub must not be aborted.
-   * Set for explicitly requested scrubs, and for scrubs originated by the
-   * pairing process with the 'repair' flag set (in the RequestScrub event).
-   *
-   * Will be copied into the 'required' scrub flag upon scrub start.
-   */
-  bool req_scrub{false};
-};
-
-std::ostream& operator<<(std::ostream& out, const requested_scrub_t& sf);
-
-template <>
-struct fmt::formatter<requested_scrub_t> {
-  constexpr auto parse(format_parse_context& ctx) { return ctx.begin(); }
-
-  template <typename FormatContext>
-  auto format(const requested_scrub_t& rs, FormatContext& ctx) const
-  {
-    return fmt::format_to(ctx.out(),
-                          "(plnd:{})",
-                          rs.req_scrub ? " req_scrub" : "");
-  }
-};
-
 /**
  *  The interface used by the PG when requesting scrub-related info or services
  */
@@ -434,8 +402,7 @@ struct ScrubPgIF {
   virtual Scrub::schedule_result_t start_scrub_session(
       scrub_level_t s_or_d,
       Scrub::OSDRestrictions osd_restrictions,
-      Scrub::ScrubPGPreconds pg_cond,
-      const requested_scrub_t& requested_flags) = 0;
+      Scrub::ScrubPGPreconds pg_cond) = 0;
 
   virtual void set_op_parameters(Scrub::ScrubPGPreconds pg_cond) = 0;
 
@@ -465,11 +432,9 @@ struct ScrubPgIF {
   /// ... by requesting an "operator initiated" scrub
   virtual void on_operator_forced_scrub(
     ceph::Formatter* f,
-    scrub_level_t scrub_level,
-    requested_scrub_t& request_flags) = 0;
+    scrub_level_t scrub_level) = 0;
 
-  virtual void dump_scrubber(ceph::Formatter* f,
-                            const requested_scrub_t& request_flags) const = 0;
+  virtual void dump_scrubber(ceph::Formatter* f) const = 0;
 
   /**
    * Return true if soid is currently being scrubbed and pending IOs should
@@ -534,8 +499,7 @@ struct ScrubPgIF {
 
   virtual scrub_level_t scrub_requested(
       scrub_level_t scrub_level,
-      scrub_type_t scrub_type,
-      requested_scrub_t& req_flags) = 0;
+      scrub_type_t scrub_type) = 0;
 
   /**
    * let the scrubber know that a recovery operation has completed.