]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/PeeringState: rename last_update_ondisk to pg_committed_to
authorSamuel Just <sjust@redhat.com>
Thu, 28 Mar 2024 00:41:47 +0000 (17:41 -0700)
committerSamuel Just <sjust@redhat.com>
Fri, 18 Oct 2024 20:33:57 +0000 (20:33 +0000)
The name last_update_ondisk is misleading as it suggests a local
property like last_update_applied rather than a pg-global
property.  Clarify the name and add a much more specific comment.

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

index 744a1dbc02b974e1c090e2d31b4909b5832cb1c6..e9cf4841ff2a1b4a73d3578269ab23e3bf01325d 100644 (file)
@@ -1324,7 +1324,7 @@ void PG::log_operation(
   bool async) {
   logger().debug("{}", __func__);
   if (is_primary()) {
-    ceph_assert(trim_to <= peering_state.get_last_update_ondisk());
+    ceph_assert(trim_to <= peering_state.get_pg_committed_to());
   }
   /* TODO: when we add snap mapper and projected log support,
    * we'll likely want to update them here.
index c607d108c6ac3603b771cd1ada385c25a2d2573c..a3eee5e841d2a5111d388b0087d78e885f0f1841 100644 (file)
@@ -900,7 +900,7 @@ void PeeringState::clear_primary_state()
 
   clear_recovery_state();
 
-  last_update_ondisk = eversion_t();
+  pg_committed_to = eversion_t();
   missing_loc.clear();
   pl->clear_primary_state();
 }
@@ -2678,7 +2678,7 @@ void PeeringState::activate(
 
   min_last_complete_ondisk = eversion_t(0,0);  // we don't know (yet)!
   if (is_primary()) {
-    last_update_ondisk = info.last_update;
+    pg_committed_to = info.last_update;
   }
   last_update_applied = info.last_update;
   last_rollback_info_trimmed_to_applied = pg_log.get_can_rollback_to();
@@ -4440,7 +4440,7 @@ void PeeringState::recovery_committed_to(eversion_t version)
 
 void PeeringState::complete_write(eversion_t v, eversion_t lc)
 {
-  last_update_ondisk = v;
+  pg_committed_to = v;
   last_complete_ondisk = lc;
   calc_min_last_complete_ondisk();
 }
@@ -4487,7 +4487,7 @@ void PeeringState::calc_trim_to_aggressive()
   eversion_t limit = std::min({
     pg_log.get_head(),
     pg_log.get_can_rollback_to(),
-    last_update_ondisk});
+    pg_committed_to});
   psdout(10) << "limit = " << limit << dendl;
 
   if (limit != eversion_t() &&
@@ -7554,8 +7554,8 @@ ostream &operator<<(ostream &out, const PeeringState &ps) {
   }
 
   if (ps.is_peered()) {
-    if (ps.last_update_ondisk != ps.info.last_update)
-      out << " luod=" << ps.last_update_ondisk;
+    if (ps.pg_committed_to != ps.info.last_update)
+      out << " pct=" << ps.pg_committed_to;
     if (ps.last_update_applied != ps.info.last_update)
       out << " lua=" << ps.last_update_applied;
   }
index f81c77561fdbd305b84599c2bc5a12f0d303c6ec..69318395c05adee8e5ffb51f28cdd28c5600612d 100644 (file)
@@ -1470,8 +1470,23 @@ public:
 
   epoch_t last_peering_reset = 0;   ///< epoch of last peering reset
 
-  /// last_update that has committed; ONLY DEFINED WHEN is_active()
-  eversion_t  last_update_ondisk;
+  /**
+   * pg_committed_to
+   *
+   * Maintained on the primary while pg is at least peered.
+   *
+   * Forall e <= pg_committed_to, e has been committed on all replicas.
+   *
+   * As a consequence, if the pg is active (and not merely peered):
+   * - No version e <= pg_committed_to can become divergent
+   * - It is safe for replicas to read any object whose most recent update is
+   *   <= pg_committed_to
+   *
+   * Note that if the PG is only peered, it is in fact possible for
+   * pg_committed_to to become divergent.
+   */
+  eversion_t  pg_committed_to;
+
   eversion_t  last_complete_ondisk; ///< last_complete that has committed.
   eversion_t  last_update_applied;  ///< last_update readable
   /// last version to which rollback_info trimming has been applied
@@ -2413,8 +2428,8 @@ public:
     return last_update_applied;
   }
 
-  eversion_t get_last_update_ondisk() const {
-    return last_update_ondisk;
+  eversion_t get_pg_committed_to() const {
+    return pg_committed_to;
   }
 
   bool debug_has_dirty_state() const {
index 323b66e02a7be222737edcd5914a499f8e5a9c88..7daa648d72c7ea91fbe44563791e682462f15b29 100644 (file)
@@ -502,7 +502,7 @@ public:
     ObjectStore::Transaction &t,
     bool async = false) override {
     if (is_primary()) {
-      ceph_assert(trim_to <= recovery_state.get_last_update_ondisk());
+      ceph_assert(trim_to <= recovery_state.get_pg_committed_to());
     }
     if (hset_history) {
       recovery_state.update_hset(*hset_history);