diff options
author | Samuel Just <sam.just@inktank.com> | 2013-09-05 14:30:46 -0700 |
---|---|---|
committer | Samuel Just <sam.just@inktank.com> | 2013-09-19 12:50:45 -0700 |
commit | 0b10bc68d0e4ae93989cb460e5615f883ad06793 (patch) | |
tree | 7273984315c2219fc07d5280fe6363fef3f650c7 | |
parent | 9d0570f741053637ea12d77bad778fa424b02c87 (diff) | |
download | ceph-0b10bc68d0e4ae93989cb460e5615f883ad06793.tar.gz |
ReplicatedPG/Backend: handle down pull sources
Signed-off-by: Samuel Just <sam.just@inktank.com>
-rw-r--r-- | src/osd/PGBackend.h | 5 | ||||
-rw-r--r-- | src/osd/ReplicatedBackend.cc | 22 | ||||
-rw-r--r-- | src/osd/ReplicatedBackend.h | 2 | ||||
-rw-r--r-- | src/osd/ReplicatedPG.cc | 27 | ||||
-rw-r--r-- | src/osd/ReplicatedPG.h | 1 |
5 files changed, 39 insertions, 18 deletions
diff --git a/src/osd/PGBackend.h b/src/osd/PGBackend.h index 27dbd91b80e..43283baa760 100644 --- a/src/osd/PGBackend.h +++ b/src/osd/PGBackend.h @@ -78,6 +78,9 @@ virtual void failed_push(int from, const hobject_t &soid) = 0; + + virtual void cancel_pull(const hobject_t &soid) = 0; + /** * Bless a context * @@ -174,6 +177,8 @@ OpRequestRef op ///< [in] message received ) = 0; ///< @return true if the message was handled + virtual void check_recovery_sources(const OSDMapRef osdmap) = 0; + /** * implementation should clear itself, contexts blessed prior to on_change * won't be called after on_change() diff --git a/src/osd/ReplicatedBackend.cc b/src/osd/ReplicatedBackend.cc index da57630e78b..10d743d95e4 100644 --- a/src/osd/ReplicatedBackend.cc +++ b/src/osd/ReplicatedBackend.cc @@ -61,6 +61,28 @@ void ReplicatedBackend::recover_object( dout(10) << __func__ << dendl; } +void ReplicatedBackend::check_recovery_sources(const OSDMapRef osdmap) +{ + for(map<int, set<hobject_t> >::iterator i = pull_from_peer.begin(); + i != pull_from_peer.end(); + ) { + if (osdmap->is_down(i->first)) { + dout(10) << "check_recovery_sources resetting pulls from osd." << i->first + << ", osdmap has it marked down" << dendl; + for (set<hobject_t>::iterator j = i->second.begin(); + j != i->second.end(); + ++j) { + assert(pulling.count(*j) == 1); + get_parent()->cancel_pull(*j); + pulling.erase(*j); + } + pull_from_peer.erase(i++); + } else { + ++i; + } + } +} + bool ReplicatedBackend::handle_message( OpRequestRef op ) diff --git a/src/osd/ReplicatedBackend.h b/src/osd/ReplicatedBackend.h index e703d4c333c..44ff3bc62a8 100644 --- a/src/osd/ReplicatedBackend.h +++ b/src/osd/ReplicatedBackend.h @@ -59,6 +59,8 @@ public: RecoveryHandle *h ); + void check_recovery_sources(const OSDMapRef osdmap); + /// @see PGBackend::handle_message bool handle_message( OpRequestRef op diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index b12962d73aa..242943f14c6 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -7378,6 +7378,13 @@ void ReplicatedPG::_clear_recovery_state() pull_from_peer.clear(); } +void ReplicatedPG::cancel_pull(const hobject_t &soid) +{ + assert(recovering.count(soid)); + recovering.erase(soid); + pg_log.set_last_requested(0); // get recover_primary to start over +} + void ReplicatedPG::check_recovery_sources(const OSDMapRef osdmap) { /* @@ -7394,26 +7401,10 @@ void ReplicatedPG::check_recovery_sources(const OSDMapRef osdmap) } dout(10) << "check_recovery_sources source osd." << *p << " now down" << dendl; now_down.insert(*p); - - // reset pulls? - map<int, set<hobject_t> >::iterator j = pull_from_peer.find(*p); - if (j != pull_from_peer.end()) { - dout(10) << "check_recovery_sources resetting pulls from osd." << *p - << ", osdmap has it marked down" << dendl; - for (set<hobject_t>::iterator i = j->second.begin(); - i != j->second.end(); - ++i) { - assert(pulling.count(*i) == 1); - pulling.erase(*i); - finish_recovery_op(*i); - } - pg_log.set_last_requested(0); - pull_from_peer.erase(j++); - } - - // remove from missing_loc_sources missing_loc_sources.erase(p++); } + pgbackend->check_recovery_sources(osdmap); + if (now_down.empty()) { dout(10) << "check_recovery_sources no source osds (" << missing_loc_sources << ") went down" << dendl; } else { diff --git a/src/osd/ReplicatedPG.h b/src/osd/ReplicatedPG.h index 557fc820877..0b438163908 100644 --- a/src/osd/ReplicatedPG.h +++ b/src/osd/ReplicatedPG.h @@ -148,6 +148,7 @@ public: void on_global_recover( const hobject_t &oid); void failed_push(int from, const hobject_t &soid); + void cancel_pull(const hobject_t &soid); template <typename T> class BlessedGenContext : public GenContext<T> { |