]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd,crimson/osd: roll_forward_to->pg_committed_to for MOSDPGUpdateLogMissing and...
authorSamuel Just <sjust@redhat.com>
Thu, 28 Mar 2024 02:38:27 +0000 (19:38 -0700)
committerSamuel Just <sjust@redhat.com>
Sat, 19 Oct 2024 01:40:10 +0000 (01:40 +0000)
Signed-off-by: Samuel Just <sjust@redhat.com>
src/crimson/osd/pg.cc
src/messages/MOSDPGUpdateLogMissing.h
src/osd/PeeringState.cc
src/osd/PeeringState.h
src/osd/PrimaryLogPG.cc

index 86941f10516884a2a97d97fdf1a6e584f54df54c..0b5dcaa0eec411e609df953f838f589b6fffb431 100644 (file)
@@ -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<eversion_t> op_trim_to, op_roll_forward_to;
+  std::optional<eversion_t> 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(
index 2a0011e8fb7c85d9d81e5650d4e9c9c0131d587a..ebe678c6c313f381e92940c85491d550a2e9d353 100644 (file)
@@ -31,7 +31,23 @@ public:
   mempool::osd_pglog::list<pg_log_entry_t> 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:
index 481581d6affc98ce2afb51d442af8a6b52e3dfe3..955832fb81087cd62f8785a908385ddcb1410cc3 100644 (file)
@@ -4076,7 +4076,7 @@ void PeeringState::update_stats_wo_resched(
 bool PeeringState::append_log_entries_update_missing(
   const mempool::osd_pglog::list<pg_log_entry_t> &entries,
   ObjectStore::Transaction &t, std::optional<eversion_t> trim_to,
-  std::optional<eversion_t> roll_forward_to)
+  std::optional<eversion_t> 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<pg_log_entry_t> &entries,
   ObjectStore::Transaction &t,
   std::optional<eversion_t> trim_to,
-  std::optional<eversion_t> roll_forward_to)
+  std::optional<eversion_t> 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) {
index 234a24c7a75832a0c87797d786d61a809988b56b..baa818e33f3c77eb8cc3cb7d6ec5a08dacded7ff 100644 (file)
@@ -1915,7 +1915,7 @@ public:
     const mempool::osd_pglog::list<pg_log_entry_t> &entries,
     ObjectStore::Transaction &t,
     std::optional<eversion_t> trim_to,
-    std::optional<eversion_t> roll_forward_to);
+    std::optional<eversion_t> pg_committed_to);
 
   /**
    * Updates local log to reflect new write from primary.
@@ -1942,7 +1942,7 @@ public:
     const mempool::osd_pglog::list<pg_log_entry_t> &entries,
     ObjectStore::Transaction &t,
     std::optional<eversion_t> trim_to,
-    std::optional<eversion_t> roll_forward_to);
+    std::optional<eversion_t> 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) {
index be2eddd54790a5e570516056b4af590f79168af7..563658464443fcfad75735d226770950d668de9d 100644 (file)
@@ -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<eversion_t> op_trim_to, op_roll_forward_to;
+  std::optional<eversion_t> 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(