]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/osd: keep track of last_peering_reset
authorKefu Chai <kchai@redhat.com>
Sat, 2 Mar 2019 04:55:01 +0000 (12:55 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 22 Mar 2019 05:21:32 +0000 (13:21 +0800)
last_peering_reset is used to track the epoch when the most recent peering
started. it is used to tell if a message is targeting a changed PG. the
sender of a peering message will attach it. and the recipient will check
it against its own last_peering_reset. for instance, if a message claims
that that its map epoch is 16, while our last_peering_reset is 18, we will
consider this message stale, and probably drop it.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/crimson/osd/pg.cc
src/crimson/osd/pg.h

index b2a566a39f4cbcde255d2bd5234f2e0ad07ff7c3..8d3f973f44e7b14c2eb4d03b98d497f1a4b3520b 100644 (file)
@@ -148,3 +148,13 @@ bool PG::is_primary() const
 {
   return whoami == primary;
 }
+
+epoch_t PG::get_last_peering_reset() const
+{
+  return last_peering_reset;
+}
+
+void PG::update_last_peering_reset()
+{
+  last_peering_reset = get_osdmap_epoch();
+}
index 72bb7a155a14dbfec8943fa466f83c33842dc40b..413f0e93d511f231e772b5cd659382a5d7372744 100644 (file)
@@ -47,6 +47,8 @@ public:
   pg_shard_t get_primary() const;
   bool is_primary() const;
   pg_shard_t get_whoami() const;
+  epoch_t get_last_peering_reset() const;
+  void update_last_peering_reset();
 
   seastar::future<> read_state(ceph::os::CyanStore* store);
 
@@ -59,6 +61,8 @@ private:
   const spg_t pgid;
   pg_shard_t whoami;
   pg_pool_t pool;
+
+  epoch_t last_peering_reset = 0;
   //< pg state
   pg_info_t info;
   //< last written info, for fast info persistence