summaryrefslogtreecommitdiffstats
path: root/src/osd/scrubber/scrub_machine.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/osd/scrubber/scrub_machine.h')
-rw-r--r--src/osd/scrubber/scrub_machine.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/osd/scrubber/scrub_machine.h b/src/osd/scrubber/scrub_machine.h
index ad0d3bfba38..f7f739692bf 100644
--- a/src/osd/scrubber/scrub_machine.h
+++ b/src/osd/scrubber/scrub_machine.h
@@ -2,6 +2,7 @@
// vim: ts=8 sw=2 smarttab
#pragma once
+#include <optional>
#include <string>
#include <boost/statechart/custom_reaction.hpp>
@@ -160,6 +161,11 @@ VALUE_EVENT(ReserverGranted, AsyncScrubResData);
/// all replicas have granted our reserve request
MEV(RemotesReserved)
+/// abort the scrub session, if in ReservingReplicas state
+/// (used when the operator issues a scrub request, and we no longer
+/// need the reservations)
+MEV(AbortIfReserving)
+
/// initiate a new scrubbing session (relevant if we are a Primary)
MEV(StartScrub)
@@ -289,9 +295,12 @@ class ScrubMachine : public sc::state_machine<ScrubMachine, NotActive> {
[[nodiscard]] bool is_accepting_updates() const;
[[nodiscard]] bool is_primary_idle() const;
- // elapsed time for the currently active scrub.session
+ /// elapsed time for the currently active scrub.session
ceph::timespan get_time_scrubbing() const;
+ /// replica reservation process status
+ std::optional<pg_scrubbing_status_t> get_reservation_status() const;
+
// ///////////////// aux declarations & functions //////////////////////// //
@@ -555,6 +564,9 @@ struct Session : sc::state<Session, PrimaryActive, ReservingReplicas>,
/// abort reason - if known. Determines the delay time imposed on the
/// failed scrub target.
std::optional<Scrub::delay_cause_t> m_abort_reason{std::nullopt};
+
+ /// when reserving replicas: fetch the reservation status
+ std::optional<pg_scrubbing_status_t> get_reservation_status() const;
};
struct ReservingReplicas : sc::state<ReservingReplicas, Session>, NamedSimply {
@@ -563,6 +575,7 @@ struct ReservingReplicas : sc::state<ReservingReplicas, Session>, NamedSimply {
using reactions = mpl::list<
sc::custom_reaction<ReplicaGrant>,
sc::custom_reaction<ReplicaReject>,
+ sc::transition<AbortIfReserving, PrimaryIdle>,
sc::transition<RemotesReserved, ActiveScrubbing>>;
ScrubTimePoint entered_at = ScrubClock::now();