Skip to content

Commit f610b1e

Browse files
committed
osd/scrub: skip reserving replicas for high-priority scrubs
(The primary side of the required changes) Signed-off-by: Ronen Friedman <rfriedma@redhat.com>
1 parent e65ded6 commit f610b1e

File tree

4 files changed

+23
-7
lines changed

4 files changed

+23
-7
lines changed

src/osd/scrubber/pg_scrubber.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,7 @@ void PgScrubber::cancel_callback(scrubber_callback_cancel_token_t token)
800800
m_osds->sleep_timer.cancel_event(token);
801801
}
802802

803-
LogChannelRef &PgScrubber::get_clog() const
803+
LogChannelRef& PgScrubber::get_clog() const
804804
{
805805
return m_osds->clog;
806806
}
@@ -810,6 +810,11 @@ int PgScrubber::get_whoami() const
810810
return m_osds->whoami;
811811
}
812812

813+
[[nodiscard]] bool PgScrubber::is_high_priority() const
814+
{
815+
return m_flags.required;
816+
}
817+
813818
/*
814819
* The selected range is set directly into 'm_start' and 'm_end'
815820
* setting:

src/osd/scrubber/pg_scrubber.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,9 @@ class PgScrubber : public ScrubPgIF,
402402
return m_pg->recovery_state.is_primary();
403403
}
404404

405+
/// is this scrub more than just regular periodic scrub?
406+
[[nodiscard]] bool is_high_priority() const final;
407+
405408
void set_state_name(const char* name) final
406409
{
407410
m_fsm_state_name = name;

src/osd/scrubber/scrub_machine_lstnr.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,4 +229,7 @@ struct ScrubMachineListener {
229229
// temporary interface (to be discarded in a follow-up PR)
230230
/// set the 'resources_failure' flag in the scrub-job object
231231
virtual void flag_reservations_failure() = 0;
232+
233+
/// is this scrub more than just regular periodic scrub?
234+
[[nodiscard]] virtual bool is_high_priority() const = 0;
232235
};

src/osd/scrubber/scrub_reservations.cc

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,17 @@ ReplicaReservations::ReplicaReservations(ScrubMachineListener& scrbr)
4949
});
5050

5151
m_next_to_request = m_sorted_secondaries.cbegin();
52-
// send out the 1'st request (unless we have no replicas)
53-
send_next_reservation_or_complete();
54-
55-
m_slow_response_warn_timeout =
56-
m_scrubber.get_pg_cct()->_conf.get_val<milliseconds>(
57-
"osd_scrub_slow_reservation_response");
52+
if (m_scrubber.is_high_priority()) {
53+
// for high-priority scrubs (i.e. - user-initiated), no reservations are
54+
// needed.
55+
dout(10) << "high-priority scrub - no reservations needed" << dendl;
56+
} else {
57+
// send out the 1'st request (unless we have no replicas)
58+
send_next_reservation_or_complete();
59+
m_slow_response_warn_timeout =
60+
m_scrubber.get_pg_cct()->_conf.get_val<milliseconds>(
61+
"osd_scrub_slow_reservation_response");
62+
}
5863
}
5964

6065
void ReplicaReservations::release_all()

0 commit comments

Comments
 (0)