]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/PrimaryLogPG: move earliest_backfill to PeeringState
authorSamuel Just <sjust@redhat.com>
Thu, 16 Jan 2020 19:40:40 +0000 (11:40 -0800)
committerXuehan Xu <xxhdx1985126@163.com>
Sun, 26 Apr 2020 07:46:34 +0000 (15:46 +0800)
We'll want this in crimson as well.

Signed-off-by: Samuel Just <sjust@redhat.com>
src/osd/PeeringState.cc
src/osd/PeeringState.h
src/osd/PrimaryLogPG.cc
src/osd/PrimaryLogPG.h

index 98484cc14fabe5439fcf848b5afd954630dbcb7d..36216664e2575389af0e4f7bbd975209c9c62b31 100644 (file)
@@ -258,6 +258,16 @@ void PeeringState::update_history(const pg_history_t& new_history)
   pl->on_info_history_change();
 }
 
+hobject_t PeeringState::earliest_backfill() const
+{
+  hobject_t e = hobject_t::get_max();
+  for (const pg_shard_t& bt : get_backfill_targets()) {
+    const pg_info_t &pi = get_peer_info(bt);
+    e = std::min(pi.last_backfill, e);
+  }
+  return e;
+}
+
 void PeeringState::purge_strays()
 {
   if (is_premerge()) {
index fa2ca6ec767829e21b9bd028906ad635edcea1d6..e7ad22815678b6c9f188e534da6fb03d82cec112 100644 (file)
@@ -1795,6 +1795,12 @@ public:
     bool transaction_applied,
     bool async);
 
+  /**
+   * retrieve the min last_backfill among backfill targets
+   */
+  hobject_t earliest_backfill() const;
+
+
   /**
    * Updates local log/missing to reflect new oob log update from primary
    */
index aa80a8f588dd3087e3f934601e97f5ce4f509a5c..f5b7062b42e2a1977980815d9da143e7d964b62f 100644 (file)
@@ -1818,16 +1818,6 @@ void PrimaryLogPG::do_request(
   }
 }
 
-hobject_t PrimaryLogPG::earliest_backfill() const
-{
-  hobject_t e = hobject_t::get_max();
-  for (const pg_shard_t& bt : get_backfill_targets()) {
-    const pg_info_t &pi = recovery_state.get_peer_info(bt);
-    e = std::min(pi.last_backfill, e);
-  }
-  return e;
-}
-
 /** do_op - do an op
  * pg lock will be held (if multithreaded)
  * osd_lock NOT held.
@@ -12164,7 +12154,7 @@ void PrimaryLogPG::on_activate_complete()
   publish_stats_to_osd();
 
   if (get_backfill_targets().size()) {
-    last_backfill_started = earliest_backfill();
+    last_backfill_started = recovery_state.earliest_backfill();
     new_backfill = true;
     ceph_assert(!last_backfill_started.is_max());
     dout(5) << __func__ << ": bft=" << get_backfill_targets()
@@ -12997,7 +12987,7 @@ uint64_t PrimaryLogPG::recover_backfill(
   // Initialize from prior backfill state
   if (new_backfill) {
     // on_activate() was called prior to getting here
-    ceph_assert(last_backfill_started == earliest_backfill());
+    ceph_assert(last_backfill_started == recovery_state.earliest_backfill());
     new_backfill = false;
 
     // initialize BackfillIntervals
@@ -13263,7 +13253,7 @@ uint64_t PrimaryLogPG::recover_backfill(
 
   hobject_t next_backfill_to_complete = backfills_in_flight.empty() ?
     backfill_pos : *(backfills_in_flight.begin());
-  hobject_t new_last_backfill = earliest_backfill();
+  hobject_t new_last_backfill = recovery_state.earliest_backfill();
   dout(10) << "starting new_last_backfill at " << new_last_backfill << dendl;
   for (map<hobject_t, pg_stat_t>::iterator i =
         pending_backfill_updates.begin();
index f7b2e32fc3ffc0c3a5f4e0c7ac7d9409cfa34a26..57d153727a365b329b332a40aa606fd3ffb638c9 100644 (file)
@@ -1557,7 +1557,6 @@ public:
   void do_osd_op_effects(OpContext *ctx, const ConnectionRef& conn);
 private:
   int do_scrub_ls(const MOSDOp *op, OSDOp *osd_op);
-  hobject_t earliest_backfill() const;
   bool check_src_targ(const hobject_t& soid, const hobject_t& toid) const;
 
   uint64_t temp_seq; ///< last id for naming temp objects