return info.history.last_deep_scrub_stamp + deep_scrub_interval;
}
-void PG::on_scrub_schedule_input_change(Scrub::delay_ready_t delay_ready)
+void PG::on_scrub_schedule_input_change()
{
if (is_active() && is_primary() && !is_scrub_queued_or_active()) {
- dout(10) << fmt::format(
- "{}: active/primary. delay_ready={:c}", __func__,
- (delay_ready == Scrub::delay_ready_t::delay_ready) ? 't'
- : 'f')
- << dendl;
+ dout(10) << fmt::format("{}: active/primary", __func__) << dendl;
ceph_assert(m_scrubber);
- m_scrubber->update_scrub_job(delay_ready);
+ m_scrubber->update_scrub_job();
} else {
dout(10) << fmt::format(
"{}: inactive, non-primary - or already scrubbing",
// 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(Scrub::delay_ready_t::delay_ready);
+ on_scrub_schedule_input_change();
}
}
// the next periodic scrubs:
m_scrub_job->adjust_shallow_schedule(
- m_pg->info.history.last_scrub_stamp, applicable_conf, scrub_clock_now,
- delay_ready_t::delay_ready);
+ m_pg->info.history.last_scrub_stamp, applicable_conf, scrub_clock_now);
m_scrub_job->adjust_deep_schedule(
m_pg->info.history.last_deep_scrub_stamp, applicable_conf,
- scrub_clock_now, delay_ready_t::delay_ready);
+ scrub_clock_now);
dout(10) << fmt::format("{}: adjusted:{}", __func__, *m_scrub_job) << dendl;
}
"{}: state at entry: {}", __func__, m_scrub_job->state_desc())
<< dendl;
m_scrub_job->registered = true;
- update_scrub_job(delay_ready_t::delay_ready);
+ update_scrub_job();
}
* - in the 2nd case - we know the PG state and we know we are only called
* for a Primary.
*/
-void PgScrubber::update_scrub_job(Scrub::delay_ready_t delay_ready)
+void PgScrubber::update_scrub_job()
{
if (!is_primary() || !m_scrub_job) {
dout(10) << fmt::format(
request_rescrubbing();
}
// determine the next scrub time
- update_scrub_job(delay_ready_t::delay_ready);
+ update_scrub_job();
if (m_pg->is_active() && m_pg->is_primary()) {
m_pg->recovery_state.share_pg_info();
using sched_conf_t = Scrub::sched_conf_t;
using scrub_schedule_t = Scrub::scrub_schedule_t;
using ScrubJob = Scrub::ScrubJob;
-using delay_ready_t = Scrub::delay_ready_t;
using namespace std::chrono;
using SchedEntry = Scrub::SchedEntry;
void ScrubJob::adjust_shallow_schedule(
utime_t last_scrub,
const Scrub::sched_conf_t& app_conf,
- utime_t scrub_clock_now,
- delay_ready_t modify_ready_targets)
+ utime_t scrub_clock_now)
{
dout(10) << fmt::format(
- "at entry: shallow target:{}, conf:{}, last-stamp:{:s} "
- "also-ready?{:c}",
- shallow_target, app_conf, last_scrub,
- (modify_ready_targets == delay_ready_t::delay_ready) ? 'y'
- : 'n')
+ "at entry: shallow target:{}, conf:{}, last-stamp:{:s}",
+ shallow_target, app_conf, last_scrub)
<< dendl;
auto& sh_times = shallow_target.sched_info.schedule; // shorthand
utime_t adj_target = last_scrub;
sh_times.deadline = adj_target;
- // add a random delay to the proposed scheduled time - but only for periodic
- // scrubs that are not already eligible for scrubbing.
- if ((modify_ready_targets == delay_ready_t::delay_ready) ||
- adj_not_before > scrub_clock_now) {
- adj_target += app_conf.shallow_interval;
- double r = rand() / (double)RAND_MAX;
- 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;
- }
// the deadline can be updated directly into the scrub-job
if (app_conf.max_shallow) {
void ScrubJob::adjust_deep_schedule(
utime_t last_deep,
const Scrub::sched_conf_t& app_conf,
- utime_t scrub_clock_now,
- delay_ready_t modify_ready_targets)
+ utime_t scrub_clock_now)
{
dout(10) << fmt::format(
- "at entry: deep target:{}, conf:{}, last-stamp:{:s} "
- "also-ready?{:c}",
- deep_target, app_conf, last_deep,
- (modify_ready_targets == delay_ready_t::delay_ready) ? 'y'
- : 'n')
+ "at entry: deep target:{}, conf:{}, last-stamp:{:s}",
+ deep_target, app_conf, last_deep)
<< dendl;
auto& dp_times = deep_target.sched_info.schedule; // shorthand
utime_t adj_target = last_deep;
dp_times.deadline = adj_target;
- // add a random delay to the proposed scheduled time - but only for periodic
- // scrubs that are not already eligible for scrubbing.
- if ((modify_ready_targets == delay_ready_t::delay_ready) ||
- adj_not_before > scrub_clock_now) {
- double sdv = app_conf.deep_interval * app_conf.deep_randomize_ratio;
- std::normal_distribution<double> normal_dist{app_conf.deep_interval, sdv};
- auto next_delay = std::clamp(
- normal_dist(random_gen), app_conf.deep_interval - 2 * sdv,
- app_conf.deep_interval + 2 * sdv);
- adj_target += next_delay;
- dout(20) << fmt::format(
- "deep scrubbing: next_delay={:.0f} (interval={:.0f}, "
- "ratio={:.3f}), adjusted:{:s}",
- next_delay, app_conf.deep_interval,
- app_conf.deep_randomize_ratio, adj_target)
- << dendl;
- }
+ // add a random delay to the proposed scheduled time
+ const double sdv = app_conf.deep_interval * app_conf.deep_randomize_ratio;
+ std::normal_distribution<double> normal_dist{app_conf.deep_interval, sdv};
+ auto next_delay =
+ std::clamp(normal_dist(random_gen), app_conf.deep_interval - 2 * sdv,
+ app_conf.deep_interval + 2 * sdv);
+ adj_target += next_delay;
+ dout(20) << fmt::format(
+ "deep scrubbing: next_delay={:.0f} (interval={:.0f}, "
+ "ratio={:.3f}), adjusted:{:s}",
+ next_delay, app_conf.deep_interval,
+ app_conf.deep_randomize_ratio, adj_target)
+ << dendl;
// the deadline can be updated directly into the scrub-job
if (app_conf.max_shallow) {