From: Samuel Just Date: Thu, 28 Mar 2024 02:38:27 +0000 (-0700) Subject: osd,crimson/osd: roll_forward_to->pg_committed_to for MOSDPGUpdateLogMissing and... X-Git-Tag: v20.0.0~707^2~16 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=407350daf1cfa08df8aa08b4998d3b73e6361c92;p=ceph.git osd,crimson/osd: roll_forward_to->pg_committed_to for MOSDPGUpdateLogMissing and related Signed-off-by: Samuel Just --- diff --git a/src/crimson/osd/pg.cc b/src/crimson/osd/pg.cc index 86941f10516..0b5dcaa0eec 100644 --- a/src/crimson/osd/pg.cc +++ b/src/crimson/osd/pg.cc @@ -1387,17 +1387,17 @@ PG::interruptible_future<> PG::do_update_log_missing( ceph_assert(m->get_type() == MSG_OSD_PG_UPDATE_LOG_MISSING); ObjectStore::Transaction t; - std::optional op_trim_to, op_roll_forward_to; + std::optional op_trim_to, op_pg_committed_to; if (m->pg_trim_to != eversion_t()) op_trim_to = m->pg_trim_to; - if (m->pg_roll_forward_to != eversion_t()) - op_roll_forward_to = m->pg_roll_forward_to; - logger().debug("op_trim_to = {}, op_roll_forward_to = {}", + if (m->pg_committed_to != eversion_t()) + op_pg_committed_to = m->pg_committed_to; + logger().debug("op_trim_to = {}, op_pg_committed_to = {}", op_trim_to.has_value() ? *op_trim_to : eversion_t(), - op_roll_forward_to.has_value() ? *op_roll_forward_to : eversion_t()); + op_pg_committed_to.has_value() ? *op_pg_committed_to : eversion_t()); peering_state.append_log_entries_update_missing( - m->entries, t, op_trim_to, op_roll_forward_to); + m->entries, t, op_trim_to, op_pg_committed_to); return interruptor::make_interruptible(shard_services.get_store().do_transaction( coll_ref, std::move(t))).then_interruptible( diff --git a/src/messages/MOSDPGUpdateLogMissing.h b/src/messages/MOSDPGUpdateLogMissing.h index 2a0011e8fb7..ebe678c6c31 100644 --- a/src/messages/MOSDPGUpdateLogMissing.h +++ b/src/messages/MOSDPGUpdateLogMissing.h @@ -31,7 +31,23 @@ public: mempool::osd_pglog::list entries; // piggybacked osd/pg state eversion_t pg_trim_to; // primary->replica: trim to here - eversion_t pg_roll_forward_to; // primary->replica: trim rollback info to here + + /** + * pg_committed_to + * + * Propagates PeeringState::pg_committed_to to replicas as with + * MOSDRepOp, ECSubWrite + * + * Historical Note: Prior to early 2024, this field was named + * pg_roll_forward_to. pg_committed_to is a safe value to rollforward to as + * it is a conservative bound on versions that can become divergent. Switching + * it to be populated by pg_committed_to rather than mlcod mirrors MOSDRepOp + * and upgrade cases in both directions should be safe as mlcod is <= pct + * and replicas (both ec and replicated) only actually rely on versions <= this + * field being non-divergent. This note may be removed in main after U is + * released. + */ + eversion_t pg_committed_to; epoch_t get_epoch() const { return map_epoch; } spg_t get_pgid() const { return pgid; } @@ -59,7 +75,7 @@ public: epoch_t min_epoch, ceph_tid_t rep_tid, eversion_t pg_trim_to, - eversion_t pg_roll_forward_to) + eversion_t pg_committed_to) : MOSDFastDispatchOp{MSG_OSD_PG_UPDATE_LOG_MISSING, HEAD_VERSION, COMPAT_VERSION}, map_epoch(epoch), @@ -69,7 +85,7 @@ public: rep_tid(rep_tid), entries(entries), pg_trim_to(pg_trim_to), - pg_roll_forward_to(pg_roll_forward_to) + pg_committed_to(pg_committed_to) {} private: @@ -83,7 +99,7 @@ public: << " rep_tid " << rep_tid << " entries " << entries << " trim_to " << pg_trim_to - << " roll_forward_to " << pg_roll_forward_to + << " pg_committed_to " << pg_committed_to << ")"; } @@ -96,7 +112,7 @@ public: encode(entries, payload); encode(min_epoch, payload); encode(pg_trim_to, payload); - encode(pg_roll_forward_to, payload); + encode(pg_committed_to, payload); } void decode_payload() override { using ceph::decode; @@ -113,7 +129,7 @@ public: } if (header.version >= 3) { decode(pg_trim_to, p); - decode(pg_roll_forward_to, p); + decode(pg_committed_to, p); } } private: diff --git a/src/osd/PeeringState.cc b/src/osd/PeeringState.cc index 481581d6aff..955832fb810 100644 --- a/src/osd/PeeringState.cc +++ b/src/osd/PeeringState.cc @@ -4076,7 +4076,7 @@ void PeeringState::update_stats_wo_resched( bool PeeringState::append_log_entries_update_missing( const mempool::osd_pglog::list &entries, ObjectStore::Transaction &t, std::optional trim_to, - std::optional roll_forward_to) + std::optional pg_committed_to) { ceph_assert(!entries.empty()); ceph_assert(entries.begin()->version > info.last_update); @@ -4088,12 +4088,12 @@ bool PeeringState::append_log_entries_update_missing( entries, rollbacker.get()); - if (roll_forward_to && entries.rbegin()->soid > info.last_backfill) { + if (pg_committed_to && entries.rbegin()->soid > info.last_backfill) { pg_log.roll_forward(rollbacker.get()); } - if (roll_forward_to && *roll_forward_to > pg_log.get_can_rollback_to()) { - pg_log.roll_forward_to(*roll_forward_to, rollbacker.get()); - last_rollback_info_trimmed_to_applied = *roll_forward_to; + if (pg_committed_to && *pg_committed_to > pg_log.get_can_rollback_to()) { + pg_log.roll_forward_to(*pg_committed_to, rollbacker.get()); + last_rollback_info_trimmed_to_applied = *pg_committed_to; } info.last_update = pg_log.get_head(); @@ -4117,13 +4117,13 @@ void PeeringState::merge_new_log_entries( const mempool::osd_pglog::list &entries, ObjectStore::Transaction &t, std::optional trim_to, - std::optional roll_forward_to) + std::optional pg_committed_to) { psdout(10) << entries << dendl; ceph_assert(is_primary()); bool rebuild_missing = append_log_entries_update_missing( - entries, t, trim_to, roll_forward_to); + entries, t, trim_to, pg_committed_to); for (auto i = acting_recovery_backfill.begin(); i != acting_recovery_backfill.end(); ++i) { diff --git a/src/osd/PeeringState.h b/src/osd/PeeringState.h index 234a24c7a75..baa818e33f3 100644 --- a/src/osd/PeeringState.h +++ b/src/osd/PeeringState.h @@ -1915,7 +1915,7 @@ public: const mempool::osd_pglog::list &entries, ObjectStore::Transaction &t, std::optional trim_to, - std::optional roll_forward_to); + std::optional pg_committed_to); /** * Updates local log to reflect new write from primary. @@ -1942,7 +1942,7 @@ public: const mempool::osd_pglog::list &entries, ObjectStore::Transaction &t, std::optional trim_to, - std::optional roll_forward_to); + std::optional pg_committed_to); /// Update missing set to reflect e (TODOSAM: not sure why this is needed) void add_local_next_event(const pg_log_entry_t& e) { diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index be2eddd5479..56365846444 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -12644,18 +12644,18 @@ void PrimaryLogPG::do_update_log_missing(OpRequestRef &op) op->get_req()); ceph_assert(m->get_type() == MSG_OSD_PG_UPDATE_LOG_MISSING); ObjectStore::Transaction t; - std::optional op_trim_to, op_roll_forward_to; + std::optional op_trim_to, op_pg_committed_to; if (m->pg_trim_to != eversion_t()) op_trim_to = m->pg_trim_to; - if (m->pg_roll_forward_to != eversion_t()) - op_roll_forward_to = m->pg_roll_forward_to; + if (m->pg_committed_to != eversion_t()) + op_pg_committed_to = m->pg_committed_to; dout(20) << __func__ - << " op_trim_to = " << op_trim_to << " op_roll_forward_to = " - << op_roll_forward_to << dendl; + << " op_trim_to = " << op_trim_to << " op_pg_committed_to = " + << op_pg_committed_to << dendl; recovery_state.append_log_entries_update_missing( - m->entries, t, op_trim_to, op_roll_forward_to); + m->entries, t, op_trim_to, op_pg_committed_to); eversion_t new_lcod = info.last_complete; Context *complete = new LambdaContext(