]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
osd/PG: separate event for RemoteReservationCanceled
authorSage Weil <sage@redhat.com>
Wed, 4 Oct 2017 20:28:26 +0000 (15:28 -0500)
committerSage Weil <sage@redhat.com>
Wed, 4 Oct 2017 20:28:26 +0000 (15:28 -0500)
Right now we transparently map a RemoteReservationRejected into a
*Canceled event because this what peers send over the wire.  Even
once new peers start sending and explicit CANCEL, old peers will
still do so, so we'll maintain this mapping for a while.

Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/PG.cc
src/osd/PG.h

index 5d1bc8eaa8aa540d062def7f413cfcb6ce218107..51937233363ec693a4c9ba1fc252d4496bc2ee74 100644 (file)
@@ -6470,7 +6470,7 @@ PG::RecoveryState::RepWaitRecoveryReserved::react(const RemoteRecoveryReserved &
 
 boost::statechart::result
 PG::RecoveryState::RepWaitRecoveryReserved::react(
-  const RemoteReservationRejected &evt)
+  const RemoteReservationCanceled &evt)
 {
   PG *pg = context< RecoveryMachine >().pg;
   pg->osd->remote_reserver.cancel_reservation(pg->info.pgid);
@@ -6568,7 +6568,17 @@ PG::RecoveryState::RepWaitBackfillReserved::react(
 }
 
 boost::statechart::result
-PG::RecoveryState::RepWaitBackfillReserved::react(const RemoteReservationRejected &evt)
+PG::RecoveryState::RepWaitBackfillReserved::react(
+  const RemoteReservationRejected &evt)
+{
+  PG *pg = context< RecoveryMachine >().pg;
+  pg->osd->remote_reserver.cancel_reservation(pg->info.pgid);
+  return transit<RepNotRecovering>();
+}
+
+boost::statechart::result
+PG::RecoveryState::RepWaitBackfillReserved::react(
+  const RemoteReservationCanceled &evt)
 {
   PG *pg = context< RecoveryMachine >().pg;
   pg->osd->remote_reserver.cancel_reservation(pg->info.pgid);
index dd02579f2efbdc116178297a1aa663f057dd6ba6..16d81cb5118286fc34feaac8cac5f1cac0e469b1 100644 (file)
@@ -1584,6 +1584,7 @@ public:
   TrivialEvent(RemoteBackfillReserved)
   TrivialEvent(RejectRemoteReservation)
   TrivialEvent(RemoteReservationRejected)
+  TrivialEvent(RemoteReservationCanceled)
   TrivialEvent(RequestBackfill)
   TrivialEvent(RequestRecovery)
   TrivialEvent(RecoveryDone)
@@ -1981,7 +1982,9 @@ public:
     struct RepRecovering : boost::statechart::state< RepRecovering, ReplicaActive >, NamedState {
       typedef boost::mpl::list<
        boost::statechart::transition< RecoveryDone, RepNotRecovering >,
+       // for compat with old peers
        boost::statechart::transition< RemoteReservationRejected, RepNotRecovering >,
+       boost::statechart::transition< RemoteReservationCanceled, RepNotRecovering >,
        boost::statechart::custom_reaction< BackfillTooFull >
        > reactions;
       explicit RepRecovering(my_context ctx);
@@ -1993,24 +1996,33 @@ public:
       typedef boost::mpl::list<
        boost::statechart::custom_reaction< RemoteBackfillReserved >,
        boost::statechart::custom_reaction< RejectRemoteReservation >,
-       boost::statechart::custom_reaction< RemoteReservationRejected >
+       boost::statechart::custom_reaction< RemoteReservationRejected >,
+       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 RemoteReservationCanceled &evt);
     };
 
     struct RepWaitRecoveryReserved : boost::statechart::state< RepWaitRecoveryReserved, ReplicaActive >, NamedState {
       typedef boost::mpl::list<
        boost::statechart::custom_reaction< RemoteRecoveryReserved >,
-       boost::statechart::custom_reaction< RemoteReservationRejected >
+       // for compat with old peers
+       boost::statechart::custom_reaction< RemoteReservationRejected >,
+       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 RemoteReservationRejected &evt) {
+       // for compat with old peers
+       post_event(RemoteReservationCanceled());
+       return discard_event();
+      }
+      boost::statechart::result react(const RemoteReservationCanceled &evt);
     };
 
     struct RepNotRecovering : boost::statechart::state< RepNotRecovering, ReplicaActive>, NamedState {
@@ -2018,7 +2030,8 @@ public:
        boost::statechart::custom_reaction< RequestBackfillPrio >,
         boost::statechart::transition< RequestRecovery, RepWaitRecoveryReserved >,
        boost::statechart::custom_reaction< RejectRemoteReservation >,
-       boost::statechart::transition< RemoteReservationRejected, RepNotRecovering >,   // if primary is preempted or cancels
+       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);