diff options
author | Ronen Friedman <rfriedma@redhat.com> | 2023-12-31 17:18:09 +0100 |
---|---|---|
committer | Ronen Friedman <rfriedma@redhat.com> | 2024-01-22 14:25:25 +0100 |
commit | d294ea80cc018dc3f893fcb2c4df9a1ad8bb6a04 (patch) | |
tree | 4b3533266a9e8206b72e3f71a571644cfd0fc08e /src/osd/scrubber/scrub_job.h | |
parent | osd/scrub: remove the 'penalized jobs' queue (diff) | |
download | ceph-d294ea80cc018dc3f893fcb2c4df9a1ad8bb6a04.tar.xz ceph-d294ea80cc018dc3f893fcb2c4df9a1ad8bb6a04.zip |
osd/scrub: introduce a 'not before' attribute for scrub jobs
The NB enables the OSD to delay the next attempt to schedule a specific
scrub job. This is useful for jobs that have failed for whatever
reason, especially if the primary has failed to acquire the replicas.
Signed-off-by: Ronen Friedman <rfriedma@redhat.com>
Diffstat (limited to '')
-rw-r--r-- | src/osd/scrubber/scrub_job.h | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/osd/scrubber/scrub_job.h b/src/osd/scrubber/scrub_job.h index b75141ea179..e6765c767b9 100644 --- a/src/osd/scrubber/scrub_job.h +++ b/src/osd/scrubber/scrub_job.h @@ -38,6 +38,7 @@ enum class qu_state_t { struct scrub_schedule_t { utime_t scheduled_at{}; utime_t deadline{0, 0}; + utime_t not_before{utime_t::max()}; }; struct sched_params_t { @@ -66,7 +67,7 @@ class ScrubJob final : public RefCountedObject { /** * the old 'is_registered'. Set whenever the job is registered with the OSD, - * i.e. is in either the 'to_scrub' or the 'penalized' vectors. + * i.e. is in 'to_scrub'. */ std::atomic_bool in_queues{false}; @@ -93,7 +94,7 @@ class ScrubJob final : public RefCountedObject { ScrubJob(CephContext* cct, const spg_t& pg, int node_id); - utime_t get_sched_time() const { return schedule.scheduled_at; } + utime_t get_sched_time() const { return schedule.not_before; } static std::string_view qu_state_text(qu_state_t st); @@ -107,7 +108,15 @@ class ScrubJob final : public RefCountedObject { return qu_state_text(state.load(std::memory_order_relaxed)); } - void update_schedule(const scrub_schedule_t& adjusted); + /** + * 'reset_failure_penalty' is used to reset the 'not_before' jo attribute to + * the updated 'scheduled_at' time. This is used whenever the scrub-job + * schedule is updated, and the update is not a result of a scrub attempt + * failure. + */ + void update_schedule( + const scrub_schedule_t& adjusted, + bool reset_failure_penalty); void dump(ceph::Formatter* f) const; @@ -227,9 +236,9 @@ struct formatter<Scrub::ScrubJob> { { return fmt::format_to( ctx.out(), - "pg[{}] @ {:s} (dl:{:s}) - <{}> / failure: {} / queue state: " + "pg[{}] @ {:s} ({:s}) (dl:{:s}) - <{}> / failure: {} / queue state: " "{:.7}", - sjob.pgid, sjob.schedule.scheduled_at, + sjob.pgid, sjob.schedule.not_before, sjob.schedule.scheduled_at, sjob.schedule.deadline, sjob.registration_state(), sjob.resources_failure, sjob.state.load(std::memory_order_relaxed)); } |