From: Xuehan Xu Date: Tue, 19 Sep 2023 05:45:16 +0000 (+0800) Subject: crimson/osd/replicated_backend: don't put pg's metadata updates in X-Git-Tag: v19.3.0~50^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9b9eff16a885284c106a368970479b54eedb9c19;p=ceph.git crimson/osd/replicated_backend: don't put pg's metadata updates in repops Fixes: https://tracker.ceph.com/issues/62857 Signed-off-by: Xuehan Xu --- diff --git a/src/crimson/osd/pg.cc b/src/crimson/osd/pg.cc index 7cf3b158c89..2bd1bfc5bf3 100644 --- a/src/crimson/osd/pg.cc +++ b/src/crimson/osd/pg.cc @@ -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(), diff --git a/src/crimson/osd/pg_backend.cc b/src/crimson/osd/pg_backend.cc index 02acb9a55d3..06bcf7bbd03 100644 --- a/src/crimson/osd/pg_backend.cc +++ b/src/crimson/osd/pg_backend.cc @@ -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::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(pgid, pg_shard, + return std::make_unique(pgid, pg_shard, pg, coll, shard_services, dpp); case pg_pool_t::TYPE_ERASURE: diff --git a/src/crimson/osd/pg_backend.h b/src/crimson/osd/pg_backend.h index fbad37d4c71..d681726576f 100644 --- a/src/crimson/osd/pg_backend.h +++ b/src/crimson/osd/pg_backend.h @@ -70,6 +70,7 @@ public: static std::unique_ptr 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, diff --git a/src/crimson/osd/replicated_backend.cc b/src/crimson/osd/replicated_backend.cc index 0ff4ad5730f..caa86d46a5b 100644 --- a/src/crimson/osd/replicated_backend.cc +++ b/src/crimson/osd/replicated_backend.cc @@ -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 @@ -41,6 +44,7 @@ ReplicatedBackend::_submit_transaction(std::set&& pg_shards, std::vector&& 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_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(std::move(acked_peers)); - }); - auto sends = std::make_unique>>(); for (auto pg_shard : pg_shards) { if (pg_shard != whoami) { @@ -91,9 +72,43 @@ ReplicatedBackend::_submit_transaction(std::set&& 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(std::move(acked_peers)); + }); + auto sends_complete = seastar::when_all_succeed( sends->begin(), sends->end() ).finally([sends=std::move(sends)] {}); diff --git a/src/crimson/osd/replicated_backend.h b/src/crimson/osd/replicated_backend.h index f789a35eae6..78366060d89 100644 --- a/src/crimson/osd/replicated_backend.h +++ b/src/crimson/osd/replicated_backend.h @@ -14,12 +14,14 @@ 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; pending_transactions_t pending_trans; + crimson::osd::PG& pg; seastar::future<> request_committed( const osd_reqid_t& reqid, const eversion_t& at_version) final;