From: Samuel Just Date: Thu, 16 Jan 2020 19:40:40 +0000 (-0800) Subject: osd/PrimaryLogPG: move earliest_backfill to PeeringState X-Git-Tag: wip-pdonnell-testing-20200918.022351~1425^2~14 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=6723922b4e3e355033a57898e692b36820e8e88e;p=ceph-ci.git osd/PrimaryLogPG: move earliest_backfill to PeeringState We'll want this in crimson as well. Signed-off-by: Samuel Just --- diff --git a/src/osd/PeeringState.cc b/src/osd/PeeringState.cc index 98484cc14fa..36216664e25 100644 --- a/src/osd/PeeringState.cc +++ b/src/osd/PeeringState.cc @@ -258,6 +258,16 @@ void PeeringState::update_history(const pg_history_t& new_history) pl->on_info_history_change(); } +hobject_t PeeringState::earliest_backfill() const +{ + hobject_t e = hobject_t::get_max(); + for (const pg_shard_t& bt : get_backfill_targets()) { + const pg_info_t &pi = get_peer_info(bt); + e = std::min(pi.last_backfill, e); + } + return e; +} + void PeeringState::purge_strays() { if (is_premerge()) { diff --git a/src/osd/PeeringState.h b/src/osd/PeeringState.h index fa2ca6ec767..e7ad2281567 100644 --- a/src/osd/PeeringState.h +++ b/src/osd/PeeringState.h @@ -1795,6 +1795,12 @@ public: bool transaction_applied, bool async); + /** + * retrieve the min last_backfill among backfill targets + */ + hobject_t earliest_backfill() const; + + /** * Updates local log/missing to reflect new oob log update from primary */ diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index aa80a8f588d..f5b7062b42e 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -1818,16 +1818,6 @@ void PrimaryLogPG::do_request( } } -hobject_t PrimaryLogPG::earliest_backfill() const -{ - hobject_t e = hobject_t::get_max(); - for (const pg_shard_t& bt : get_backfill_targets()) { - const pg_info_t &pi = recovery_state.get_peer_info(bt); - e = std::min(pi.last_backfill, e); - } - return e; -} - /** do_op - do an op * pg lock will be held (if multithreaded) * osd_lock NOT held. @@ -12164,7 +12154,7 @@ void PrimaryLogPG::on_activate_complete() publish_stats_to_osd(); if (get_backfill_targets().size()) { - last_backfill_started = earliest_backfill(); + last_backfill_started = recovery_state.earliest_backfill(); new_backfill = true; ceph_assert(!last_backfill_started.is_max()); dout(5) << __func__ << ": bft=" << get_backfill_targets() @@ -12997,7 +12987,7 @@ uint64_t PrimaryLogPG::recover_backfill( // Initialize from prior backfill state if (new_backfill) { // on_activate() was called prior to getting here - ceph_assert(last_backfill_started == earliest_backfill()); + ceph_assert(last_backfill_started == recovery_state.earliest_backfill()); new_backfill = false; // initialize BackfillIntervals @@ -13263,7 +13253,7 @@ uint64_t PrimaryLogPG::recover_backfill( hobject_t next_backfill_to_complete = backfills_in_flight.empty() ? backfill_pos : *(backfills_in_flight.begin()); - hobject_t new_last_backfill = earliest_backfill(); + hobject_t new_last_backfill = recovery_state.earliest_backfill(); dout(10) << "starting new_last_backfill at " << new_last_backfill << dendl; for (map::iterator i = pending_backfill_updates.begin(); diff --git a/src/osd/PrimaryLogPG.h b/src/osd/PrimaryLogPG.h index f7b2e32fc3f..57d153727a3 100644 --- a/src/osd/PrimaryLogPG.h +++ b/src/osd/PrimaryLogPG.h @@ -1557,7 +1557,6 @@ public: void do_osd_op_effects(OpContext *ctx, const ConnectionRef& conn); private: int do_scrub_ls(const MOSDOp *op, OSDOp *osd_op); - hobject_t earliest_backfill() const; bool check_src_targ(const hobject_t& soid, const hobject_t& toid) const; uint64_t temp_seq; ///< last id for naming temp objects