From: Radoslaw Zarzynski Date: Tue, 1 Dec 2020 15:26:52 +0000 (+0100) Subject: crimson/osd: add support for MOSDPGBackfillRemove at primary. X-Git-Tag: v16.1.0~346^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d467a906e8aff1bc193fb90ae9b4bc10976a5d98;p=ceph.git crimson/osd: add support for MOSDPGBackfillRemove at primary. Signed-off-by: Radoslaw Zarzynski --- diff --git a/src/crimson/osd/backfill_state.cc b/src/crimson/osd/backfill_state.cc index 4a8b11f5976..e9c73a6efc9 100644 --- a/src/crimson/osd/backfill_state.cc +++ b/src/crimson/osd/backfill_state.cc @@ -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, diff --git a/src/crimson/osd/backfill_state.h b/src/crimson/osd/backfill_state.h index e742fd10a9a..0432d3333b3 100644 --- a/src/crimson/osd/backfill_state.h +++ b/src/crimson/osd/backfill_state.h @@ -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; diff --git a/src/crimson/osd/pg_recovery.cc b/src/crimson/osd/pg_recovery.cc index cdf26274533..8938667d5b5 100644 --- a/src/crimson/osd/pg_recovery.cc +++ b/src/crimson/osd/pg_recovery.cc @@ -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( + 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( diff --git a/src/crimson/osd/pg_recovery.h b/src/crimson/osd/pg_recovery.h index 0f65f389a77..54f3744bcec 100644 --- a/src/crimson/osd/pg_recovery.h +++ b/src/crimson/osd/pg_recovery.h @@ -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 backfill_state; + std::map> backfill_drop_requests; template 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; diff --git a/src/test/crimson/test_backfill.cc b/src/test/crimson/test_backfill.cc index 01f435fd416..f196ee9c69d 100644 --- a/src/test/crimson/test_backfill.cc +++ b/src/test/crimson/test_backfill.cc @@ -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) {