From 69ca01df212ebacc46e1a3f921f71221eade464d Mon Sep 17 00:00:00 2001 From: David Zafman Date: Fri, 23 Aug 2019 08:54:28 -0700 Subject: [PATCH] osd: Rename backfill reservation reject names to reflect too full use The only reason for a reject is in a too full condition. Now that we have two types of revoke, let's make this clearer. Signed-off-by: David Zafman (cherry picked from commit 0115595c1d1366cb3633e9dc6730496b9e5cf5c4) Conflicts: src/osd/PeeringEvent.h - file does not exist in nautilus due to refactoring: made the changes manually to src/osd/PGPeeringEvent.h src/osd/PeeringState.cc src/osd/PeeringState.h - files do not exist in nautilus due to refactoring: made the changes manually to src/osd/PG.{cc,h} by doing: s/RejectRemoteReservation/RejectTooFullRemoteReservation/g s/RemoteReservationRejected/RemoteReservationRejectedTooFull/g --- src/messages/MBackfillReserve.h | 12 ++++++------ src/osd/PG.cc | 20 +++++++++---------- src/osd/PG.h | 34 ++++++++++++++++----------------- src/osd/PGPeeringEvent.h | 2 +- 4 files changed, 34 insertions(+), 34 deletions(-) diff --git a/src/messages/MBackfillReserve.h b/src/messages/MBackfillReserve.h index 1b4e021a9a38b..ac813293aa8ca 100644 --- a/src/messages/MBackfillReserve.h +++ b/src/messages/MBackfillReserve.h @@ -30,7 +30,7 @@ public: enum { REQUEST = 0, // primary->replica: please reserve a slot GRANT = 1, // replica->primary: ok, i reserved it - REJECT = 2, // replica->primary: sorry, try again later (*) + REJECT_TOOFULL = 2, // replica->primary: too full, sorry, try again later (*) RELEASE = 3, // primary->replcia: release the slot i reserved before REVOKE_TOOFULL = 4, // replica->primary: too full, stop backfilling REVOKE = 5, // replica->primary: i'm taking back the slot i gave you @@ -63,7 +63,7 @@ public: query_epoch, query_epoch, RemoteBackfillReserved()); - case REJECT: + case REJECT_TOOFULL: // NOTE: this is replica -> primary "i reject your request" // and also primary -> replica "cancel my previously-granted request" // (for older peers) @@ -72,7 +72,7 @@ public: return new PGPeeringEvent( query_epoch, query_epoch, - RemoteReservationRejected()); + RemoteReservationRejectedTooFull()); case RELEASE: return new PGPeeringEvent( query_epoch, @@ -119,8 +119,8 @@ public: case GRANT: out << "GRANT"; break; - case REJECT: - out << "REJECT "; + case REJECT_TOOFULL: + out << "REJECT_TOOFULL"; break; case RELEASE: out << "RELEASE"; @@ -160,7 +160,7 @@ public: encode(pgid.pgid, payload); encode(query_epoch, payload); encode((type == RELEASE || type == REVOKE_TOOFULL || type == REVOKE) ? - REJECT : type, payload); + REJECT_TOOFULL : type, payload); encode(priority, payload); encode(pgid.shard, payload); return; diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 3ea5596fbbe1a..ed44e5d986fb8 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -4703,7 +4703,7 @@ void PG::reject_reservation() osd->send_message_osd_cluster( primary.osd, new MBackfillReserve( - MBackfillReserve::REJECT, + MBackfillReserve::REJECT_TOOFULL, spg_t(info.pgid.pgid, primary.shard), get_osdmap_epoch()), get_osdmap_epoch()); @@ -7768,7 +7768,7 @@ void PG::RecoveryState::WaitRemoteBackfillReserved::retry() } boost::statechart::result -PG::RecoveryState::WaitRemoteBackfillReserved::react(const RemoteReservationRejected &evt) +PG::RecoveryState::WaitRemoteBackfillReserved::react(const RemoteReservationRejectedTooFull &evt) { PG *pg = context< RecoveryMachine >().pg; pg->state_set(PG_STATE_BACKFILL_TOOFULL); @@ -7829,7 +7829,7 @@ PG::RecoveryState::NotBackfilling::react(const RemoteBackfillReserved &evt) } boost::statechart::result -PG::RecoveryState::NotBackfilling::react(const RemoteReservationRejected &evt) +PG::RecoveryState::NotBackfilling::react(const RemoteReservationRejectedTooFull &evt) { return discard_event(); } @@ -7871,11 +7871,11 @@ PG::RecoveryState::RepNotRecovering::RepNotRecovering(my_context ctx) } boost::statechart::result -PG::RecoveryState::RepNotRecovering::react(const RejectRemoteReservation &evt) +PG::RecoveryState::RepNotRecovering::react(const RejectTooFullRemoteReservation &evt) { PG *pg = context< RecoveryMachine >().pg; pg->reject_reservation(); - post_event(RemoteReservationRejected()); + post_event(RemoteReservationRejectedTooFull()); return discard_event(); } @@ -7979,12 +7979,12 @@ PG::RecoveryState::RepNotRecovering::react(const RequestBackfillPrio &evt) (rand()%1000 < (pg->cct->_conf->osd_debug_reject_backfill_probability*1000.0))) { ldout(pg->cct, 10) << "backfill reservation rejected: failure injection" << dendl; - post_event(RejectRemoteReservation()); + post_event(RejectTooFullRemoteReservation()); } else if (!pg->cct->_conf->osd_debug_skip_full_check_in_backfill_reservation && pg->osd->tentative_backfill_full(pg, pending_adjustment, cur_stat)) { ldout(pg->cct, 10) << "backfill reservation rejected: backfill full" << dendl; - post_event(RejectRemoteReservation()); + post_event(RejectTooFullRemoteReservation()); } else { Context *preempt = nullptr; // Don't reserve space if skipped reservation check, this is used @@ -8066,17 +8066,17 @@ PG::RecoveryState::RepWaitBackfillReserved::react(const RemoteBackfillReserved & boost::statechart::result PG::RecoveryState::RepWaitBackfillReserved::react( - const RejectRemoteReservation &evt) + const RejectTooFullRemoteReservation &evt) { PG *pg = context< RecoveryMachine >().pg; pg->reject_reservation(); - post_event(RemoteReservationRejected()); + post_event(RemoteReservationRejectedTooFull()); return discard_event(); } boost::statechart::result PG::RecoveryState::RepWaitBackfillReserved::react( - const RemoteReservationRejected &evt) + const RemoteReservationRejectedTooFull &evt) { PG *pg = context< RecoveryMachine >().pg; pg->clear_reserved_num_bytes(); diff --git a/src/osd/PG.h b/src/osd/PG.h index 6aa8b95afaee0..eb2260aca88c7 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -2043,7 +2043,7 @@ protected: TrivialEvent(NeedUpThru) TrivialEvent(Backfilled) TrivialEvent(LocalBackfillReserved) - TrivialEvent(RejectRemoteReservation) + TrivialEvent(RejectTooFullRemoteReservation) public: TrivialEvent(RequestBackfill) protected: @@ -2431,12 +2431,12 @@ protected: boost::statechart::custom_reaction< Backfilled >, boost::statechart::custom_reaction< DeferBackfill >, boost::statechart::custom_reaction< UnfoundBackfill >, - boost::statechart::custom_reaction< RemoteReservationRejected >, + boost::statechart::custom_reaction< RemoteReservationRejectedTooFull >, boost::statechart::custom_reaction< RemoteReservationRevokedTooFull>, boost::statechart::custom_reaction< RemoteReservationRevoked> > reactions; explicit Backfilling(my_context ctx); - boost::statechart::result react(const RemoteReservationRejected& evt) { + boost::statechart::result react(const RemoteReservationRejectedTooFull& evt) { // for compat with old peers post_event(RemoteReservationRevokedTooFull()); return discard_event(); @@ -2454,7 +2454,7 @@ protected: struct WaitRemoteBackfillReserved : boost::statechart::state< WaitRemoteBackfillReserved, Active >, NamedState { typedef boost::mpl::list< boost::statechart::custom_reaction< RemoteBackfillReserved >, - boost::statechart::custom_reaction< RemoteReservationRejected >, + boost::statechart::custom_reaction< RemoteReservationRejectedTooFull >, boost::statechart::custom_reaction< RemoteReservationRevoked >, boost::statechart::transition< AllBackfillsReserved, Backfilling > > reactions; @@ -2463,7 +2463,7 @@ protected: void retry(); void exit(); boost::statechart::result react(const RemoteBackfillReserved& evt); - boost::statechart::result react(const RemoteReservationRejected& evt); + boost::statechart::result react(const RemoteReservationRejectedTooFull& evt); boost::statechart::result react(const RemoteReservationRevoked& evt); }; @@ -2479,12 +2479,12 @@ protected: typedef boost::mpl::list< boost::statechart::transition< RequestBackfill, WaitLocalBackfillReserved>, boost::statechart::custom_reaction< RemoteBackfillReserved >, - boost::statechart::custom_reaction< RemoteReservationRejected > + boost::statechart::custom_reaction< RemoteReservationRejectedTooFull > > reactions; explicit NotBackfilling(my_context ctx); void exit(); boost::statechart::result react(const RemoteBackfillReserved& evt); - boost::statechart::result react(const RemoteReservationRejected& evt); + boost::statechart::result react(const RemoteReservationRejectedTooFull& evt); }; struct NotRecovering : boost::statechart::state< NotRecovering, Active>, NamedState { @@ -2562,7 +2562,7 @@ protected: typedef boost::mpl::list< boost::statechart::transition< RecoveryDone, RepNotRecovering >, // for compat with old peers - boost::statechart::transition< RemoteReservationRejected, RepNotRecovering >, + boost::statechart::transition< RemoteReservationRejectedTooFull, RepNotRecovering >, boost::statechart::transition< RemoteReservationCanceled, RepNotRecovering >, boost::statechart::custom_reaction< BackfillTooFull >, boost::statechart::custom_reaction< RemoteRecoveryPreempted >, @@ -2578,15 +2578,15 @@ protected: struct RepWaitBackfillReserved : boost::statechart::state< RepWaitBackfillReserved, ReplicaActive >, NamedState { typedef boost::mpl::list< boost::statechart::custom_reaction< RemoteBackfillReserved >, - boost::statechart::custom_reaction< RejectRemoteReservation >, - boost::statechart::custom_reaction< RemoteReservationRejected >, + boost::statechart::custom_reaction< RejectTooFullRemoteReservation >, + boost::statechart::custom_reaction< RemoteReservationRejectedTooFull >, boost::statechart::custom_reaction< RemoteReservationCanceled > > reactions; explicit RepWaitBackfillReserved(my_context ctx); void exit(); boost::statechart::result react(const RemoteBackfillReserved &evt); - boost::statechart::result react(const RejectRemoteReservation &evt); - boost::statechart::result react(const RemoteReservationRejected &evt); + boost::statechart::result react(const RejectTooFullRemoteReservation &evt); + boost::statechart::result react(const RemoteReservationRejectedTooFull &evt); boost::statechart::result react(const RemoteReservationCanceled &evt); }; @@ -2594,13 +2594,13 @@ protected: typedef boost::mpl::list< boost::statechart::custom_reaction< RemoteRecoveryReserved >, // for compat with old peers - boost::statechart::custom_reaction< RemoteReservationRejected >, + boost::statechart::custom_reaction< RemoteReservationRejectedTooFull >, boost::statechart::custom_reaction< RemoteReservationCanceled > > reactions; explicit RepWaitRecoveryReserved(my_context ctx); void exit(); boost::statechart::result react(const RemoteRecoveryReserved &evt); - boost::statechart::result react(const RemoteReservationRejected &evt) { + boost::statechart::result react(const RemoteReservationRejectedTooFull &evt) { // for compat with old peers post_event(RemoteReservationCanceled()); return discard_event(); @@ -2612,8 +2612,8 @@ protected: typedef boost::mpl::list< boost::statechart::custom_reaction< RequestRecoveryPrio >, boost::statechart::custom_reaction< RequestBackfillPrio >, - boost::statechart::custom_reaction< RejectRemoteReservation >, - boost::statechart::transition< RemoteReservationRejected, RepNotRecovering >, + boost::statechart::custom_reaction< RejectTooFullRemoteReservation >, + boost::statechart::transition< RemoteReservationRejectedTooFull, RepNotRecovering >, boost::statechart::transition< RemoteReservationCanceled, RepNotRecovering >, boost::statechart::custom_reaction< RemoteRecoveryReserved >, boost::statechart::custom_reaction< RemoteBackfillReserved >, @@ -2630,7 +2630,7 @@ protected: // my reservation completion raced with a RELEASE from primary return discard_event(); } - boost::statechart::result react(const RejectRemoteReservation &evt); + boost::statechart::result react(const RejectTooFullRemoteReservation &evt); void exit(); }; diff --git a/src/osd/PGPeeringEvent.h b/src/osd/PGPeeringEvent.h index 02b8360a46b25..a4a557ef1c312 100644 --- a/src/osd/PGPeeringEvent.h +++ b/src/osd/PGPeeringEvent.h @@ -165,7 +165,7 @@ struct RequestRecoveryPrio : boost::statechart::event< RequestRecoveryPrio > { TrivialEvent(NullEvt) TrivialEvent(RemoteBackfillReserved) -TrivialEvent(RemoteReservationRejected) +TrivialEvent(RemoteReservationRejectedTooFull) TrivialEvent(RemoteReservationRevokedTooFull) TrivialEvent(RemoteReservationRevoked) TrivialEvent(RemoteReservationCanceled) -- 2.39.5