From 10ea3fecb9fa83ab5e0af9d9f3460380a460c16f Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Tue, 24 Jan 2023 21:16:06 -0800 Subject: [PATCH] crimson/osd/replicated_backend: use new logging macros Signed-off-by: Samuel Just --- src/crimson/osd/ec_backend.cc | 5 +++-- src/crimson/osd/ec_backend.h | 3 ++- src/crimson/osd/pg.cc | 3 ++- src/crimson/osd/pg_backend.cc | 13 +++++++++---- src/crimson/osd/pg_backend.h | 7 +++++-- src/crimson/osd/replicated_backend.cc | 20 ++++++++++---------- src/crimson/osd/replicated_backend.h | 3 ++- 7 files changed, 33 insertions(+), 21 deletions(-) diff --git a/src/crimson/osd/ec_backend.cc b/src/crimson/osd/ec_backend.cc index 88411096f07..d555d6cdc16 100644 --- a/src/crimson/osd/ec_backend.cc +++ b/src/crimson/osd/ec_backend.cc @@ -6,8 +6,9 @@ ECBackend::ECBackend(shard_id_t shard, ECBackend::CollectionRef coll, crimson::osd::ShardServices& shard_services, const ec_profile_t&, - uint64_t) - : PGBackend{shard, coll, shard_services} + uint64_t, + DoutPrefixProvider &dpp) + : PGBackend{shard, coll, shard_services, dpp} { // todo } diff --git a/src/crimson/osd/ec_backend.h b/src/crimson/osd/ec_backend.h index 4b736622b4c..b9aeaf36f3b 100644 --- a/src/crimson/osd/ec_backend.h +++ b/src/crimson/osd/ec_backend.h @@ -16,7 +16,8 @@ public: CollectionRef coll, crimson::osd::ShardServices& shard_services, const ec_profile_t& ec_profile, - uint64_t stripe_width); + uint64_t stripe_width, + DoutPrefixProvider &dpp); seastar::future<> stop() final { return seastar::now(); } diff --git a/src/crimson/osd/pg.cc b/src/crimson/osd/pg.cc index eb2227554f1..70851ece45e 100644 --- a/src/crimson/osd/pg.cc +++ b/src/crimson/osd/pg.cc @@ -115,7 +115,8 @@ PG::PG( pool, coll_ref, shard_services, - profile)), + profile, + *this)), recovery_backend( std::make_unique( *this, shard_services, coll_ref, backend.get())), diff --git a/src/crimson/osd/pg_backend.cc b/src/crimson/osd/pg_backend.cc index 21f371ccce5..38607cb2f6f 100644 --- a/src/crimson/osd/pg_backend.cc +++ b/src/crimson/osd/pg_backend.cc @@ -45,16 +45,19 @@ PGBackend::create(pg_t pgid, const pg_pool_t& pool, crimson::os::CollectionRef coll, crimson::osd::ShardServices& shard_services, - const ec_profile_t& ec_profile) + const ec_profile_t& ec_profile, + DoutPrefixProvider &dpp) { switch (pool.type) { case pg_pool_t::TYPE_REPLICATED: return std::make_unique(pgid, pg_shard, - coll, shard_services); + coll, shard_services, + dpp); case pg_pool_t::TYPE_ERASURE: return std::make_unique(pg_shard.shard, coll, shard_services, std::move(ec_profile), - pool.stripe_width); + pool.stripe_width, + dpp); default: throw runtime_error(seastar::format("unsupported pool type '{}'", pool.type)); @@ -63,10 +66,12 @@ PGBackend::create(pg_t pgid, PGBackend::PGBackend(shard_id_t shard, CollectionRef coll, - crimson::osd::ShardServices &shard_services) + crimson::osd::ShardServices &shard_services, + DoutPrefixProvider &dpp) : shard{shard}, coll{coll}, shard_services{shard_services}, + dpp{dpp}, store{&shard_services.get_store()} {} diff --git a/src/crimson/osd/pg_backend.h b/src/crimson/osd/pg_backend.h index 505ee7736a7..b833c8403f2 100644 --- a/src/crimson/osd/pg_backend.h +++ b/src/crimson/osd/pg_backend.h @@ -64,14 +64,16 @@ public: std::tuple, interruptible_future>; PGBackend(shard_id_t shard, CollectionRef coll, - crimson::osd::ShardServices &shard_services); + crimson::osd::ShardServices &shard_services, + DoutPrefixProvider &dpp); virtual ~PGBackend() = default; static std::unique_ptr create(pg_t pgid, const pg_shard_t pg_shard, const pg_pool_t& pool, crimson::os::CollectionRef coll, crimson::osd::ShardServices& shard_services, - const ec_profile_t& ec_profile); + const ec_profile_t& ec_profile, + DoutPrefixProvider &dpp); using attrs_t = std::map>; using read_errorator = ll_read_errorator::extend< @@ -390,6 +392,7 @@ protected: const shard_id_t shard; CollectionRef coll; crimson::osd::ShardServices &shard_services; + DoutPrefixProvider &dpp; ///< provides log prefix context crimson::os::FuturizedStore* store; bool stopping = false; std::optional peering; diff --git a/src/crimson/osd/replicated_backend.cc b/src/crimson/osd/replicated_backend.cc index 119d7278ef6..5693a2f30aa 100644 --- a/src/crimson/osd/replicated_backend.cc +++ b/src/crimson/osd/replicated_backend.cc @@ -11,17 +11,14 @@ #include "crimson/osd/shard_services.h" #include "osd/PeeringState.h" -namespace { - seastar::logger& logger() { - return crimson::get_logger(ceph_subsys_osd); - } -} +SET_SUBSYS(osd); ReplicatedBackend::ReplicatedBackend(pg_t pgid, pg_shard_t whoami, ReplicatedBackend::CollectionRef coll, - crimson::osd::ShardServices& shard_services) - : PGBackend{whoami.shard, coll, shard_services}, + crimson::osd::ShardServices& shard_services, + DoutPrefixProvider &dpp) + : PGBackend{whoami.shard, coll, shard_services, dpp}, pgid{pgid}, whoami{whoami} {} @@ -46,6 +43,7 @@ ReplicatedBackend::_submit_transaction(std::set&& pg_shards, epoch_t min_epoch, epoch_t map_epoch, std::vector&& log_entries) { + LOG_PREFIX(ReplicatedBackend::_submit_transaction); if (__builtin_expect(stopping, false)) { throw crimson::common::system_shutdown_exception(); } @@ -59,7 +57,7 @@ ReplicatedBackend::_submit_transaction(std::set&& pg_shards, bufferlist encoded_txn; encode(txn, encoded_txn); - logger().debug("ReplicatedBackend::_submit_transaction: do_transaction..."); + DEBUGDPP("object {}", dpp, hoid); auto all_completed = interruptor::make_interruptible( shard_services.get_store().do_transaction(coll, std::move(txn))) .then_interruptible([this, peers=pending_txn->second.weak_from_this()] { @@ -122,9 +120,10 @@ void ReplicatedBackend::on_actingset_changed(peering_info_t pi) void ReplicatedBackend::got_rep_op_reply(const MOSDRepOpReply& reply) { + LOG_PREFIX(ReplicatedBackend::got_rep_op_reply); auto found = pending_trans.find(reply.get_tid()); if (found == pending_trans.end()) { - logger().warn("{}: no matched pending rep op: {}", __func__, reply); + WARNDPP("cannot find rep op for message {}", dpp, reply); return; } auto& peers = found->second; @@ -142,7 +141,8 @@ void ReplicatedBackend::got_rep_op_reply(const MOSDRepOpReply& reply) seastar::future<> ReplicatedBackend::stop() { - logger().info("ReplicatedBackend::stop {}", coll->get_cid()); + LOG_PREFIX(ReplicatedBackend::stop); + INFODPP("cid {}", coll->get_cid()); stopping = true; for (auto& [tid, pending_on] : pending_trans) { pending_on.all_committed.set_exception( diff --git a/src/crimson/osd/replicated_backend.h b/src/crimson/osd/replicated_backend.h index 88fa85ede7e..eab0d4d5f3d 100644 --- a/src/crimson/osd/replicated_backend.h +++ b/src/crimson/osd/replicated_backend.h @@ -21,7 +21,8 @@ class ReplicatedBackend : public PGBackend public: ReplicatedBackend(pg_t pgid, pg_shard_t whoami, CollectionRef coll, - crimson::osd::ShardServices& shard_services); + crimson::osd::ShardServices& shard_services, + DoutPrefixProvider &dpp); void got_rep_op_reply(const MOSDRepOpReply& reply) final; seastar::future<> stop() final; void on_actingset_changed(peering_info_t pi) final; -- 2.39.5