]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: add support for MOSDPGBackfillRemove at replicas.
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Tue, 24 Nov 2020 18:17:49 +0000 (19:17 +0100)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Tue, 8 Dec 2020 11:05:14 +0000 (12:05 +0100)
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/crimson/osd/osd.cc
src/crimson/osd/pg.h
src/crimson/osd/recovery_backend.cc
src/crimson/osd/recovery_backend.h

index 430d8ed2ebb0e28a132e5b4d34f53aa5735d772b..cb0951aad70280d806503a7b4ce48c69712211ce 100644 (file)
@@ -651,6 +651,8 @@ seastar::future<> OSD::ms_dispatch(crimson::net::Connection* conn, MessageRef m)
     case MSG_OSD_PG_SCAN:
       [[fallthrough]];
     case MSG_OSD_PG_BACKFILL:
+      [[fallthrough]];
+    case MSG_OSD_PG_BACKFILL_REMOVE:
       return handle_recovery_subreq(conn, boost::static_pointer_cast<MOSDFastDispatchOp>(m));
     case MSG_OSD_PG_LEASE:
       [[fallthrough]];
index f7db6ba6cda167f2f1e02cb7e780828e6ca8c628..61815b3311b860e19f616e2b46668cf92fb90362 100644 (file)
@@ -362,6 +362,7 @@ public:
 
   bool try_reserve_recovery_space(
     int64_t primary_num_bytes, int64_t local_num_bytes) final {
+    // TODO
     return true;
   }
   void unreserve_recovery_space() final {}
index 9444379be17133d8bdba6c57384a002986d5c94f..91e4cc334c7f2b570ef494c123a06f8e48e894c7 100644 (file)
@@ -136,6 +136,25 @@ seastar::future<> RecoveryBackend::handle_backfill(
   }
 }
 
+seastar::future<> RecoveryBackend::handle_backfill_remove(
+  MOSDPGBackfillRemove& m)
+{
+  logger().debug("{} m.ls=", __func__, m.ls);
+  assert(m.get_type() == MSG_OSD_PG_BACKFILL_REMOVE);
+
+  ObjectStore::Transaction t;
+  for ([[maybe_unused]] const auto& [soid, ver] : m.ls) {
+    // TODO: the reserved space management. PG::try_reserve_recovery_space().
+    t.remove(pg.get_collection_ref()->get_cid(),
+             ghobject_t(soid, ghobject_t::NO_GEN, pg.get_pg_whoami().shard));
+  }
+  return shard_services.get_store().do_transaction(
+    pg.get_collection_ref(), std::move(t)
+  ).handle_exception([] (auto) {
+    ceph_abort_msg("this transaction shall not fail");
+  });
+}
+
 seastar::future<BackfillInterval> RecoveryBackend::scan_for_backfill(
   const hobject_t& start,
   [[maybe_unused]] const std::int64_t min,
@@ -274,6 +293,8 @@ seastar::future<> RecoveryBackend::handle_recovery_op(
   switch (m->get_header().type) {
   case MSG_OSD_PG_BACKFILL:
     return handle_backfill(*boost::static_pointer_cast<MOSDPGBackfill>(m));
+  case MSG_OSD_PG_BACKFILL_REMOVE:
+    return handle_backfill_remove(*boost::static_pointer_cast<MOSDPGBackfillRemove>(m));
   case MSG_OSD_PG_SCAN:
     return handle_scan(*boost::static_pointer_cast<MOSDPGScan>(m));
   default:
index 89f242b2b0c3918fc0464cde0f9ddfd3c5ecd332..2bffaed6a6413e0e377ebe887cca95d35470b28e 100644 (file)
@@ -12,6 +12,7 @@
 #include "crimson/osd/shard_services.h"
 
 #include "messages/MOSDPGBackfill.h"
+#include "messages/MOSDPGBackfillRemove.h"
 #include "messages/MOSDPGScan.h"
 #include "osd/recovery_types.h"
 #include "osd/osd_types.h"
@@ -31,6 +32,8 @@ class RecoveryBackend {
     MOSDPGBackfill& m);
   seastar::future<> handle_backfill(MOSDPGBackfill& m);
 
+  seastar::future<> handle_backfill_remove(MOSDPGBackfillRemove& m);
+
   seastar::future<> handle_scan_get_digest(
     MOSDPGScan& m);
   seastar::future<> handle_scan_digest(