]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd/replicated_backend: don't put pg's metadata updates in 53521/head
authorXuehan Xu <xuxuehan@qianxin.com>
Tue, 19 Sep 2023 05:45:16 +0000 (13:45 +0800)
committerXuehan Xu <xuxuehan@qianxin.com>
Mon, 25 Sep 2023 02:56:28 +0000 (10:56 +0800)
repops

Fixes: https://tracker.ceph.com/issues/62857
Signed-off-by: Xuehan Xu <xuxuehan@qianxin.com>
src/crimson/osd/pg.cc
src/crimson/osd/pg_backend.cc
src/crimson/osd/pg_backend.h
src/crimson/osd/replicated_backend.cc
src/crimson/osd/replicated_backend.h

index 7cf3b158c89cfff19e0bd55ba49270048816136f..2bd1bfc5bf3166fa81cd547c6ce913703561d73d 100644 (file)
@@ -115,6 +115,7 @@ PG::PG(
        pgid.pgid,
        pg_shard,
        pool,
+        *this,
        coll_ref,
        shard_services,
        profile,
@@ -761,8 +762,7 @@ PG::submit_transaction(
   ceph_assert(!has_reset_since(osd_op_p.at_version.epoch));
 
   peering_state.pre_submit_op(obc->obs.oi.soid, log_entries, osd_op_p.at_version);
-  peering_state.append_log_with_trim_to_updated(std::move(log_entries), osd_op_p.at_version,
-                                               txn, true, false);
+  peering_state.update_trim_to();
 
   auto [submitted, all_completed] = backend->mutate_object(
       peering_state.get_acting_recovery_backfill(),
index 02acb9a55d3f5a0685a7da222ba39fcc7ffe2c9f..06bcf7bbd03635174d4897feb7d69d92ca38b7aa 100644 (file)
@@ -23,6 +23,7 @@
 #include "crimson/os/futurized_store.h"
 #include "crimson/osd/osd_operation.h"
 #include "crimson/osd/object_context_loader.h"
+#include "crimson/osd/pg.h"
 #include "replicated_backend.h"
 #include "replicated_recovery_backend.h"
 #include "ec_backend.h"
@@ -43,6 +44,7 @@ std::unique_ptr<PGBackend>
 PGBackend::create(pg_t pgid,
                  const pg_shard_t pg_shard,
                  const pg_pool_t& pool,
+                 crimson::osd::PG& pg,
                  crimson::os::CollectionRef coll,
                  crimson::osd::ShardServices& shard_services,
                  const ec_profile_t& ec_profile,
@@ -50,7 +52,7 @@ PGBackend::create(pg_t pgid,
 {
   switch (pool.type) {
   case pg_pool_t::TYPE_REPLICATED:
-    return std::make_unique<ReplicatedBackend>(pgid, pg_shard,
+    return std::make_unique<ReplicatedBackend>(pgid, pg_shard, pg,
                                               coll, shard_services,
                                               dpp);
   case pg_pool_t::TYPE_ERASURE:
index fbad37d4c71c2f6e82b2ec301e34be63c2530871..d681726576ffb4789771aa010796b4dd06bda79d 100644 (file)
@@ -70,6 +70,7 @@ public:
   static std::unique_ptr<PGBackend> create(pg_t pgid,
                                           const pg_shard_t pg_shard,
                                           const pg_pool_t& pool,
+                                          crimson::osd::PG &pg,
                                           crimson::os::CollectionRef coll,
                                           crimson::osd::ShardServices& shard_services,
                                           const ec_profile_t& ec_profile,
index 0ff4ad5730f5b481bd73b89e98caf56ab06baba2..caa86d46a5b143a8dd5b0e148573b68dc6a34c44 100644 (file)
@@ -8,6 +8,7 @@
 #include "crimson/common/exception.h"
 #include "crimson/common/log.h"
 #include "crimson/os/futurized_store.h"
+#include "crimson/osd/pg.h"
 #include "crimson/osd/shard_services.h"
 #include "osd/PeeringState.h"
 
@@ -15,12 +16,14 @@ SET_SUBSYS(osd);
 
 ReplicatedBackend::ReplicatedBackend(pg_t pgid,
                                      pg_shard_t whoami,
+                                    crimson::osd::PG& pg,
                                      ReplicatedBackend::CollectionRef coll,
                                      crimson::osd::ShardServices& shard_services,
                                     DoutPrefixProvider &dpp)
   : PGBackend{whoami.shard, coll, shard_services, dpp},
     pgid{pgid},
-    whoami{whoami}
+    whoami{whoami},
+    pg(pg)
 {}
 
 ReplicatedBackend::ll_read_ierrorator::future<ceph::bufferlist>
@@ -41,6 +44,7 @@ ReplicatedBackend::_submit_transaction(std::set<pg_shard_t>&& pg_shards,
                                       std::vector<pg_log_entry_t>&& log_entries)
 {
   LOG_PREFIX(ReplicatedBackend::_submit_transaction);
+  DEBUGDPP("object {}, {}", dpp, hoid);
 
   const ceph_tid_t tid = shard_services.get_tid();
   auto pending_txn =
@@ -48,29 +52,6 @@ ReplicatedBackend::_submit_transaction(std::set<pg_shard_t>&& pg_shards,
   bufferlist encoded_txn;
   encode(txn, encoded_txn);
 
-  DEBUGDPP("object {}", dpp, hoid);
-  auto all_completed = interruptor::make_interruptible(
-    shard_services.get_store().do_transaction(coll, std::move(txn))
-  ).then_interruptible([FNAME, this,
-                       peers=pending_txn->second.weak_from_this()] {
-    if (!peers) {
-      // for now, only actingset_changed can cause peers
-      // to be nullptr
-      ERRORDPP("peers is null, this should be impossible", dpp);
-      assert(0 == "impossible");
-    }
-    if (--peers->pending == 0) {
-      peers->all_committed.set_value();
-      peers->all_committed = {};
-      return seastar::now();
-    }
-    return peers->all_committed.get_shared_future();
-  }).then_interruptible([pending_txn, this] {
-    auto acked_peers = std::move(pending_txn->second.acked_peers);
-    pending_trans.erase(pending_txn);
-    return seastar::make_ready_future<crimson::osd::acked_peers_t>(std::move(acked_peers));
-  });
-
   auto sends = std::make_unique<std::vector<seastar::future<>>>();
   for (auto pg_shard : pg_shards) {
     if (pg_shard != whoami) {
@@ -91,9 +72,43 @@ ReplicatedBackend::_submit_transaction(std::set<pg_shard_t>&& pg_shards,
       m->min_last_complete_ondisk = osd_op_p.min_last_complete_ondisk;
       m->set_rollback_to(osd_op_p.at_version);
       // TODO: set more stuff. e.g., pg_states
-      sends->emplace_back(shard_services.send_to_osd(pg_shard.osd, std::move(m), map_epoch));
+      sends->emplace_back(
+       shard_services.send_to_osd(
+         pg_shard.osd, std::move(m), map_epoch));
     }
   }
+
+  pg.log_operation(
+    std::move(log_entries),
+    osd_op_p.pg_trim_to,
+    osd_op_p.at_version,
+    osd_op_p.min_last_complete_ondisk,
+    true,
+    txn,
+    false);
+
+  auto all_completed = interruptor::make_interruptible(
+    shard_services.get_store().do_transaction(coll, std::move(txn))
+  ).then_interruptible([FNAME, this,
+                       peers=pending_txn->second.weak_from_this()] {
+    if (!peers) {
+      // for now, only actingset_changed can cause peers
+      // to be nullptr
+      ERRORDPP("peers is null, this should be impossible", dpp);
+      assert(0 == "impossible");
+    }
+    if (--peers->pending == 0) {
+      peers->all_committed.set_value();
+      peers->all_committed = {};
+      return seastar::now();
+    }
+    return peers->all_committed.get_shared_future();
+  }).then_interruptible([pending_txn, this] {
+    auto acked_peers = std::move(pending_txn->second.acked_peers);
+    pending_trans.erase(pending_txn);
+    return seastar::make_ready_future<crimson::osd::acked_peers_t>(std::move(acked_peers));
+  });
+
   auto sends_complete = seastar::when_all_succeed(
     sends->begin(), sends->end()
   ).finally([sends=std::move(sends)] {});
index f789a35eae690ec9a05d1026286a9563e0ba86d4..78366060d89487d5d7114564fad2565a48a9b96e 100644 (file)
 
 namespace crimson::osd {
   class ShardServices;
+  class PG;
 }
 
 class ReplicatedBackend : public PGBackend
 {
 public:
   ReplicatedBackend(pg_t pgid, pg_shard_t whoami,
+                   crimson::osd::PG& pg,
                    CollectionRef coll,
                    crimson::osd::ShardServices& shard_services,
                    DoutPrefixProvider &dpp);
@@ -55,6 +57,7 @@ private:
   };
   using pending_transactions_t = std::map<ceph_tid_t, pending_on_t>;
   pending_transactions_t pending_trans;
+  crimson::osd::PG& pg;
 
   seastar::future<> request_committed(
     const osd_reqid_t& reqid, const eversion_t& at_version) final;