// ////////////////////////////////////////////////////////////////////////// //
// forwarders to the queue
-Scrub::sched_params_t OsdScrub::determine_scrub_time(
- const requested_scrub_t& request_flags,
- const pg_info_t& pg_info,
- const pool_opts_t& pool_conf) const
-{
- return m_queue.determine_scrub_time(request_flags, pg_info, pool_conf);
-}
-
void OsdScrub::update_job(
Scrub::ScrubJobRef sjob,
const Scrub::sched_params_t& suggested,
void mark_pg_scrub_blocked(spg_t blocked_pg);
void clear_pg_scrub_blocked(spg_t blocked_pg);
- // updating scheduling information for a specific PG
- Scrub::sched_params_t determine_scrub_time(
- const requested_scrub_t& request_flags,
- const pg_info_t& pg_info,
- const pool_opts_t& pool_conf) const;
-
/**
* modify a scrub-job's scheduled time and deadline
*
}
-sched_params_t ScrubQueue::determine_scrub_time(
- const requested_scrub_t& request_flags,
- const pg_info_t& pg_info,
- const pool_opts_t& pool_conf) const
-{
- sched_params_t res;
-
- if (request_flags.must_scrub || request_flags.need_auto) {
-
- // Set the smallest time that isn't utime_t()
- res.proposed_time = PgScrubber::scrub_must_stamp();
- res.is_must = Scrub::must_scrub_t::mandatory;
- // we do not need the interval data in this case
-
- } else if (pg_info.stats.stats_invalid && conf()->osd_scrub_invalid_stats) {
- res.proposed_time = time_now();
- res.is_must = Scrub::must_scrub_t::mandatory;
-
- } else {
- res.proposed_time = pg_info.history.last_scrub_stamp;
- res.min_interval = pool_conf.value_or(pool_opts_t::SCRUB_MIN_INTERVAL, 0.0);
- res.max_interval = pool_conf.value_or(pool_opts_t::SCRUB_MAX_INTERVAL, 0.0);
- }
-
- dout(15) << fmt::format(
- "suggested: {:s} hist: {:s} v:{}/{} must:{} pool-min:{} {}",
- res.proposed_time, pg_info.history.last_scrub_stamp,
- (bool)pg_info.stats.stats_invalid,
- conf()->osd_scrub_invalid_stats,
- (res.is_must == must_scrub_t::mandatory ? "y" : "n"),
- res.min_interval, request_flags)
- << dendl;
- return res;
-}
-
-
std::vector<ScrubTargetId> ScrubQueue::ready_to_scrub(
OSDRestrictions restrictions, // note: 4B in size! (copy)
utime_t scrub_tick)
Scrub::delay_cause_t delay_cause,
utime_t now_is);
- sched_params_t determine_scrub_time(const requested_scrub_t& request_flags,
- const pg_info_t& pg_info,
- const pool_opts_t& pool_conf) const;
-
std::ostream& gen_prefix(std::ostream& out, std::string_view fn) const;
public:
}
}
+sched_params_t PgScrubber::determine_scrub_time(
+ const pool_opts_t& pool_conf) const
+{
+ sched_params_t res;
+
+ if (m_planned_scrub.must_scrub || m_planned_scrub.need_auto) {
+
+ // Set the smallest time that isn't utime_t()
+ res.proposed_time = PgScrubber::scrub_must_stamp();
+ res.is_must = Scrub::must_scrub_t::mandatory;
+ // we do not need the interval data in this case
+
+ } else if (
+ m_pg->info.stats.stats_invalid &&
+ get_pg_cct()->_conf->osd_scrub_invalid_stats) {
+ res.proposed_time = ceph_clock_now();
+ res.is_must = Scrub::must_scrub_t::mandatory;
+
+ } else {
+ res.proposed_time = m_pg->info.history.last_scrub_stamp;
+ res.min_interval = pool_conf.value_or(pool_opts_t::SCRUB_MIN_INTERVAL, 0.0);
+ res.max_interval = pool_conf.value_or(pool_opts_t::SCRUB_MAX_INTERVAL, 0.0);
+ }
+
+ dout(15)
+ << fmt::format(
+ "{}: suggested: {:s} hist: {:s} v:{}/{} must:{} pool-min:{} {}",
+ __func__, res.proposed_time, m_pg->info.history.last_scrub_stamp,
+ (bool)m_pg->info.stats.stats_invalid,
+ get_pg_cct()->_conf->osd_scrub_invalid_stats,
+ (res.is_must == must_scrub_t::mandatory ? "y" : "n"),
+ res.min_interval, m_planned_scrub)
+ << dendl;
+ return res;
+}
+
+
/*
* Note: referring to m_planned_scrub here is temporary, as this set of
* scheduling flags will be removed in a followup PR.
auto pre_state = m_scrub_job->state_desc();
auto pre_reg = registration_state();
- auto suggested = m_osds->get_scrub_services().determine_scrub_time(
- m_planned_scrub, m_pg->info, m_pg->get_pgpool().info.opts);
+ auto suggested = determine_scrub_time(m_pg->get_pgpool().info.opts);
m_osds->get_scrub_services().register_with_osd(m_scrub_job, suggested);
dout(10) << fmt::format(
if (is_primary() && m_scrub_job) {
ceph_assert(m_pg->is_locked());
- auto suggested = m_osds->get_scrub_services().determine_scrub_time(
- request_flags, m_pg->info, m_pg->get_pgpool().info.opts);
+ auto suggested = determine_scrub_time(m_pg->get_pgpool().info.opts);
m_osds->get_scrub_services().update_job(m_scrub_job, suggested, true);
m_pg->publish_stats_to_osd();
}
*/
Scrub::sched_conf_t populate_config_params() const;
+ /**
+ * determine the time when the next scrub should be scheduled
+ *
+ * based on the planned scrub's flags, time of last scrub, and
+ * the pool's scrub configuration.
+ */
+ Scrub::sched_params_t determine_scrub_time(
+ const pool_opts_t& pool_conf) const;
+
/*
* Select a range of objects to scrub.
*