ostream& operator<<(ostream& out, const requested_scrub_t& sf)
{
- if (sf.auto_repair)
- out << " planned AUTO_REPAIR";
- if (sf.need_auto)
- out << " NEED_AUTO";
if (sf.req_scrub)
out << " planned REQ_SCRUB";
* Note that no need to requeue the target, as it will be requeued
* when the scrub ends.
*/
-void PgScrubber::request_rescrubbing(requested_scrub_t& request_flags)
+void PgScrubber::request_rescrubbing()
{
- dout(10) << __func__ << " flags: " << request_flags << dendl;
-
- request_flags.need_auto = true;
+ dout(10) << fmt::format("{}: job on entry: {}", __func__, *m_scrub_job)
+ << dendl;
auto& trgt = m_scrub_job->get_target(scrub_level_t::deep);
trgt.up_urgency_to(urgency_t::repairing);
const auto clock_now = ceph_clock_now();
cost);
}
-void PgScrubber::set_op_parameters(
- ScrubPGPreconds pg_cond,
- const requested_scrub_t& request)
+void PgScrubber::set_op_parameters(ScrubPGPreconds pg_cond)
{
- dout(10) << fmt::format("{}: @ input: {}", __func__, request) << dendl;
+ dout(10) << fmt::format("{}: target: {}", __func__, *m_active_target)
+ << dendl;
- set_queued_or_active(); // we are fully committed now.
+ set_queued_or_active(); // we are fully committed now.
// write down the epoch of starting a new scrub. Will be used
// to discard stale messages from previous aborted scrubs.
m_epoch_start = m_pg->get_osdmap_epoch();
- m_flags.check_repair = m_active_target->urgency() == urgency_t::after_repair;
- m_flags.auto_repair = false;
- if (ScrubJob::has_high_queue_priority(m_active_target->urgency())) {
- // specific high priority scrubs - high queue priority
- /// \todo consider - do we really want high queue priority for any scrub?
- m_flags.priority = get_pg_cct()->_conf->osd_requested_scrub_priority;
- } else {
- // regular, low-priority scrubs - low queue priority - unless blocking
- // client I/O
- m_flags.priority = m_pg->get_scrub_priority();
- }
+ // set the session attributes, as coded in m_flags, m_is_deep and m_is_repair
- // 'deep-on-error' is set for periodic shallow scrubs, if allowed
- // by the environment
- if (m_active_target->is_shallow() && pg_cond.can_autorepair &&
- m_active_target->urgency() == urgency_t::periodic_regular) {
- m_flags.deep_scrub_on_error = true;
- dout(10) << fmt::format(
- "{}: auto repair with scrubbing, rescrub if errors found",
- __func__)
- << dendl;
- }
+ m_flags.check_repair = m_active_target->urgency() == urgency_t::after_repair;
+ m_is_deep = m_active_target->sched_info.level == scrub_level_t::deep;
state_set(PG_STATE_SCRUBBING);
-
- // will we be deep-scrubbing?
- m_is_deep = m_active_target->sched_info.level == scrub_level_t::deep;
if (m_is_deep) {
state_set(PG_STATE_DEEP_SCRUB);
- if (pg_cond.can_autorepair || request.auto_repair) {
- m_flags.auto_repair = true;
- }
}
+ m_flags.auto_repair = m_is_deep && pg_cond.can_autorepair;
+
// m_is_repair is set for all repair cases - for operator-requested
// repairs, for deep-scrubs initiated automatically after a shallow scrub
// that has ended with repairable error, and for 'repair-on-the-go' (i.e.
update_op_mode_text();
}
+
+ // 'deep-on-error' is set for periodic shallow scrubs, if allowed
+ // by the environment
+ if (!m_is_deep && pg_cond.can_autorepair &&
+ m_active_target->urgency() == urgency_t::periodic_regular) {
+ m_flags.deep_scrub_on_error = true;
+ dout(10) << fmt::format(
+ "{}: auto repair with scrubbing, rescrub if errors found",
+ __func__)
+ << dendl;
+ } else {
+ m_flags.deep_scrub_on_error = false;
+ }
+
+ if (ScrubJob::has_high_queue_priority(m_active_target->urgency())) {
+ // specific high priority scrubs - high queue priority
+ /// \todo consider - do we really want high queue priority for any scrub?
+ m_flags.priority = get_pg_cct()->_conf->osd_requested_scrub_priority;
+ } else {
+ // regular, low-priority scrubs - low queue priority - unless blocking
+ // client I/O
+ m_flags.priority = m_pg->get_scrub_priority();
+ }
+
// The publishing here is required for tests synchronization.
// The PG state flags were modified.
m_pg->publish_stats_to_osd();
cleanup_on_finish();
if (do_auto_scrub) {
- request_rescrubbing(m_planned_scrub);
+ request_rescrubbing();
}
// determine the next scrub time
update_scrub_job(delay_ready_t::delay_ready);
state_clear(PG_STATE_REPAIR);
m_active_target = trgt;
- set_op_parameters(pg_cond, m_planned_scrub);
+ set_op_parameters(pg_cond);
// dequeue the PG's "other" target
m_osds->get_scrub_services().remove_from_osd_queue(m_pg_id);
m_scrub_job->clear_both_targets_queued();
unsigned int priority{0};
/**
- * set by queue_scrub() if either planned_scrub.auto_repair or
- * need_auto were set.
- * Tested at scrub end.
+ * set by set_op_parameters() for deep scrubs, if the hardware
+ * supports auto repairing and osd_scrub_auto_repair is enabled.
*/
bool auto_repair{false};
/**
* finalize the parameters of the initiated scrubbing session:
- *
- * The "current scrub" flags (m_flags) are set from the 'planned_scrub'
- * flag-set; PG_STATE_SCRUBBING, and possibly PG_STATE_DEEP_SCRUB &
- * PG_STATE_REPAIR are set.
*/
- void set_op_parameters(
- Scrub::ScrubPGPreconds pg_cond,
- const requested_scrub_t& request) final;
+ void set_op_parameters(Scrub::ScrubPGPreconds pg_cond) final;
void cleanup_store(ObjectStore::Transaction* t) final;
/**
* initiate a deep-scrub after the current scrub ended with errors.
*/
- void request_rescrubbing(requested_scrub_t& req_flags);
+ void request_rescrubbing();
/**
* combine cluster & pool configuration options into a single struct
* scrubbing starts, will cause auto_repair to be set.
*/
bool need_auto{false};
-
- /*
- * the value of auto_repair is determined in sched_scrub() (once per scrub.
- * previous value is not remembered). Set if
- * - allowed by configuration and backend, and
- * - for periodic scrubs: time_for_deep was just set RRR
- */
- bool auto_repair{false};
};
std::ostream& operator<<(std::ostream& out, const requested_scrub_t& sf);
auto format(const requested_scrub_t& rs, FormatContext& ctx) const
{
return fmt::format_to(ctx.out(),
- "(plnd:{}{}{})",
- rs.auto_repair ? " auto_repair" : "",
+ "(plnd:{}{})",
rs.need_auto ? " need_auto" : "",
rs.req_scrub ? " req_scrub" : "");
}
Scrub::ScrubPGPreconds pg_cond,
const requested_scrub_t& requested_flags) = 0;
- virtual void set_op_parameters(
- Scrub::ScrubPGPreconds pg_cond,
- const requested_scrub_t&) = 0;
+ virtual void set_op_parameters(Scrub::ScrubPGPreconds pg_cond) = 0;
/// stop any active scrubbing (on interval end) and unregister from
/// the OSD scrub queue