// if the repair request comes from auto-repair and there is a large
// number of objects known to be damaged, we cancel the auto-repair
if (m_is_repair && m_flags.auto_repair &&
+ ScrubJob::is_repairs_count_limited(m_active_target->urgency()) &&
m_be->authoritative_peers_count() >
- static_cast<int>(m_pg->cct->_conf->osd_scrub_auto_repair_num_errors)) {
+ static_cast<int>(
+ m_pg->cct->_conf->osd_scrub_auto_repair_num_errors)) {
- dout(10) << __func__ << " undoing the repair" << dendl;
+ dout(5) << fmt::format(
+ "{}: undoing the repair. Damaged objects count ({}) is "
+ "above configured limit ({})",
+ __func__, m_be->authoritative_peers_count(),
+ m_pg->cct->_conf->osd_scrub_auto_repair_num_errors)
+ << dendl;
state_clear(PG_STATE_REPAIR); // not expected to be set, anyway
m_is_repair = false;
update_op_mode_text();
urgency == urgency_t::operator_requested ||
urgency == urgency_t::repairing || urgency == urgency_t::must_repair;
}
+
+bool ScrubJob::is_repairs_count_limited(urgency_t urgency)
+{
+ return urgency < urgency_t::operator_requested;
+}
static bool is_repair_implied(urgency_t urgency);
static bool is_autorepair_allowed(urgency_t urgency);
+
+ /**
+ * should we cancel the repair if the number of damaged objects
+ * exceeds the configured limit ('osd_scrub_auto_repair_num_errors')?
+ * This does not apply to any repair that was operator-initiated.
+ */
+ static bool is_repairs_count_limited(urgency_t urgency);
};
} // namespace Scrub