]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/PeeringState: refine pg_committed_to semantics
authorSamuel Just <sjust@redhat.com>
Thu, 28 Mar 2024 00:52:25 +0000 (17:52 -0700)
committerSamuel Just <sjust@redhat.com>
Fri, 18 Oct 2024 20:33:57 +0000 (20:33 +0000)
Avoid maintaining pg_committed_to if pg is not active.  We can't
guarantee that last_update won't become divergent, so it doesn't
provide useful information.

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

index a3eee5e841d2a5111d388b0087d78e885f0f1841..5958c62c3457aba1fcd48730eab61b64f6ac8790 100644 (file)
@@ -2663,6 +2663,10 @@ void PeeringState::activate(
             info.last_epoch_started <= activation_epoch);
       info.last_epoch_started = activation_epoch;
       info.last_interval_started = info.history.same_interval_since;
+
+      // updating last_epoch_started ensures that last_update will not
+      // become divergent after activation completes.
+      pg_committed_to = info.last_update;
     }
   } else if (is_acting(pg_whoami)) {
     /* update last_epoch_started on acting replica to whatever the primary sent
@@ -2677,9 +2681,6 @@ void PeeringState::activate(
   auto &missing = pg_log.get_missing();
 
   min_last_complete_ondisk = eversion_t(0,0);  // we don't know (yet)!
-  if (is_primary()) {
-    pg_committed_to = info.last_update;
-  }
   last_update_applied = info.last_update;
   last_rollback_info_trimmed_to_applied = pg_log.get_can_rollback_to();
 
index 69318395c05adee8e5ffb51f28cdd28c5600612d..0a7b30823e60f3b1b045b8e38fc3e3c2f761b466 100644 (file)
@@ -1473,17 +1473,18 @@ public:
   /**
    * pg_committed_to
    *
-   * Maintained on the primary while pg is at least peered.
+   * Maintained on the primary while pg is active (and not merely 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):
+   * As a consequence:
    * - 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.
+   * Note that if the PG is only peered, pg_committed_to not be set
+   * and will remain eversion_t{} as we cannot guarantee that last_update
+   * at activation will not later become divergent.
    */
   eversion_t  pg_committed_to;