From: Samuel Just Date: Thu, 28 Mar 2024 00:52:25 +0000 (-0700) Subject: osd/PeeringState: refine pg_committed_to semantics X-Git-Tag: v20.0.0~707^2~20 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=9d72303f96949b20ef756d9cc2fe87f39bf09953;p=ceph.git osd/PeeringState: refine pg_committed_to semantics 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 --- diff --git a/src/osd/PeeringState.cc b/src/osd/PeeringState.cc index a3eee5e841d2a..5958c62c3457a 100644 --- a/src/osd/PeeringState.cc +++ b/src/osd/PeeringState.cc @@ -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(); diff --git a/src/osd/PeeringState.h b/src/osd/PeeringState.h index 69318395c05ad..0a7b30823e60f 100644 --- a/src/osd/PeeringState.h +++ b/src/osd/PeeringState.h @@ -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;