Skip to content

Commit 29c4337

Browse files
committed
osd/PeeringState: rename "cancel_backfill" to "suspend_backfill"
PerringState events the are leading to `cancel_backfill()` are: * DeferBackfill - Called if local recovery reservation is revoked before it completes (See AsyncResever::request_reservation on_preempt) * UnfoundBackfill * RemoteReservationRevokedTooFull * RemoteReservationRevoked In each event, we merely suspend the the backfill. The primary will *continue* to keep trying to start this backfill as long as the up set for the current interval includes the osds that needs to be backfilled. Eventually, the backfill will either succeed and complete or will be made irrelevant due to an interval change (and essentially truly "cancelled") Signed-off-by: Xuehan Xu <[email protected]>
1 parent 1e22c11 commit 29c4337

File tree

11 files changed

+40
-36
lines changed

11 files changed

+40
-36
lines changed

src/crimson/osd/backfill_state.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ BackfillState::PrimaryScanning::react(PrimaryScanned evt)
417417
}
418418

419419
boost::statechart::result
420-
BackfillState::PrimaryScanning::react(CancelBackfill evt)
420+
BackfillState::PrimaryScanning::react(SuspendBackfill evt)
421421
{
422422
LOG_PREFIX(BackfillState::PrimaryScanning::react::SuspendBackfill);
423423
DEBUGDPP("suspended within PrimaryScanning", pg());
@@ -513,7 +513,7 @@ BackfillState::ReplicasScanning::react(ReplicaScanned evt)
513513
}
514514

515515
boost::statechart::result
516-
BackfillState::ReplicasScanning::react(CancelBackfill evt)
516+
BackfillState::ReplicasScanning::react(SuspendBackfill evt)
517517
{
518518
LOG_PREFIX(BackfillState::ReplicasScanning::react::SuspendBackfill);
519519
DEBUGDPP("suspended within ReplicasScanning", pg());
@@ -566,7 +566,7 @@ BackfillState::Waiting::react(ObjectPushed evt)
566566
}
567567

