@@ -135,9 +135,27 @@ struct BackfillState {
135135 explicit Crashed ();
136136 };
137137
138- struct Cancelled : sc::simple_state<Cancelled, BackfillMachine>,
139- StateHelper<Cancelled> {
140- explicit Cancelled ();
138+ struct Cancelled : sc::state<Cancelled, BackfillMachine>,
139+ StateHelper<Cancelled> {
140+ using reactions = boost::mpl::list<
141+ sc::custom_reaction<Triggered>,
142+ sc::custom_reaction<PrimaryScanned>,
143+ sc::custom_reaction<ReplicaScanned>,
144+ sc::custom_reaction<ObjectPushed>,
145+ sc::transition<sc::event_base, Crashed>>;
146+ explicit Cancelled (my_context);
147+ // resume after triggering backfill by on_activate_complete().
148+ // transit to Enqueuing.
149+ sc::result react (const Triggered&);
150+ sc::result react (const PrimaryScanned&) {
151+ return discard_event ();
152+ }
153+ sc::result react (const ReplicaScanned&) {
154+ return discard_event ();
155+ }
156+ sc::result react (const ObjectPushed&) {
157+ return discard_event ();
158+ }
141159 };
142160
143161 struct Initial : sc::state<Initial, BackfillMachine>,
@@ -159,6 +177,8 @@ struct BackfillState {
159177 sc::transition<RequestPrimaryScanning, PrimaryScanning>,
160178 sc::transition<RequestReplicasScanning, ReplicasScanning>,
161179 sc::transition<RequestWaiting, Waiting>,
180+ sc::transition<RequestDone, Done>,
181+ sc::transition<CancelBackfill, Cancelled>,
162182 sc::transition<sc::event_base, Crashed>>;
163183 explicit Enqueuing (my_context);
164184
@@ -229,14 +249,15 @@ struct BackfillState {
229249 using reactions = boost::mpl::list<
230250 sc::custom_reaction<ObjectPushed>,
231251 sc::custom_reaction<ReplicaScanned>,
252+ sc::custom_reaction<CancelBackfill>,
232253 sc::transition<RequestDone, Done>,
233- sc::transition<CancelBackfill, Cancelled>,
234254 sc::transition<sc::event_base, Crashed>>;
235255 explicit ReplicasScanning (my_context);
236256 // collect scanning result; if all results are collected, transition
237257 // to Enqueuing will happen.
238258 sc::result react (ObjectPushed);
239259 sc::result react (ReplicaScanned);
260+ sc::result react (CancelBackfill);
240261
241262 // indicate whether a particular peer should be scanned to retrieve
242263 // BackfillInterval for new range of hobject_t namespace.
0 commit comments