diff options
author | Radosław Zarzyński <rzarzyns@redhat.com> | 2022-12-06 22:20:15 +0100 |
---|---|---|
committer | Radoslaw Zarzynski <rzarzyns@redhat.com> | 2023-02-28 17:22:04 +0100 |
commit | 972af821bbf6dbea54db7abaa37a8dcb733a0eaf (patch) | |
tree | 1438e29049508e4d3ddf7a2499ca502f51c723b4 /src/crimson/osd/osd_operations/snaptrim_event.h | |
parent | crimson/osd: wire SnapTrimEvent with SnapMapper up (diff) | |
download | ceph-972af821bbf6dbea54db7abaa37a8dcb733a0eaf.tar.xz ceph-972af821bbf6dbea54db7abaa37a8dcb733a0eaf.zip |
crimson/osd: bring SnapTrimObjSubEvent
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
Diffstat (limited to 'src/crimson/osd/osd_operations/snaptrim_event.h')
-rw-r--r-- | src/crimson/osd/osd_operations/snaptrim_event.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/src/crimson/osd/osd_operations/snaptrim_event.h b/src/crimson/osd/osd_operations/snaptrim_event.h index bfda550f999..4ec54af66a3 100644 --- a/src/crimson/osd/osd_operations/snaptrim_event.h +++ b/src/crimson/osd/osd_operations/snaptrim_event.h @@ -80,8 +80,69 @@ public: > tracking_events; }; +// remove single object. a SnapTrimEvent can create multiple subrequests. +// the division of labour is needed because of the restriction that an Op +// cannot revisite a pipeline's stage it already saw. +class SnapTrimObjSubEvent : public PhasedOperationT<SnapTrimObjSubEvent> { +public: + static constexpr OperationTypeCode type = + OperationTypeCode::snaptrimobj_subevent; + + SnapTrimObjSubEvent( + Ref<PG> pg, + const hobject_t& coid, + snapid_t snap_to_trim) + : pg(std::move(pg)), + coid(coid), + snap_to_trim(snap_to_trim) { + } + + void print(std::ostream &) const final; + void dump_detail(ceph::Formatter* f) const final; + seastar::future<> start(); + seastar::future<> with_pg( + ShardServices &shard_services, Ref<PG> pg); + + CommonPGPipeline& pp(); + +private: + object_stat_sum_t delta_stats; + + using remove_or_update_ret_t = + std::pair<ceph::os::Transaction, std::vector<pg_log_entry_t>>; + tl::expected<remove_or_update_ret_t, int> + remove_or_update(ObjectContextRef obc, ObjectContextRef head_obc); + + // we don't need to synchronize with other instances started by + // SnapTrimEvent; it's here for the sake of op tracking. + struct WaitRepop : OrderedConcurrentPhaseT<WaitRepop> { + static constexpr auto type_name = "SnapTrimObjSubEvent::wait_repop"; + } wait_repop; + + Ref<PG> pg; + PipelineHandle handle; + osd_op_params_t osd_op_p; + const hobject_t coid; + const snapid_t snap_to_trim; + +public: + PipelineHandle& get_handle() { return handle; } + + std::tuple< + StartEvent, + CommonPGPipeline::WaitForActive::BlockingEvent, + PGActivationBlocker::BlockingEvent, + CommonPGPipeline::RecoverMissing::BlockingEvent, + CommonPGPipeline::GetOBC::BlockingEvent, + CommonPGPipeline::Process::BlockingEvent, + WaitRepop::BlockingEvent, + CompletionEvent + > tracking_events; +}; + } // namespace crimson::osd #if FMT_VERSION >= 90000 template <> struct fmt::formatter<crimson::osd::SnapTrimEvent> : fmt::ostream_formatter {}; +template <> struct fmt::formatter<crimson::osd::SnapTrimObjSubEvent> : fmt::ostream_formatter {}; #endif |