]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/osd: ECReplicatedBackend embraces ECCommon::RecoveryBackend
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Tue, 26 Mar 2024 11:47:38 +0000 (11:47 +0000)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Tue, 27 Jan 2026 14:37:36 +0000 (14:37 +0000)
The idea is to compose the latter into the former (thus the private
inheritance) to easily build a class that fulfills the crimon iface
called `crimson::ReplicatedBackend`.

Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/crimson/osd/ec_backend.h
src/crimson/osd/ec_recovery_backend.cc
src/crimson/osd/ec_recovery_backend.h
src/crimson/osd/recovery_backend.cc

index 25abe0a451d1424f020be43563f30cdd1bd4da0c..c228e01456d8ea20964aacb98b38882b5c3a7000 100644 (file)
@@ -48,7 +48,10 @@ public:
   write_iertr::future<> handle_rep_write_reply(ECSubWriteReply&& op);
   ll_read_ierrorator::future<> handle_rep_read_op(Ref<MOSDECSubOpRead>);
   ll_read_ierrorator::future<> handle_rep_read_reply(Ref<MOSDECSubOpReadReply>);
+
 private:
+  friend class ECRecoveryBackend;
+
   ll_read_ierrorator::future<ceph::bufferlist>
   _read(const hobject_t& hoid, uint64_t off, uint64_t len, uint32_t flags) override;
   rep_op_fut_t
index dd1d98c650a4d84532414b12110a009a75168885..766b27288a5b1772e2d0bde95f08da23cb0383fd 100644 (file)
@@ -6,6 +6,7 @@
 #include <seastar/core/future.hh>
 #include <seastar/core/do_with.hh>
 
+#include "crimson/osd/ec_backend.h"
 #include "crimson/osd/ec_recovery_backend.h"
 #include "crimson/osd/pg.h"
 #include "crimson/osd/pg_backend.h"
@@ -20,6 +21,21 @@ namespace {
   }
 }
 
+ECRecoveryBackend::ECRecoveryBackend(
+  crimson::osd::PG& pg,
+  crimson::osd::ShardServices& shard_services,
+  crimson::os::CollectionRef coll,
+  ECBackend* backend)
+: ::RecoveryBackend(pg, shard_services, coll, backend),
+  ::ECCommon::RecoveryBackend(
+    shard_services.get_cct(),
+    coll->get_cid(),
+    backend->ec_impl,
+    backend->sinfo,
+    backend->read_pipeline,
+    &pg)
+{}
+
 RecoveryBackend::interruptible_future<>
 ECRecoveryBackend::recover_object(
   const hobject_t& soid,
@@ -29,6 +45,12 @@ ECRecoveryBackend::recover_object(
   return seastar::now();
 }
 
+void ECRecoveryBackend::commit_txn_send_replies(
+  ceph::os::Transaction&& txn,
+  std::map<int, MOSDPGPushReply*> replies)
+{
+}
+
 RecoveryBackend::interruptible_future<>
 ECRecoveryBackend::handle_push(
   Ref<MOSDPGPush> m)
@@ -55,9 +77,9 @@ ECRecoveryBackend::handle_recovery_op(
     return handle_push(boost::static_pointer_cast<MOSDPGPush>(m));
   case MSG_OSD_PG_PUSH_REPLY:
     return handle_push_reply(
-       boost::static_pointer_cast<MOSDPGPushReply>(m));
+      boost::static_pointer_cast<MOSDPGPushReply>(m));
   default:
     // delegate to parent class for handling backend-agnostic recovery ops.
-    return RecoveryBackend::handle_recovery_op(std::move(m), conn);
+    return ::RecoveryBackend::handle_recovery_op(std::move(m), conn);
   }
 }
index bb86c2eb80afcbd4616d6e168a9ea75cf908fbe2..6f881852cdfddf3ee051d8cd7ef37a0730d53feb 100644 (file)
@@ -19,6 +19,7 @@
 #include "messages/MOSDPGPush.h"
 #include "messages/MOSDPGPushReply.h"
 #include "messages/MOSDPGScan.h"
+#include "osd/ECCommon.h"
 #include "osd/recovery_types.h"
 #include "osd/osd_types.h"
 
@@ -28,14 +29,13 @@ namespace crimson::osd{
 
 class PGBackend;
 
-class ECRecoveryBackend : public RecoveryBackend {
+class ECRecoveryBackend : public RecoveryBackend,
+                         private ECCommon::RecoveryBackend {
 public:
   ECRecoveryBackend(crimson::osd::PG& pg,
                    crimson::osd::ShardServices& shard_services,
                    crimson::os::CollectionRef coll,
-                   PGBackend* backend)
-    : RecoveryBackend(pg, shard_services, coll, backend)
-  {}
+                   ECBackend* backend);
 
   interruptible_future<> handle_recovery_op(
     Ref<MOSDFastDispatchOp> m,
@@ -50,6 +50,10 @@ public:
   }
 
 private:
+  void commit_txn_send_replies(
+    ceph::os::Transaction&& txn,
+    std::map<int, MOSDPGPushReply*> replies) override;
+
   interruptible_future<> handle_push(
     Ref<MOSDPGPush> m);
   interruptible_future<> handle_push_reply(
index 57db81a10b81005ee536d7ac98d05c11051c7b55..91085966b5f2fa6238bbf2bebc10996a11000c73 100644 (file)
@@ -6,6 +6,7 @@
 #include "crimson/common/coroutine.h"
 #include "crimson/common/exception.h"
 #include "crimson/common/log.h"
+#include "crimson/osd/ec_backend.h"
 #include "crimson/osd/ec_recovery_backend.h"
 #include "crimson/osd/recovery_backend.h"
 #include "crimson/osd/replicated_recovery_backend.h"
@@ -483,7 +484,7 @@ std::unique_ptr<RecoveryBackend> RecoveryBackend::create(
       pg, shard_services, coll, backend);
   case pg_pool_t::TYPE_ERASURE:
     return std::make_unique<ECRecoveryBackend>(
-      pg, shard_services, coll, backend);
+      pg, shard_services, coll, static_cast<ECBackend*>(backend));
   default:
     ceph_abort_msg(seastar::format(
       "unsupported pool type '{}'", pool.type));