From: Matan Breizman Date: Thu, 24 Apr 2025 07:57:00 +0000 (+0000) Subject: crimson/osd/pg: Let PGListener use start_peering_event_operation X-Git-Tag: testing/wip-vshankar-testing-20250506.112544-debug~2^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=c94e604bbb6550109ad5945ab86f82d6d5aeb1a1;p=ceph-ci.git crimson/osd/pg: Let PGListener use start_peering_event_operation PG::start_peering_event_operation is a template function while PGRecovery::pg is of PGRecoveryListener* type. We can't expose a template function through the PGRecoveryListener interface since it must be also virtual. Instead, introduce start_peering_event_operation_listener which will act as a wrapper to PG::start_peering_event_operation for PGRecovery to use freely. Signed-off-by: Matan Breizman --- diff --git a/src/crimson/osd/pg_recovery.cc b/src/crimson/osd/pg_recovery.cc index 8d14cb77eaa..fd6c1097dff 100644 --- a/src/crimson/osd/pg_recovery.cc +++ b/src/crimson/osd/pg_recovery.cc @@ -623,32 +623,28 @@ void PGRecovery::on_pg_clean() backfill_state.reset(); } +// PGListener wrapper to PG::start_peering_event_operation +template +void PGRecovery::start_peering_event_operation_listener(T &&evt, float delay) { + (void) pg->schedule_event_after(PGPeeringEventRef( + std::make_shared( + pg->get_osdmap_epoch(), + pg->get_osdmap_epoch(), + std::forward(evt))), delay); +} + void PGRecovery::backfilled() { LOG_PREFIX(PGRecovery::backfilled); DEBUGDPP("", pg->get_pgid()); - using LocalPeeringEvent = crimson::osd::LocalPeeringEvent; - std::ignore = pg->get_shard_services().start_operation( - static_cast(pg), - pg->get_pg_whoami(), - pg->get_pgid(), - pg->get_osdmap_epoch(), - pg->get_osdmap_epoch(), - PeeringState::Backfilled{}); + start_peering_event_operation_listener(PeeringState::Backfilled()); } void PGRecovery::request_backfill() { LOG_PREFIX(PGRecovery::request_backfill); DEBUGDPP("", pg->get_pgid()); - using LocalPeeringEvent = crimson::osd::LocalPeeringEvent; - std::ignore = pg->get_shard_services().start_operation( - static_cast(pg), - pg->get_pg_whoami(), - pg->get_pgid(), - pg->get_osdmap_epoch(), - pg->get_osdmap_epoch(), - PeeringState::RequestBackfill{}); + start_peering_event_operation_listener(PeeringState::RequestBackfill()); } @@ -656,14 +652,7 @@ void PGRecovery::all_replicas_recovered() { LOG_PREFIX(PGRecovery::all_replicas_recovered); DEBUGDPP("", pg->get_pgid()); - using LocalPeeringEvent = crimson::osd::LocalPeeringEvent; - std::ignore = pg->get_shard_services().start_operation( - static_cast(pg), - pg->get_pg_whoami(), - pg->get_pgid(), - pg->get_osdmap_epoch(), - pg->get_osdmap_epoch(), - PeeringState::AllReplicasRecovered{}); + start_peering_event_operation_listener(PeeringState::AllReplicasRecovered()); } void PGRecovery::backfill_suspended() diff --git a/src/crimson/osd/pg_recovery.h b/src/crimson/osd/pg_recovery.h index 9bddbcf75ec..f85709c501d 100644 --- a/src/crimson/osd/pg_recovery.h +++ b/src/crimson/osd/pg_recovery.h @@ -138,7 +138,8 @@ private: const hobject_t& new_last_backfill) final; bool budget_available() const final; - // TODO: move to start_peering_event_operation + template + void start_peering_event_operation_listener(T &&evt, float delay = 0); void backfilled() final; void request_backfill(); void all_replicas_recovered(); diff --git a/src/crimson/osd/pg_recovery_listener.h b/src/crimson/osd/pg_recovery_listener.h index 347a3b2194e..ab50b99a639 100644 --- a/src/crimson/osd/pg_recovery_listener.h +++ b/src/crimson/osd/pg_recovery_listener.h @@ -43,4 +43,5 @@ public: virtual void set_pglog_based_recovery_op( crimson::osd::PglogBasedRecovery *op) = 0; virtual void reset_pglog_based_recovery_op() = 0; + virtual void schedule_event_after(PGPeeringEventRef evt, float delay) = 0; };