From: Samuel Just Date: Thu, 28 Mar 2024 00:41:47 +0000 (-0700) Subject: osd/PeeringState: rename last_update_ondisk to pg_committed_to X-Git-Tag: v20.0.0~707^2~21 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a5f66eef9d603e092b8b4bf0a9a89f6e040dfc17;p=ceph.git osd/PeeringState: rename last_update_ondisk to pg_committed_to 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 --- diff --git a/src/crimson/osd/pg.cc b/src/crimson/osd/pg.cc index 744a1dbc02b..e9cf4841ff2 100644 --- a/src/crimson/osd/pg.cc +++ b/src/crimson/osd/pg.cc @@ -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. diff --git a/src/osd/PeeringState.cc b/src/osd/PeeringState.cc index c607d108c6a..a3eee5e841d 100644 --- a/src/osd/PeeringState.cc +++ b/src/osd/PeeringState.cc @@ -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; } diff --git a/src/osd/PeeringState.h b/src/osd/PeeringState.h index f81c77561fd..69318395c05 100644 --- a/src/osd/PeeringState.h +++ b/src/osd/PeeringState.h @@ -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 { diff --git a/src/osd/PrimaryLogPG.h b/src/osd/PrimaryLogPG.h index 323b66e02a7..7daa648d72c 100644 --- a/src/osd/PrimaryLogPG.h +++ b/src/osd/PrimaryLogPG.h @@ -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);