return info.history.last_deep_scrub_stamp + deep_scrub_interval;
}
-void PG::on_scrub_schedule_input_change()
+void PG::on_scrub_schedule_input_change(Scrub::delay_ready_t delay_ready)
{
if (is_active() && is_primary()) {
- dout(20) << __func__ << ": active/primary" << dendl;
+ dout(10) << fmt::format(
+ "{}: active/primary. delay_ready={:c}", __func__,
+ (delay_ready == Scrub::delay_ready_t::delay_ready) ? 't'
+ : 'f')
+ << dendl;
ceph_assert(m_scrubber);
- m_scrubber->update_scrub_job(m_planned_scrub);
+ m_scrubber->update_scrub_job(delay_ready);
} else {
- dout(20) << __func__ << ": inactive or non-primary" << dendl;
+ dout(10) << fmt::format("{}: inactive or non-primary", __func__) << dendl;
}
}
// 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();
+ on_scrub_schedule_input_change(Scrub::delay_ready_t::delay_ready);
}
}
set_last_scrub_stamp(t, history, stats);
return true;
});
- on_scrub_schedule_input_change();
+ on_scrub_schedule_input_change(Scrub::delay_ready_t::delay_ready);
}
static void set_last_deep_scrub_stamp(
set_last_scrub_stamp(t, history, stats);
return true;
});
- on_scrub_schedule_input_change();
+ on_scrub_schedule_input_change(Scrub::delay_ready_t::delay_ready);
}
static void add_objects_scrubbed_count(
* - pg stat scrub timestamps
* - etc
*/
- void on_scrub_schedule_input_change();
+ void on_scrub_schedule_input_change(Scrub::delay_ready_t delay_ready);
void scrub_requested(scrub_level_t scrub_level, scrub_type_t scrub_type) override;
"updating scrub schedule on {}",
(locked_pg->pg())->get_pgid())
<< dendl;
- locked_pg->pg()->on_scrub_schedule_input_change();
+ locked_pg->pg()->on_scrub_schedule_input_change(
+ Scrub::delay_ready_t::no_delay);
}
}
* guarantees that the PG is locked and the interval is still the same.
* - in the 2nd case - we know the PG state and we know we are only called
* for a Primary.
-*/
-void PgScrubber::update_scrub_job(const requested_scrub_t& request_flags)
+ */
+void PgScrubber::update_scrub_job(Scrub::delay_ready_t delay_ready)
{
if (!is_primary() || !m_scrub_job) {
dout(10) << fmt::format(
- "{}: pg[{}]: not Primary or no scrub-job", __func__,
+ "{}: PG[{}]: not Primary or no scrub-job", __func__,
m_pg_id)
<< dendl;
return;
}
dout(15) << fmt::format(
- "{}: flags:<{}> job on entry:{}", __func__, request_flags,
+ "{}: flags:<{}> job on entry:{}", __func__, m_planned_scrub,
*m_scrub_job)
<< dendl;
if (m_scrub_job->target_queued) {
<< dendl;
}
-
ceph_assert(m_pg->is_locked());
const auto applicable_conf = populate_config_params();
const auto scrub_clock_now = ceph_clock_now();
m_scrub_job->target_queued = true;
m_pg->publish_stats_to_osd();
- dout(15) << fmt::format(
- "{}: flags:<{}> job on exit:{}", __func__, request_flags,
- *m_scrub_job)
- << dendl;
+ dout(10) << fmt::format(
+ "{}: flags:<{}> job on exit:{}", __func__, m_planned_scrub,
+ *m_scrub_job)
+ << dendl;
}
scrub_level_t PgScrubber::scrub_requested(
req_flags.req_scrub = true;
dout(20) << fmt::format("{}: planned scrub:{}", __func__, req_flags) << dendl;
- update_scrub_job(req_flags);
+ update_scrub_job(delay_ready_t::no_delay);
return deep_requested ? scrub_level_t::deep : scrub_level_t::shallow;
}
dout(10) << __func__ << " flags: " << request_flags << dendl;
request_flags.need_auto = true;
- update_scrub_job(request_flags);
+ update_scrub_job(delay_ready_t::no_delay);
}
bool PgScrubber::reserve_local()
configs.deep_randomize_ratio = conf->osd_deep_scrub_randomize_ratio;
configs.mandatory_on_invalid = conf->osd_scrub_invalid_stats;
- dout(15) << fmt::format("updated config:{}", configs) << dendl;
+ dout(15) << fmt::format("{}: updated config:{}", __func__, configs) << dendl;
return configs;
}
int tr = m_osds->store->queue_transaction(m_pg->ch, std::move(t), nullptr);
ceph_assert(tr == 0);
}
- update_scrub_job(m_planned_scrub);
+
+ // determine the next scrub time
+ update_scrub_job(delay_ready_t::delay_ready);
if (has_error) {
m_pg->queue_peering_event(PGPeeringEventRef(
// managing scrub op registration
- void update_scrub_job(const requested_scrub_t& request_flags) final;
+ void update_scrub_job(Scrub::delay_ready_t delay_ready) final;
void rm_from_osd_scrubbing() final;
target_specific_failure, // failed to scrub this specific target
osd_wide_failure // failed to scrub any target
};
+
+/// rescheduling param: should we delay jobs already ready to execute?
+enum class delay_ready_t : bool { delay_ready = true, no_delay = false };
+
} // namespace Scrub
namespace fmt {
* This function assumes that the queue registration status is up-to-date,
* i.e. the OSD "knows our name" if-f we are the Primary.
*/
- virtual void update_scrub_job(const requested_scrub_t& request_flags) = 0;
+ virtual void update_scrub_job(Scrub::delay_ready_t delay_ready) = 0;
/**
* route incoming replica-reservations requests/responses to the