]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/PeeringState: take HeartbeatStamps refs for current interval
authorSage Weil <sage@redhat.com>
Thu, 18 Jul 2019 19:28:33 +0000 (14:28 -0500)
committerSage Weil <sage@redhat.com>
Mon, 5 Aug 2019 18:53:25 +0000 (13:53 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/PG.cc
src/osd/PG.h
src/osd/PeeringState.cc
src/osd/PeeringState.h

index a829a778c85e0b794d8ebe509d1f84f9499e5cee..160639f743533eea494a1189d828b2469613d080 100644 (file)
@@ -1805,6 +1805,11 @@ ceph::signedspan PG::get_mnow()
   return osd->get_mnow();
 }
 
+HeartbeatStampsRef PG::get_hb_stamps(int peer)
+{
+  return osd->get_hb_stamps(peer);
+}
+
 void PG::rebuild_missing_set_with_deletes(PGLog &pglog)
 {
   pglog.rebuild_missing_set_with_deletes(
index 6c5963f763829018fb4b7f7b1fbeb991f2f37fae..b146081c51535fe5993b5572337f341fc93bf16b 100644 (file)
@@ -479,6 +479,7 @@ public:
   void send_pg_created(pg_t pgid) override;
 
   ceph::signedspan get_mnow() override;
+  HeartbeatStampsRef get_hb_stamps(int peer) override;
 
   void rebuild_missing_set_with_deletes(PGLog &pglog) override;
 
index 1ef59e153741e949234dcf2e9239cfa3fe63096e..e8a7af1f059798b0c46490d9f714e28b6cd1bcf0 100644 (file)
@@ -686,6 +686,8 @@ void PeeringState::on_new_interval()
     pg_log.get_missing().may_include_deletes ==
     !perform_deletes_during_peering());
 
+  init_hb_stamps();
+
   pl->on_new_interval();
 }
 
@@ -738,6 +740,29 @@ void PeeringState::init_primary_up_acting(
   }
 }
 
+void PeeringState::init_hb_stamps()
+{
+  if (is_primary()) {
+    // we care about all other osds in the acting set
+    hb_stamps.resize(acting.size() - 1);
+    unsigned i = 0;
+    for (auto p : acting) {
+      if (p == CRUSH_ITEM_NONE || p == get_primary().osd) {
+       continue;
+      }
+      hb_stamps[i++] = pl->get_hb_stamps(p);
+    }
+    hb_stamps.resize(i);
+  } else if (is_replica()) {
+    // we care about just the primary
+    hb_stamps.resize(1);
+    hb_stamps[0] = pl->get_hb_stamps(get_primary().osd);
+  } else {
+    hb_stamps.clear();
+  }
+}
+
+
 void PeeringState::clear_recovery_state()
 {
   async_recovery_targets.clear();
index d28d3350b93bbc2da9ec6929d06cd7a3971044b5..bb70ecfba73e904f3b476540256dec642580d3f9 100644 (file)
@@ -218,6 +218,7 @@ public:
     virtual void send_pg_created(pg_t pgid) = 0;
 
     virtual ceph::signedspan get_mnow() = 0;
+    virtual HeartbeatStampsRef get_hb_stamps(int peer) = 0;
 
     // ============ Flush state ==================
     /**
@@ -1330,6 +1331,8 @@ public:
   /// union of acting, recovery, and backfill targets
   set<pg_shard_t> acting_recovery_backfill;
 
+  vector<HeartbeatStampsRef> hb_stamps;
+
   bool send_notify = false; ///< True if a notify needs to be sent to the primary
 
   bool dirty_info = false;          ///< small info structu on disk out of date
@@ -1616,6 +1619,7 @@ public:
     const vector<int> &newacting,
     int new_up_primary,
     int new_acting_primary);
+  void init_hb_stamps();
 
   /// Set initial role
   void set_role(int r) {