File tree Expand file tree Collapse file tree 3 files changed +21
-2
lines changed
Expand file tree Collapse file tree 3 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -1828,10 +1828,17 @@ void PgScrubber::scrub_finish()
18281828 // if the repair request comes from auto-repair and there is a large
18291829 // number of objects known to be damaged, we cancel the auto-repair
18301830 if (m_is_repair && m_flags.auto_repair &&
1831+ ScrubJob::is_repairs_count_limited (m_active_target->urgency ()) &&
18311832 m_be->authoritative_peers_count () >
1832- static_cast <int >(m_pg->cct ->_conf ->osd_scrub_auto_repair_num_errors )) {
1833+ static_cast <int >(
1834+ m_pg->cct ->_conf ->osd_scrub_auto_repair_num_errors )) {
18331835
1834- dout (10 ) << __func__ << " undoing the repair" << dendl;
1836+ dout (5 ) << fmt::format (
1837+ " {}: undoing the repair. Damaged objects count ({}) is "
1838+ " above configured limit ({})" ,
1839+ __func__, m_be->authoritative_peers_count (),
1840+ m_pg->cct ->_conf ->osd_scrub_auto_repair_num_errors )
1841+ << dendl;
18351842 state_clear (PG_STATE_REPAIR); // not expected to be set, anyway
18361843 m_is_repair = false ;
18371844 update_op_mode_text ();
Original file line number Diff line number Diff line change @@ -426,3 +426,8 @@ bool ScrubJob::is_autorepair_allowed(urgency_t urgency)
426426 urgency == urgency_t ::operator_requested ||
427427 urgency == urgency_t ::repairing || urgency == urgency_t ::must_repair;
428428}
429+
430+ bool ScrubJob::is_repairs_count_limited (urgency_t urgency)
431+ {
432+ return urgency < urgency_t ::operator_requested;
433+ }
Original file line number Diff line number Diff line change @@ -375,6 +375,13 @@ class ScrubJob {
375375 static bool is_repair_implied (urgency_t urgency);
376376
377377 static bool is_autorepair_allowed (urgency_t urgency);
378+
379+ /* *
380+ * should we cancel the repair if the number of damaged objects
381+ * exceeds the configured limit ('osd_scrub_auto_repair_num_errors')?
382+ * This does not apply to any repair that was operator-initiated.
383+ */
384+ static bool is_repairs_count_limited (urgency_t urgency);
378385};
379386} // namespace Scrub
380387
You can’t perform that action at this time.
0 commit comments