NamedState(context< RecoveryMachine >().pg, "Started/ReplicaActive/RepWaitRecoveryReserved")
{
context< RecoveryMachine >().log_enter(state_name);
- PG *pg = context< RecoveryMachine >().pg;
-
- pg->osd->remote_reserver.request_reservation(
- pg->info.pgid,
- new QueuePeeringEvt<RemoteRecoveryReserved>(
- pg, pg->get_osdmap()->get_epoch(),
- RemoteRecoveryReserved()),
- pg->get_recovery_priority());
}
boost::statechart::result
return transit<RepWaitBackfillReserved>();
}
+boost::statechart::result
+PG::RecoveryState::RepNotRecovering::react(const RequestRecoveryPrio &evt)
+{
+ PG *pg = context< RecoveryMachine >().pg;
+ ostringstream ss;
+
+ // fall back to a local reckoning of priority of primary doesn't pass one
+ // (pre-mimic compat)
+ int prio = evt.priority ? evt.priority : pg->get_recovery_priority();
+ pg->osd->remote_reserver.request_reservation(
+ pg->info.pgid,
+ new QueuePeeringEvt<RemoteRecoveryReserved>(
+ pg, pg->get_osdmap()->get_epoch(),
+ RemoteRecoveryReserved()),
+ prio);
+ return transit<RepWaitRecoveryReserved>();
+}
+
void PG::RecoveryState::RepWaitBackfillReserved::exit()
{
context< RecoveryMachine >().log_exit(state_name, enter_time);
*out << "RequestBackfillPrio: priority " << priority;
}
};
+ struct RequestRecoveryPrio : boost::statechart::event< RequestRecoveryPrio > {
+ unsigned priority;
+ explicit RequestRecoveryPrio(unsigned prio) :
+ boost::statechart::event< RequestRecoveryPrio >(),
+ priority(prio) {}
+ void print(std::ostream *out) const {
+ *out << "RequestRecoveryPrio: priority " << priority;
+ }
+ };
#define TrivialEvent(T) struct T : boost::statechart::event< T > { \
T() : boost::statechart::event< T >() {} \
void print(std::ostream *out) const { \
TrivialEvent(RemoteReservationRejected)
TrivialEvent(RemoteReservationCanceled)
TrivialEvent(RequestBackfill)
- TrivialEvent(RequestRecovery)
TrivialEvent(RecoveryDone)
protected:
TrivialEvent(BackfillTooFull)
struct RepNotRecovering : boost::statechart::state< RepNotRecovering, ReplicaActive>, NamedState {
typedef boost::mpl::list<
+ boost::statechart::custom_reaction< RequestRecoveryPrio >,
boost::statechart::custom_reaction< RequestBackfillPrio >,
- boost::statechart::transition< RequestRecovery, RepWaitRecoveryReserved >,
boost::statechart::custom_reaction< RejectRemoteReservation >,
boost::statechart::transition< RemoteReservationRejected, RepNotRecovering >,
boost::statechart::transition< RemoteReservationCanceled, RepNotRecovering >,
boost::statechart::transition< RecoveryDone, RepNotRecovering > // for compat with pre-reservation peers
> reactions;
explicit RepNotRecovering(my_context ctx);
+ boost::statechart::result react(const RequestRecoveryPrio &evt);
boost::statechart::result react(const RequestBackfillPrio &evt);
boost::statechart::result react(const RejectRemoteReservation &evt);
void exit();