From 8907010dee2b001d53b0923070b5d48e76425dbf Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Tue, 2 Apr 2019 11:55:49 -0700 Subject: [PATCH] osd/: move calc_min_last_complete_ondisk to PeeringState Signed-off-by: Samuel Just --- src/osd/PG.h | 19 ------------------- src/osd/PeeringState.cc | 2 +- src/osd/PeeringState.h | 23 +++++++++++++++++++++++ src/osd/PrimaryLogPG.cc | 4 ++-- 4 files changed, 26 insertions(+), 22 deletions(-) diff --git a/src/osd/PG.h b/src/osd/PG.h index c46c3558eff..faab25bafbe 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -1009,25 +1009,6 @@ protected: bool all_unfound_are_queried_or_lost(const OSDMapRef osdmap) const; - void calc_min_last_complete_ondisk() { - eversion_t min = last_complete_ondisk; - ceph_assert(!acting_recovery_backfill.empty()); - for (set::iterator i = acting_recovery_backfill.begin(); - i != acting_recovery_backfill.end(); - ++i) { - if (*i == get_primary()) continue; - if (peer_last_complete_ondisk.count(*i) == 0) - return; // we don't have complete info - eversion_t a = peer_last_complete_ondisk[*i]; - if (a < min) - min = a; - } - if (min == min_last_complete_ondisk) - return; - min_last_complete_ondisk = min; - return; - } - virtual void calc_trim_to() = 0; virtual void calc_trim_to_aggressive() = 0; diff --git a/src/osd/PeeringState.cc b/src/osd/PeeringState.cc index b8627871c0e..0ca44372c23 100644 --- a/src/osd/PeeringState.cc +++ b/src/osd/PeeringState.cc @@ -4040,7 +4040,7 @@ boost::statechart::result PeeringState::Active::react(const MTrim& trim) ps->peer_last_complete_ondisk[pg_shard_t(trim.from, trim.shard)] = trim.trim_to; // trim log when the pg is recovered - pg->calc_min_last_complete_ondisk(); + ps->calc_min_last_complete_ondisk(); return discard_event(); } diff --git a/src/osd/PeeringState.h b/src/osd/PeeringState.h index f718db0a3b2..26ad16c8929 100644 --- a/src/osd/PeeringState.h +++ b/src/osd/PeeringState.h @@ -1382,6 +1382,25 @@ public: void proc_replica_log(pg_info_t &oinfo, const pg_log_t &olog, pg_missing_t& omissing, pg_shard_t from); + void calc_min_last_complete_ondisk() { + eversion_t min = last_complete_ondisk; + ceph_assert(!acting_recovery_backfill.empty()); + for (set::iterator i = acting_recovery_backfill.begin(); + i != acting_recovery_backfill.end(); + ++i) { + if (*i == get_primary()) continue; + if (peer_last_complete_ondisk.count(*i) == 0) + return; // we don't have complete info + eversion_t a = peer_last_complete_ondisk[*i]; + if (a < min) + min = a; + } + if (min == min_last_complete_ondisk) + return; + min_last_complete_ondisk = min; + return; + } + void fulfill_info( pg_shard_t from, const pg_query_t &query, pair ¬ify_info); @@ -1619,6 +1638,10 @@ public: return missing_loc.num_unfound(); } + eversion_t get_min_last_complete_ondisk() const { + return min_last_complete_ondisk; + } + private: void apply_peer_features(uint64_t f) { peer_features &= f; } void reset_min_peer_features() { diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 745ed654468..a1a020b381f 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -10488,7 +10488,7 @@ void PrimaryLogPG::eval_repop(RepGather *repop) } publish_stats_to_osd(); - calc_min_last_complete_ondisk(); + recovery_state.calc_min_last_complete_ondisk(); dout(10) << " removing " << *repop << dendl; ceph_assert(!repop_queue.empty()); @@ -11619,7 +11619,7 @@ void PrimaryLogPG::_committed_pushed_object( last_complete_ondisk), get_osdmap_epoch()); } else { - calc_min_last_complete_ondisk(); + recovery_state.calc_min_last_complete_ondisk(); } } -- 2.39.5