From: Ronen Friedman Date: Wed, 26 Jul 2023 12:56:33 +0000 (-0500) Subject: osd/scrub: reduce calls to on_scrub_schedule_input_change() X-Git-Tag: v19.0.0~612^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=aeaf429ce4ffea2557e548c07f7287d465b97e70;p=ceph-ci.git osd/scrub: reduce calls to on_scrub_schedule_input_change() 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 --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 488c22f0a2a..ded88f1d4c4 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -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 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: diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 1f09eabfef6..79758e22c3a 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -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) diff --git a/src/osd/PG.h b/src/osd/PG.h index 217ee1ad2ef..3cb22b73e53 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -682,7 +682,14 @@ public: std::vector& newup, int up_primary, std::vector& 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);