From ae044e640519393a77e2e3bd81c5cc9edbf1a4cc Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 21 Dec 2012 11:37:48 -0800 Subject: [PATCH] osd: allow transition from Clean -> WaitLocalRecoveryReserved for repair If we do a scrub repair, we need to go from clean to recovery again to copy objects around. This fixes a simple repair of a missing object, either on the primary or replica. Signed-off-by: Sage Weil --- src/osd/PG.cc | 8 +++++++- src/osd/PG.h | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index a88887fbcdbdb..54a75be5e6ae5 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -3406,6 +3406,7 @@ void PG::build_inc_scrub_map(ScrubMap &map, eversion_t v) void PG::repair_object(const hobject_t& soid, ScrubMap::object *po, int bad_peer, int ok_peer) { + dout(10) << "repair_object " << soid << " bad_peer osd." << bad_peer << " ok_peer osd." << ok_peer << dendl; eversion_t v; bufferlist bv; bv.push_back(po->attrs[OI_ATTR]); @@ -3422,7 +3423,12 @@ void PG::repair_object(const hobject_t& soid, ScrubMap::object *po, int bad_peer log.last_requested = 0; } - osd->queue_for_recovery(this); + queue_peering_event( + CephPeeringEvtRef( + new CephPeeringEvt( + get_osdmap()->get_epoch(), + get_osdmap()->get_epoch(), + DoRecovery()))); } /* replica_scrub diff --git a/src/osd/PG.h b/src/osd/PG.h index acaa89708d643..e66b45b2f7690 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -1348,6 +1348,7 @@ public: boost::statechart::result react(const AdvMap &advmap); }; + struct WaitLocalRecoveryReserved; struct Activating; struct Active : boost::statechart::state< Active, Primary, Activating >, NamedState { Active(my_context ctx); @@ -1380,6 +1381,9 @@ public: }; struct Clean : boost::statechart::state< Clean, Active >, NamedState { + typedef boost::mpl::list< + boost::statechart::transition< DoRecovery, WaitLocalRecoveryReserved > + > reactions; Clean(my_context ctx); void exit(); }; -- 2.39.5