]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: add support for MOSDPGBackfillRemove at primary.
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Tue, 1 Dec 2020 15:26:52 +0000 (16:26 +0100)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Tue, 8 Dec 2020 11:05:15 +0000 (12:05 +0100)
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/crimson/osd/backfill_state.cc
src/crimson/osd/backfill_state.h
src/crimson/osd/pg_recovery.cc
src/crimson/osd/pg_recovery.h
src/test/crimson/test_backfill.cc

index 4a8b11f59769c1aab1cc068912efc428a1060dfe..e9c73a6efc91ae0f8218012920b69467aa56ceb7 100644 (file)
@@ -343,6 +343,7 @@ BackfillState::Enqueuing::Enqueuing(my_context ctx)
                                            backfill_state().peer_backfill_info);
       primary_bi.pop_front();
     }
+    backfill_listener().maybe_flush();
   }
 
   if (should_rescan_primary(backfill_state().peer_backfill_info,
index e742fd10a9a0f3eca5fc5721b0c74126ffba64d9..0432d3333b3a961018029286eb63be384a11ede3 100644 (file)
@@ -298,6 +298,8 @@ struct BackfillState::BackfillListener {
     const hobject_t& obj,
     const eversion_t& v) = 0;
 
+  virtual void maybe_flush() = 0;
+
   virtual void update_peers_last_backfill(
     const hobject_t& new_last_backfill) = 0;
 
index cdf26274533bae71efbd27017f9fc2e1887f2c95..8938667d5b580d2fc3d4d4cf51719d3ecbf0e461 100644 (file)
@@ -452,7 +452,24 @@ void PGRecovery::enqueue_drop(
   const hobject_t& obj,
   const eversion_t& v)
 {
-  ceph_abort_msg("Not implemented");
+  // allocate a pair if target is seen for the first time
+  auto& req = backfill_drop_requests[target];
+  if (!req) {
+    req = ceph::make_message<MOSDPGBackfillRemove>(
+      spg_t(pg->get_pgid().pgid, target.shard), pg->get_osdmap_epoch());
+  }
+  req->ls.emplace_back(obj, v);
+}
+
+void PGRecovery::maybe_flush()
+{
+  for (auto& [target, req] : backfill_drop_requests) {
+    std::ignore = pg->get_shard_services().send_to_osd(
+      target.osd,
+      std::move(req),
+      pg->get_osdmap_epoch());
+  }
+  backfill_drop_requests.clear();
 }
 
 void PGRecovery::update_peers_last_backfill(
index 0f65f389a77ce750dbf825d9d283603a2bd4b154..54f3744bcec1c7ea2bfab63d8b8fe0b609a4eb4d 100644 (file)
@@ -13,6 +13,7 @@
 
 #include "osd/object_state.h"
 
+class MOSDPGBackfillRemove;
 class PGBackend;
 
 class PGRecovery : public crimson::osd::BackfillState::BackfillListener {
@@ -82,6 +83,8 @@ private:
 
   // backfill begin
   std::unique_ptr<crimson::osd::BackfillState> backfill_state;
+  std::map<pg_shard_t,
+           ceph::ref_t<MOSDPGBackfillRemove>> backfill_drop_requests;
 
   template <class EventT>
   void start_backfill_recovery(
@@ -99,6 +102,7 @@ private:
     const pg_shard_t& target,
     const hobject_t& obj,
     const eversion_t& v) final;
+  void maybe_flush() final;
   void update_peers_last_backfill(
     const hobject_t& new_last_backfill) final;
   bool budget_available() const final;
index 01f435fd41687f5f23d1475b1e1192e9f187effb..f196ee9c69d99ff1228adf30a8c9c1f5be4b3f93 100644 (file)
@@ -132,6 +132,8 @@ class BackfillFixture : public crimson::osd::BackfillState::BackfillListener {
     const hobject_t& obj,
     const eversion_t& v) override;
 
+  void maybe_flush() override;
+
   void update_peers_last_backfill(
     const hobject_t& new_last_backfill) override;
 
@@ -297,6 +299,10 @@ void BackfillFixture::enqueue_drop(
   backfill_targets.at(target).store.drop(obj, v);
 }
 
+void BackfillFixture::maybe_flush()
+{
+}
+
 void BackfillFixture::update_peers_last_backfill(
   const hobject_t& new_last_backfill)
 {