568568
boost::statechart::result
569-
BackfillState::Waiting::react(CancelBackfill evt)
569+
BackfillState::Waiting::react(SuspendBackfill evt)
570570
{
571571
LOG_PREFIX(BackfillState::Waiting::react::SuspendBackfill);
572572
DEBUGDPP("suspended within Waiting", pg());

src/crimson/osd/backfill_state.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ struct BackfillState {
5959
struct RequestDone : sc::event<RequestDone> {
6060
};
6161

62-
struct CancelBackfill : sc::event<CancelBackfill> {
62+
struct SuspendBackfill : sc::event<SuspendBackfill> {
6363
};
6464

6565
private:
@@ -210,14 +210,14 @@ struct BackfillState {
210210
sc::custom_reaction<ObjectPushed>,
211211
sc::custom_reaction<PrimaryScanned>,
212212
sc::transition<RequestDone, Done>,
213-
sc::custom_reaction<CancelBackfill>,
213+
sc::custom_reaction<SuspendBackfill>,
214214
sc::custom_reaction<Triggered>,
215215
sc::transition<sc::event_base, Crashed>>;
216216
explicit PrimaryScanning(my_context);
217217
sc::result react(ObjectPushed);
218218
// collect scanning result and transit to Enqueuing.
219219
sc::result react(PrimaryScanned);
220-
sc::result react(CancelBackfill);
220+
sc::result react(SuspendBackfill);
221221
sc::result react(Triggered);
222222
};
223223

@@ -226,7 +226,7 @@ struct BackfillState {
226226
using reactions = boost::mpl::list<
227227
sc::custom_reaction<ObjectPushed>,
228228
sc::custom_reaction<ReplicaScanned>,
229-
sc::custom_reaction<CancelBackfill>,
229+
sc::custom_reaction<SuspendBackfill>,
230230
sc::custom_reaction<Triggered>,
231231
sc::transition<RequestDone, Done>,
232232
sc::transition<sc::event_base, Crashed>>;
@@ -235,7 +235,7 @@ struct BackfillState {
235235
// to Enqueuing will happen.
236236
sc::result react(ObjectPushed);
237237
sc::result react(ReplicaScanned);
238-
sc::result react(CancelBackfill);
238+
sc::result react(SuspendBackfill);
239239
sc::result react(Triggered);
240240

241241
// indicate whether a particular peer should be scanned to retrieve
@@ -255,22 +255,22 @@ struct BackfillState {
255255
using reactions = boost::mpl::list<
256256
sc::custom_reaction<ObjectPushed>,
257257
sc::transition<RequestDone, Done>,
258-
sc::custom_reaction<CancelBackfill>,
258+
sc::custom_reaction<SuspendBackfill>,
259259
sc::custom_reaction<Triggered>,
260260
sc::transition<sc::event_base, Crashed>>;
261261
explicit Waiting(my_context);
262262
sc::result react(ObjectPushed);
263-
sc::result react(CancelBackfill);
263+
sc::result react(SuspendBackfill);
264264
sc::result react(Triggered);
265265
};
266266

267267
struct Done : sc::state<Done, BackfillMachine>,
268268
StateHelper<Done> {
269269
using reactions = boost::mpl::list<
270-
sc::custom_reaction<CancelBackfill>,
270+
sc::custom_reaction<SuspendBackfill>,
271271
sc::transition<sc::event_base, Crashed>>;
272272
explicit Done(my_context);
273-
sc::result react(CancelBackfill) {
273+
sc::result react(SuspendBackfill) {
274274
return discard_event();
275275
}
276276
};

src/crimson/osd/pg.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,8 +432,8 @@ class PG : public boost::intrusive_ref_counter<
432432
void on_backfill_reserved() final {
433433
recovery_handler->on_backfill_reserved();
434434
}
435-
void on_backfill_canceled() final {
436-
recovery_handler->backfill_cancelled();
435+
void on_backfill_suspended() final {
436+
recovery_handler->backfill_suspended();
437437
}
438438

439439
void on_recovery_cancelled() final {

src/crimson/osd/pg_recovery.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -630,13 +630,13 @@ void PGRecovery::backfilled()
630630
PeeringState::Backfilled{});
631631
}
632632

633-
void PGRecovery::backfill_cancelled()
633+
void PGRecovery::backfill_suspended()
634634
{
635635
// We are not creating a new BackfillRecovery request here, as we
636636
// need to cancel the backfill synchronously (before this method returns).
637637
using BackfillState = crimson::osd::BackfillState;
638638
backfill_state->process_event(
639-
BackfillState::CancelBackfill{}.intrusive_from_this());
639+
BackfillState::SuspendBackfill{}.intrusive_from_this());
640640
}
641641

642642
void PGRecovery::dispatch_backfill_event(

src/crimson/osd/pg_recovery.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ class PGRecovery : public crimson::osd::BackfillState::BackfillListener {
105105
template <class EventT>
106106
void start_backfill_recovery(
107107
const EventT& evt);
108-
void backfill_cancelled();
108+
void backfill_suspended();
109109
void request_replica_scan(
110110
const pg_shard_t& target,
111111
const hobject_t& begin,

src/osd/PG.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1562,8 +1562,12 @@ void PG::on_backfill_reserved()
15621562
queue_recovery();
15631563
}
15641564

1565-
void PG::on_backfill_canceled()
1565+
void PG::on_backfill_suspended()
15661566
{
1567+
// Scan replies asked before suspending this backfill should be ignored.
1568+
// See PrimaryLogPG::do_scan - case MOSDPGScan::OP_SCAN_DIGEST.
1569+
// `waiting_on_backfill` will be re-refilled after the suspended backfill
1570+
// is resumed/restarted.
15671571
if (!waiting_on_backfill.empty()) {
15681572
waiting_on_backfill.clear();
15691573
finish_recovery_op(hobject_t::get_max());

src/osd/PG.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ class PG : public DoutPrefixProvider,
604604
void queue_snap_retrim(snapid_t snap);
605605

606606
void on_backfill_reserved() override;
607-
void on_backfill_canceled() override;
607+
void on_backfill_suspended() override;
608608
void on_recovery_cancelled() override {}
609609
void on_recovery_reserved() override;
610610

src/osd/PeeringState.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5106,11 +5106,11 @@ void PeeringState::Backfilling::backfill_release_reservations()
51065106
}
51075107
}
51085108

5109-
void PeeringState::Backfilling::cancel_backfill()
5109+
void PeeringState::Backfilling::suspend_backfill()
51105110
{
51115111
DECLARE_LOCALS;
51125112
backfill_release_reservations();
5113-
pl->on_backfill_canceled();
5113+
pl->on_backfill_suspended();
51145114
}
51155115

51165116
boost::statechart::result
@@ -5128,7 +5128,7 @@ PeeringState::Backfilling::react(const DeferBackfill &c)
51285128
psdout(10) << "defer backfill, retry delay " << c.delay << dendl;
51295129
ps->state_set(PG_STATE_BACKFILL_WAIT);
51305130
ps->state_clear(PG_STATE_BACKFILLING);
5131-
cancel_backfill();
5131+
suspend_backfill();
51325132

51335133
pl->schedule_event_after(
51345134
std::make_shared<PGPeeringEvent>(
@@ -5146,7 +5146,7 @@ PeeringState::Backfilling::react(const UnfoundBackfill &c)
51465146
psdout(10) << "backfill has unfound, can't continue" << dendl;
51475147
ps->state_set(PG_STATE_BACKFILL_UNFOUND);
51485148
ps->state_clear(PG_STATE_BACKFILLING);
5149-
cancel_backfill();
5149+
suspend_backfill();
51505150
return transit<NotBackfilling>();
51515151
}
51525152

@@ -5157,7 +5157,7 @@ PeeringState::Backfilling::react(const RemoteReservationRevokedTooFull &)
51575157

51585158
ps->state_set(PG_STATE_BACKFILL_TOOFULL);
51595159
ps->state_clear(PG_STATE_BACKFILLING);
5160-
cancel_backfill();
5160+
suspend_backfill();
51615161

51625162
pl->schedule_event_after(
51635163
std::make_shared<PGPeeringEvent>(
@@ -5174,7 +5174,7 @@ PeeringState::Backfilling::react(const RemoteReservationRevoked &)
51745174
{
51755175
DECLARE_LOCALS;
51765176
ps->state_set(PG_STATE_BACKFILL_WAIT);
5177-
cancel_backfill();
5177+
suspend_backfill();
51785178
if (ps->needs_backfill()) {
51795179
return transit<WaitLocalBackfillReserved>();
51805180
} else {

src/osd/PeeringState.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ class PeeringState : public MissingLoc::MappingInfo {
417417

418418
// ============ recovery reservation notifications ==========
419419
virtual void on_backfill_reserved() = 0;
420-
virtual void on_backfill_canceled() = 0;
420+
virtual void on_backfill_suspended() = 0;
421421
virtual void on_recovery_reserved() = 0;
422422
virtual void on_recovery_cancelled() = 0;
423423

@@ -963,7 +963,7 @@ class PeeringState : public MissingLoc::MappingInfo {
963963
boost::statechart::result react(const RemoteReservationRevoked& evt);
964964
boost::statechart::result react(const DeferBackfill& evt);
965965
boost::statechart::result react(const UnfoundBackfill& evt);
966-
void cancel_backfill();
966+
void suspend_backfill();
967967
void exit();
968968
};
969969

src/osd/PrimaryLogPG.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4485,7 +4485,7 @@ void PrimaryLogPG::do_scan(
44854485
{
44864486
auto dpp = get_dpp();
44874487
if (osd->check_backfill_full(dpp)) {
4488-
dout(1) << __func__ << ": Canceling backfill: Full." << dendl;
4488+
dout(1) << __func__ << ": Suspending backfill: Full." << dendl;
44894489
queue_peering_event(
44904490
PGPeeringEventRef(
44914491
std::make_shared<PGPeeringEvent>(
@@ -4542,7 +4542,7 @@ void PrimaryLogPG::do_scan(
45424542
} else {
45434543
// we canceled backfill for a while due to a too full, and this
45444544
// is an extra response from a non-too-full peer
4545-
dout(20) << __func__ << " canceled backfill (too full?)" << dendl;
4545+
dout(20) << __func__ << " suspended backfill (too full?)" << dendl;
45464546
}
45474547
}
45484548
break;

0 commit comments

Comments
 (0)