]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
osd/scrub: reduce calls to on_scrub_schedule_input_change()
authorRonen Friedman <rfriedma@redhat.com>
Wed, 26 Jul 2023 12:56:33 +0000 (07:56 -0500)
committerRonen Friedman <rfriedma@redhat.com>
Thu, 3 Aug 2023 06:19:31 +0000 (09:19 +0300)
PG::handle_activate_map() modified to accept the range of
epochs since its last invocation. A possible scrub-related
parameters change will only be handled if the lastest pool
info change was within that range.

Signed-off-by: Ronen Friedman <rfriedma@redhat.com>
src/osd/OSD.cc
src/osd/PG.cc
src/osd/PG.h

index 488c22f0a2ad18a7350adaf2b79ad9b1a9fcca62..ded88f1d4c45068598a786a90908ccccc52078f1 100644 (file)
@@ -5317,7 +5317,7 @@ PGRef OSD::handle_pg_create_info(const OSDMapRef& osdmap,
   }
 
   pg->handle_initialize(rctx);
-  pg->handle_activate_map(rctx);
+  pg->handle_activate_map(rctx, startmap->get_epoch());
 
   dispatch_context(rctx, pg.get(), osdmap, nullptr);
 
@@ -8725,10 +8725,11 @@ bool OSD::advance_pg(
   OSDMapRef lastmap = pg->get_osdmap();
   set<PGRef> new_pgs;  // any split children
   bool ret = true;
+  auto first_new_epoch = pg->get_osdmap_epoch() + 1;
 
   unsigned old_pg_num = lastmap->have_pg_pool(pg->pg_id.pool()) ?
     lastmap->get_pg_num(pg->pg_id.pool()) : 0;
-  for (epoch_t next_epoch = pg->get_osdmap_epoch() + 1;
+  for (epoch_t next_epoch = first_new_epoch;
        next_epoch <= osd_epoch;
        ++next_epoch) {
     OSDMapRef nextmap = service.try_get_map(next_epoch);
@@ -8901,7 +8902,7 @@ bool OSD::advance_pg(
     old_pg_num = new_pg_num;
     handle.reset_tp_timeout();
   }
-  pg->handle_activate_map(rctx);
+  pg->handle_activate_map(rctx, first_new_epoch);
 
   ret = true;
  out:
index 1f09eabfef6ad53d27cbd523bc8c3301012cd410..79758e22c3af084316f40c9e7f225992bfa2b9b2 100644 (file)
@@ -2564,16 +2564,20 @@ void PG::handle_advance_map(
     rctx);
 }
 
-void PG::handle_activate_map(PeeringCtx &rctx)
+void PG::handle_activate_map(PeeringCtx &rctx, epoch_t range_starts_at)
 {
-  dout(10) << __func__ << ": " << get_osdmap()->get_epoch()
-          << dendl;
+  dout(10) << fmt::format("{}: epoch range: {}..{}", __func__, range_starts_at,
+                          get_osdmap()->get_epoch())
+           << dendl;
   recovery_state.activate_map(rctx);
-
   requeue_map_waiters();
 
-  // pool options affecting scrub may have changed
-  on_scrub_schedule_input_change();
+  // If pool.info changed during this sequence of map updates, invoke
+  // on_scrub_schedule_input_change() as pool.info contains scrub scheduling
+  // parameters.
+  if (pool.info.last_change >= range_starts_at) {
+    on_scrub_schedule_input_change();
+  }
 }
 
 void PG::handle_initialize(PeeringCtx &rctx)
index 217ee1ad2ef05f9a7051f65f0bfa263f894702cd..3cb22b73e534d18721ce79f890f0565c119b4cdb 100644 (file)
@@ -682,7 +682,14 @@ public:
     std::vector<int>& newup, int up_primary,
     std::vector<int>& newacting, int acting_primary,
     PeeringCtx &rctx);
-  void handle_activate_map(PeeringCtx &rctx);
+
+  /**
+   *  \note: handle_activate_map() is not guaranteed to be called for
+   *  each epoch in sequence. Thus we supply it with the full range of
+   *  epochs that were skipped.
+   */
+  void handle_activate_map(PeeringCtx &rctx, epoch_t range_starts_at);
+
   void handle_initialize(PeeringCtx &rxcx);
   void handle_query_state(ceph::Formatter *f);