]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
osd/: move calc_min_last_complete_ondisk to PeeringState
authorSamuel Just <sjust@redhat.com>
Tue, 2 Apr 2019 18:55:49 +0000 (11:55 -0700)
committersjust@redhat.com <sjust@redhat.com>
Wed, 1 May 2019 18:22:23 +0000 (11:22 -0700)
Signed-off-by: Samuel Just <sjust@redhat.com>
src/osd/PG.h
src/osd/PeeringState.cc
src/osd/PeeringState.h
src/osd/PrimaryLogPG.cc

index c46c3558eff539e189a9ab117fd9dfc7c17334c2..faab25bafbef5e09bcfda3db0c37546980dfcbb8 100644 (file)
@@ -1009,25 +1009,6 @@ protected:
 
   bool all_unfound_are_queried_or_lost(const OSDMapRef osdmap) const;
 
-  void calc_min_last_complete_ondisk() {
-    eversion_t min = last_complete_ondisk;
-    ceph_assert(!acting_recovery_backfill.empty());
-    for (set<pg_shard_t>::iterator i = acting_recovery_backfill.begin();
-        i != acting_recovery_backfill.end();
-        ++i) {
-      if (*i == get_primary()) continue;
-      if (peer_last_complete_ondisk.count(*i) == 0)
-       return;   // we don't have complete info
-      eversion_t a = peer_last_complete_ondisk[*i];
-      if (a < min)
-       min = a;
-    }
-    if (min == min_last_complete_ondisk)
-      return;
-    min_last_complete_ondisk = min;
-    return;
-  }
-
   virtual void calc_trim_to() = 0;
 
   virtual void calc_trim_to_aggressive() = 0;
index b8627871c0e10bb9526a50894b6f5f9e56d0b856..0ca44372c2376cdedcaec0168299f26f9f230cf2 100644 (file)
@@ -4040,7 +4040,7 @@ boost::statechart::result PeeringState::Active::react(const MTrim& trim)
   ps->peer_last_complete_ondisk[pg_shard_t(trim.from, trim.shard)] = trim.trim_to;
 
   // trim log when the pg is recovered
-  pg->calc_min_last_complete_ondisk();
+  ps->calc_min_last_complete_ondisk();
   return discard_event();
 }
 
index f718db0a3b2f6c5995a7224bee4bb0a81c4fa663..26ad16c89290f8f035311f99558364e4c887510d 100644 (file)
@@ -1382,6 +1382,25 @@ public:
   void proc_replica_log(pg_info_t &oinfo, const pg_log_t &olog,
                        pg_missing_t& omissing, pg_shard_t from);
 
+  void calc_min_last_complete_ondisk() {
+    eversion_t min = last_complete_ondisk;
+    ceph_assert(!acting_recovery_backfill.empty());
+    for (set<pg_shard_t>::iterator i = acting_recovery_backfill.begin();
+        i != acting_recovery_backfill.end();
+        ++i) {
+      if (*i == get_primary()) continue;
+      if (peer_last_complete_ondisk.count(*i) == 0)
+       return;   // we don't have complete info
+      eversion_t a = peer_last_complete_ondisk[*i];
+      if (a < min)
+       min = a;
+    }
+    if (min == min_last_complete_ondisk)
+      return;
+    min_last_complete_ondisk = min;
+    return;
+  }
+
   void fulfill_info(
     pg_shard_t from, const pg_query_t &query,
     pair<pg_shard_t, pg_info_t> &notify_info);
@@ -1619,6 +1638,10 @@ public:
     return missing_loc.num_unfound();
   }
 
+  eversion_t get_min_last_complete_ondisk() const {
+    return min_last_complete_ondisk;
+  }
+
 private:
   void apply_peer_features(uint64_t f) { peer_features &= f; }
   void reset_min_peer_features() {
index 745ed6544683dfb4c78f64b2ddac19c041508ba2..a1a020b381f6ed9201b2d0369db8c05f7a37a451 100644 (file)
@@ -10488,7 +10488,7 @@ void PrimaryLogPG::eval_repop(RepGather *repop)
     }
 
     publish_stats_to_osd();
-    calc_min_last_complete_ondisk();
+    recovery_state.calc_min_last_complete_ondisk();
 
     dout(10) << " removing " << *repop << dendl;
     ceph_assert(!repop_queue.empty());
@@ -11619,7 +11619,7 @@ void PrimaryLogPG::_committed_pushed_object(
            last_complete_ondisk),
          get_osdmap_epoch());
       } else {
-       calc_min_last_complete_ondisk();
+       recovery_state.calc_min_last_complete_ondisk();
       }
     }