From: Radoslaw Zarzynski Date: Thu, 16 Dec 2021 09:57:24 +0000 (+0000) Subject: crimson/osd: make PG::can_discard_replica_op() reusable for RecoveryBackend. X-Git-Tag: v17.1.0~170^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f01b68f5be8fbe3b4489f6a3f96b624bd3aa44a9;p=ceph.git crimson/osd: make PG::can_discard_replica_op() reusable for RecoveryBackend. Signed-off-by: Radoslaw Zarzynski --- diff --git a/src/crimson/osd/pg.cc b/src/crimson/osd/pg.cc index fe3fa195f22..8213692f0a6 100644 --- a/src/crimson/osd/pg.cc +++ b/src/crimson/osd/pg.cc @@ -1116,8 +1116,7 @@ void PG::handle_rep_op_reply(crimson::net::ConnectionRef conn, } } -template -bool PG::can_discard_replica_op(const MsgType& m) const +bool PG::can_discard_replica_op(const Message& m, epoch_t m_map_epoch) const { // if a repop is replied after a replica goes down in a new osdmap, and // before the pg advances to this new osdmap, the repop replies before this @@ -1135,15 +1134,15 @@ bool PG::can_discard_replica_op(const MsgType& m) const // sent by replicas not in the acting set, since // if such a replica goes down it does not cause // a new interval. - if (osdmap->get_down_at(from_osd) >= m.map_epoch) { + if (osdmap->get_down_at(from_osd) >= m_map_epoch) { return true; } // same pg? // if pg changes *at all*, we reset and repeer! if (epoch_t lpr = peering_state.get_last_peering_reset(); - lpr > m.map_epoch) { + lpr > m_map_epoch) { logger().debug("{}: pg changed {} after {}, dropping", - __func__, get_info().history, m.map_epoch); + __func__, get_info().history, m_map_epoch); return true; } return false; diff --git a/src/crimson/osd/pg.h b/src/crimson/osd/pg.h index b78a44dd553..7b5e1b6846b 100644 --- a/src/crimson/osd/pg.h +++ b/src/crimson/osd/pg.h @@ -707,6 +707,11 @@ public: return seastar::now(); } + template + bool can_discard_replica_op(const MsgType& m) const { + return can_discard_replica_op(m, m.map_epoch); + } + private: // instead of seastar::gate, we use a boolean flag to indicate // whether the system is shutting down, as we don't need to track @@ -746,8 +751,7 @@ private: return seastar::make_ready_future(true); } - template - bool can_discard_replica_op(const MsgType& m) const; + bool can_discard_replica_op(const Message& m, epoch_t m_map_epoch) const; bool can_discard_op(const MOSDOp& m) const; bool is_missing_object(const hobject_t& soid) const { return peering_state.get_pg_log().get_missing().get_items().count(soid);