]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd/replicated_backend: use new logging macros
authorSamuel Just <sjust@redhat.com>
Wed, 25 Jan 2023 05:16:06 +0000 (21:16 -0800)
committerSamuel Just <sjust@redhat.com>
Sat, 28 Jan 2023 01:20:47 +0000 (01:20 +0000)
Signed-off-by: Samuel Just <sjust@redhat.com>
src/crimson/osd/ec_backend.cc
src/crimson/osd/ec_backend.h
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 88411096f077cec10ed30d686ae8ef3823982f3c..d555d6cdc1658908d2b9f56f1883bccf398d6dbc 100644 (file)
@@ -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
 }
index 4b736622b4c1886bc022b81a0c323425b7f7e8ed..b9aeaf36f3bb8bba13de319ad4cec3ef93ebdebb 100644 (file)
@@ -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();
   }
index eb2227554f1d0d5625838b3b1da2881740f0d806..70851ece45ea97c0f6abf3633604f352cb21a170 100644 (file)
@@ -115,7 +115,8 @@ PG::PG(
        pool,
        coll_ref,
        shard_services,
-       profile)),
+       profile,
+       *this)),
     recovery_backend(
       std::make_unique<ReplicatedRecoveryBackend>(
        *this, shard_services, coll_ref, backend.get())),
index 21f371ccce50b9aa419974490d9ebe778558f07b..38607cb2f6ff0b2c5971e8a2571b03772ce70ec9 100644 (file)
@@ -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<ReplicatedBackend>(pgid, pg_shard,
-                                              coll, shard_services);
+                                              coll, shard_services,
+                                              dpp);
   case pg_pool_t::TYPE_ERASURE:
     return std::make_unique<ECBackend>(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()}
 {}
 
index 505ee7736a7f9c6ce3f251fc3b681419840d307e..b833c8403f229dba07c6fb113163f060d69286e7 100644 (file)
@@ -64,14 +64,16 @@ public:
     std::tuple<interruptible_future<>,
               interruptible_future<crimson::osd::acked_peers_t>>;
   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<PGBackend> 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<std::string, ceph::bufferptr, std::less<>>;
   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_info_t> peering;
index 119d7278ef6e65ed8aff41e0b3cddbf132d585a4..5693a2f30aaab5de3301526e225bfee8d8a254b3 100644 (file)
 #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_shard_t>&& pg_shards,
                                        epoch_t min_epoch, epoch_t map_epoch,
                                       std::vector<pg_log_entry_t>&& 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_shard_t>&& 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(
index 88fa85ede7eb060fdef67db37519762027a30cf4..eab0d4d5f3ddc16daf2381e9ae7d7793b8d547ab 100644 (file)
@@ -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;