From: Ronen Friedman Date: Sun, 11 May 2025 05:24:33 +0000 (-0500) Subject: osd/scrub: remove the 'deadline' attribute from the scrub job X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=5f83bde31ebf51ab521a488444392d5ca05a09a0;p=ceph.git osd/scrub: remove the 'deadline' attribute from the scrub job The scrub job's 'overdue' attribute is no longer calculated - the only 'scrub is overdue' status remaining after latest scheduling refactor, is the one performed in PGMap.cc (the one affecting the 'health warning' status of the cluster). Thus - there is no longer any reason to maintain any 'deadline' attribute for the scrub scheduler. Signed-off-by: Ronen Friedman --- diff --git a/src/osd/scrubber/osd_scrub_sched.cc b/src/osd/scrubber/osd_scrub_sched.cc index 5b524139e0487..7ae42d0f8fed5 100644 --- a/src/osd/scrubber/osd_scrub_sched.cc +++ b/src/osd/scrubber/osd_scrub_sched.cc @@ -157,7 +157,6 @@ void ScrubQueue::dump_scrubs(ceph::Formatter* f) const f->dump_stream("pgid") << e.pgid; f->dump_stream("sched_time") << e.schedule.not_before; f->dump_stream("orig_sched_time") << e.schedule.scheduled_at; - f->dump_stream("deadline") << e.schedule.deadline; f->dump_bool( "forced", e.schedule.scheduled_at == PgScrubber::scrub_must_stamp()); @@ -167,7 +166,6 @@ void ScrubQueue::dump_scrubs(ceph::Formatter* f) const : "deep"); f->dump_stream("urgency") << fmt::format("{}", e.urgency); f->dump_bool("eligible", e.schedule.not_before <= query_time); - f->dump_bool("overdue", e.schedule.deadline < query_time); f->dump_stream("last_issue") << fmt::format("{}", e.last_issue); }, std::numeric_limits::max()); diff --git a/src/osd/scrubber/pg_scrubber.cc b/src/osd/scrubber/pg_scrubber.cc index 28e94e54631c3..e314a2238cfb1 100644 --- a/src/osd/scrubber/pg_scrubber.cc +++ b/src/osd/scrubber/pg_scrubber.cc @@ -686,42 +686,6 @@ Scrub::sched_conf_t PgScrubber::populate_config_params() const configs.deep_interval = deep_pool > 0.0 ? deep_pool : conf->osd_deep_scrub_interval; - /** - * 'max_shallow' is set to the maximum allowed delay between - * scrubs. This deadline has almost no effect on scrub scheduling - * (the only minor exception: when sorting two scrub jobs that are - * equivalent in all but the deadline). It will be removed in - * the next version. - * - * 'max_shallow' is controlled by a pool option and a configuration - * parameter. Note that if the value configured is less than the - * shallow interval (plus expenses), the max_shallow is disabled. - */ - auto max_shallow = pool_conf.value_or(pool_opts_t::SCRUB_MAX_INTERVAL, 0.0); - if (max_shallow <= 0.0) { - max_shallow = conf->osd_scrub_max_interval; - } - - if (max_shallow > 0.0) { - const auto min_accepted_deadline = - configs.shallow_interval * - (1 + conf->osd_scrub_interval_randomize_ratio); - - if (max_shallow >= min_accepted_deadline) { - configs.max_shallow = max_shallow; - } else { - // this is a bit odd, but the pool option is set to a value - // less than the interval. Keep the nullopt in max_shallow, - dout(10) << fmt::format( - "{}: configured 'max shallow' rejected as too low ({}/{} " - "< {})", - __func__, - pool_conf.value_or(pool_opts_t::SCRUB_MAX_INTERVAL, 0.0), - conf->osd_scrub_max_interval, min_accepted_deadline) - << dendl; - } - } - configs.interval_randomize_ratio = conf->osd_scrub_interval_randomize_ratio; configs.deep_randomize_ratio = conf.get_val("osd_deep_scrub_interval_cv"); @@ -2125,7 +2089,6 @@ void PgScrubber::on_mid_scrub_abort(Scrub::delay_cause_t issue) std::max(current_targ.urgency(), aborted_target.urgency()); curr_sched.scheduled_at = std::min(curr_sched.scheduled_at, abrt_sched.scheduled_at); - curr_sched.deadline = std::min(curr_sched.deadline, abrt_sched.deadline); curr_sched.not_before = std::min(curr_sched.not_before, abrt_sched.not_before); diff --git a/src/osd/scrubber/scrub_job.cc b/src/osd/scrubber/scrub_job.cc index 45b009c65e230..a5e870e3853f2 100644 --- a/src/osd/scrubber/scrub_job.cc +++ b/src/osd/scrubber/scrub_job.cc @@ -110,20 +110,13 @@ void ScrubJob::adjust_shallow_schedule( if (ScrubJob::requires_randomization(shallow_target.urgency())) { utime_t adj_not_before = last_scrub; utime_t adj_target = last_scrub; - sh_times.deadline = adj_target; // add a random delay to the proposed scheduled time adj_target += app_conf.shallow_interval; double r = rand() / (double)RAND_MAX; adj_target += - app_conf.shallow_interval * app_conf.interval_randomize_ratio * r; + app_conf.shallow_interval * app_conf.interval_randomize_ratio * r; - // the deadline can be updated directly into the scrub-job - if (app_conf.max_shallow) { - sh_times.deadline += *app_conf.max_shallow; - } else { - sh_times.deadline = utime_t::max(); - } if (adj_not_before < adj_target) { adj_not_before = adj_target; } @@ -132,16 +125,13 @@ void ScrubJob::adjust_shallow_schedule( } else { - // the target time is already set. Make sure to reset the n.b. and - // the (irrelevant) deadline + // the target time is already set. Make sure to reset the n.b. sh_times.not_before = sh_times.scheduled_at; - sh_times.deadline = utime_t::max(); } dout(10) << fmt::format( - "adjusted: nb:{:s} target:{:s} deadline:{:s} ({})", - sh_times.not_before, sh_times.scheduled_at, sh_times.deadline, - state_desc()) + "adjusted: nb:{:s} target:{:s} ({})", sh_times.not_before, + sh_times.scheduled_at, state_desc()) << dendl; } @@ -253,7 +243,6 @@ void ScrubJob::adjust_deep_schedule( << dendl; auto& dp_times = deep_target.sched_info.schedule; // shorthand - dp_times.deadline = utime_t::max(); // no 'max' for deep scrubs if (ScrubJob::requires_randomization(deep_target.urgency())) { utime_t adj_target = last_deep; @@ -369,7 +358,6 @@ void ScrubJob::dump(ceph::Formatter* f) const f->dump_stream("pgid") << pgid; f->dump_stream("sched_time") << get_sched_time(); f->dump_stream("orig_sched_time") << sch.scheduled_at; - f->dump_stream("deadline") << sch.deadline; f->dump_bool("forced", entry.urgency >= urgency_t::operator_requested); } diff --git a/src/osd/scrubber/scrub_job.h b/src/osd/scrubber/scrub_job.h index 935aa7135a857..062f747605c93 100644 --- a/src/osd/scrubber/scrub_job.h +++ b/src/osd/scrubber/scrub_job.h @@ -37,14 +37,6 @@ struct sched_conf_t { /// the desired interval between deep scrubs double deep_interval{0.0}; - /** - * the maximum interval between shallow scrubs, after which the - * (info-only) "overdue" field in the scheduler dump is set. - * Determined by either the pool or the cluster configuration. - * Empty if no limit is configured. - */ - std::optional max_shallow; - /** * interval_randomize_ratio * @@ -212,16 +204,15 @@ class ScrubJob { /** * Given a proposed time for the next scrub, and the relevant - * configuration, adjust_schedule() determines the actual target time, - * the deadline, and the 'not_before' time for the scrub. + * configuration, adjust_schedule() determines the actual target time + * and the 'not_before' time for the scrub. * The new values are updated into the scrub-job. * * Specifically: * - for high-priority scrubs: the 'not_before' is set to the * (untouched) proposed target time. * - for regular scrubs: the proposed time is adjusted (delayed) based - * on the configuration; the deadline is set further out (if configured) - * and the n.b. is reset to the target. + * on the configuration; the n.b. is reset to the target. */ void adjust_shallow_schedule( utime_t last_scrub, @@ -434,8 +425,8 @@ struct formatter { { return fmt::format_to( ctx.out(), - "periods:s:{}/{},d:{},iv-ratio:{},deep-rand:{},on-inv:{}", - cf.shallow_interval, cf.max_shallow.value_or(-1.0), cf.deep_interval, + "periods:s:{},d:{},iv-ratio:{},deep-rand:{},on-inv:{}", + cf.shallow_interval, cf.deep_interval, cf.interval_randomize_ratio, cf.deep_randomize_ratio, cf.mandatory_on_invalid); } diff --git a/src/osd/scrubber/scrub_queue_entry.h b/src/osd/scrubber/scrub_queue_entry.h index 4cca192431ec3..88af31a0ad1a9 100644 --- a/src/osd/scrubber/scrub_queue_entry.h +++ b/src/osd/scrubber/scrub_queue_entry.h @@ -60,7 +60,7 @@ enum class urgency_t { * a specific scrub level. Namely - it identifies the [pg,level] combination, * the 'urgency' attribute of the scheduled scrub (which determines most of * its behavior and scheduling decisions) and the actual time attributes - * for scheduling (target, deadline, not_before). + * for scheduling (target time & not_before). */ struct SchedEntry { constexpr SchedEntry(spg_t pgid, scrub_level_t level) @@ -78,7 +78,7 @@ struct SchedEntry { urgency_t urgency{urgency_t::periodic_regular}; - /// scheduled_at, not-before & the deadline times + /// scheduled_at and not-before times Scrub::scrub_schedule_t schedule; /// either 'none', or the reason for the latest failure/delay (for @@ -211,9 +211,9 @@ struct formatter { auto format(const Scrub::SchedEntry& st, FormatContext& ctx) const { return fmt::format_to( - ctx.out(), "{}/{},nb:{:s},({},tr:{:s},dl:{:s})", st.pgid, + ctx.out(), "{}/{},nb:{:s},({},tr:{:s})", st.pgid, (st.level == scrub_level_t::deep ? "dp" : "sh"), st.schedule.not_before, - st.urgency, st.schedule.scheduled_at, st.schedule.deadline); + st.urgency, st.schedule.scheduled_at); } }; } // namespace fmt diff --git a/src/osd/scrubber_common.h b/src/osd/scrubber_common.h index ab8a45044fef7..d4acb840d7fd6 100644 --- a/src/osd/scrubber_common.h +++ b/src/osd/scrubber_common.h @@ -124,7 +124,7 @@ enum class schedule_result_t { }; /// a collection of the basic scheduling information of a scrub target: -/// target time to scrub, the 'not before' time, and a deadline. +/// target time to scrub, and the 'not before'. struct scrub_schedule_t { /** * the time at which we are allowed to start the scrub. Never @@ -132,18 +132,6 @@ struct scrub_schedule_t { */ utime_t not_before{utime_t::max()}; - /** - * the 'deadline' is the time by which we expect the periodic scrub to - * complete. It is determined by the SCRUB_MAX_INTERVAL pool configuration - * and by osd_scrub_max_interval; - * Note: the 'deadline' has only a limited effect on scheduling: when - * comparing jobs having identical urgency and target time (scheduled_at'), - * the job with the earlier 'deadline' is preferred. - * Being past deadline also sets the 'overdue' flag in scrub - * scheduling dumps. - */ - utime_t deadline{utime_t::max()}; - /** * the 'scheduled_at' is the time at which we intended the scrub to be scheduled. * For periodic (regular) scrubs, it is set to the time of the last scrub @@ -161,12 +149,9 @@ struct scrub_schedule_t { { // when compared - the 'not_before' is ignored, assuming // we never compare jobs with different eligibility status. - auto cmp1 = scheduled_at <=> rhs.scheduled_at; - if (cmp1 != 0) { - return cmp1; - } - return deadline <=> rhs.deadline; + return scheduled_at <=> rhs.scheduled_at; }; + bool operator==(const scrub_schedule_t& rhs) const = default; }; @@ -191,8 +176,7 @@ struct formatter { constexpr auto parse(format_parse_context& ctx) { return ctx.begin(); } template - auto format(const Scrub::OSDRestrictions& conds, FormatContext& ctx) const - { + auto format(const Scrub::OSDRestrictions& conds, FormatContext& ctx) const { return fmt::format_to( ctx.out(), "<{}.{}.{}.{}.{}>", conds.max_concurrency_reached ? "max-scrubs" : "", @@ -207,11 +191,9 @@ template <> struct formatter { constexpr auto parse(format_parse_context& ctx) { return ctx.begin(); } template - auto format(const Scrub::scrub_schedule_t& sc, FormatContext& ctx) const - { + auto format(const Scrub::scrub_schedule_t& sc, FormatContext& ctx) const { return fmt::format_to( - ctx.out(), "nb:{:s}(at:{:s},dl:{:s})", sc.not_before, - sc.scheduled_at, sc.deadline); + ctx.out(), "nb:{:s}(at:{:s})", sc.not_before, sc.scheduled_at); } };