From: Radoslaw Zarzynski Date: Thu, 16 Dec 2021 16:31:35 +0000 (+0000) Subject: crimson/osd: dissect the lpr check into PG::old_peering_msg(). X-Git-Tag: v17.1.0~218^2~2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=e73edb69a0f8aa9a9adaa6ba0ef5d0a7d3556dad;p=ceph.git crimson/osd: dissect the lpr check into PG::old_peering_msg(). Signed-off-by: Radoslaw Zarzynski --- diff --git a/src/crimson/osd/pg.cc b/src/crimson/osd/pg.cc index 8213692f0a698..8ad1198e099cd 100644 --- a/src/crimson/osd/pg.cc +++ b/src/crimson/osd/pg.cc @@ -1116,6 +1116,17 @@ void PG::handle_rep_op_reply(crimson::net::ConnectionRef conn, } } +bool PG::old_peering_msg(const epoch_t map_epoch) const +{ + if (const epoch_t lpr = peering_state.get_last_peering_reset(); + lpr > map_epoch) { + logger().debug("{}: pg changed {} after {}, dropping", + __func__, get_info().history, map_epoch); + return true; + } + return false; +} + 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 @@ -1139,13 +1150,7 @@ bool PG::can_discard_replica_op(const Message& m, epoch_t m_map_epoch) const } // 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) { - logger().debug("{}: pg changed {} after {}, dropping", - __func__, get_info().history, m_map_epoch); - return true; - } - return false; + return old_peering_msg(m_map_epoch); } seastar::future<> PG::stop() diff --git a/src/crimson/osd/pg.h b/src/crimson/osd/pg.h index 7b5e1b6846bbd..0bf2e0c686fb7 100644 --- a/src/crimson/osd/pg.h +++ b/src/crimson/osd/pg.h @@ -707,6 +707,8 @@ public: return seastar::now(); } + bool old_peering_msg(epoch_t map_epoch) const; + template bool can_discard_replica_op(const MsgType& m) const { return can_discard_replica_op(m, m.map_epoch);