]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: make PG::can_discard_replica_op() reusable for RecoveryBackend.
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Thu, 16 Dec 2021 09:57:24 +0000 (09:57 +0000)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Thu, 16 Dec 2021 13:03:46 +0000 (13:03 +0000)
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/crimson/osd/pg.cc
src/crimson/osd/pg.h

index fe3fa195f223d1f0fa61b3ab683c235a07563ee1..8213692f0a69892f3feb8e350528e4bb78a02dd7 100644 (file)
@@ -1116,8 +1116,7 @@ void PG::handle_rep_op_reply(crimson::net::ConnectionRef conn,
   }
 }
 
-template <typename MsgType>
-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;
index b78a44dd5538d9b40dc5d0c235772850aa53153d..7b5e1b6846bbd969a3c4ec0a6e8f137f28b60549 100644 (file)
@@ -707,6 +707,11 @@ public:
     return seastar::now();
   }
 
+  template <typename MsgType>
+  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<bool>(true);
   }
 
-  template <typename MsgType>
-  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);