]>
Commit | Line | Data |
---|---|---|
f67539c2 TL |
1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- |
2 | // vim: ts=8 sw=2 smarttab | |
3 | ||
4 | #pragma once | |
5 | ||
6 | #include <seastar/core/future.hh> | |
7 | ||
8 | #include "crimson/osd/backfill_state.h" | |
20effc67 | 9 | #include "crimson/osd/pg_interval_interrupt_condition.h" |
f67539c2 TL |
10 | #include "crimson/osd/osd_operation.h" |
11 | #include "crimson/osd/pg_recovery_listener.h" | |
12 | #include "crimson/osd/scheduler/scheduler.h" | |
13 | #include "crimson/osd/shard_services.h" | |
14 | ||
15 | #include "osd/object_state.h" | |
16 | ||
17 | class MOSDPGBackfillRemove; | |
18 | class PGBackend; | |
19 | ||
20 | class PGRecovery : public crimson::osd::BackfillState::BackfillListener { | |
21 | public: | |
20effc67 TL |
22 | template <typename T = void> |
23 | using blocking_interruptible_future = | |
24 | ::crimson::blocking_interruptible_future< | |
25 | ::crimson::osd::IOInterruptCondition, T>; | |
f67539c2 TL |
26 | PGRecovery(PGRecoveryListener* pg) : pg(pg) {} |
27 | virtual ~PGRecovery() {} | |
28 | void start_pglogbased_recovery(); | |
29 | ||
20effc67 | 30 | blocking_interruptible_future<bool> start_recovery_ops(size_t max_to_start); |
f67539c2 TL |
31 | void on_backfill_reserved(); |
32 | void dispatch_backfill_event( | |
33 | boost::intrusive_ptr<const boost::statechart::event_base> evt); | |
34 | ||
35 | seastar::future<> stop() { return seastar::now(); } | |
36 | private: | |
37 | PGRecoveryListener* pg; | |
38 | size_t start_primary_recovery_ops( | |
39 | size_t max_to_start, | |
20effc67 | 40 | std::vector<blocking_interruptible_future<>> *out); |
f67539c2 TL |
41 | size_t start_replica_recovery_ops( |
42 | size_t max_to_start, | |
20effc67 | 43 | std::vector<blocking_interruptible_future<>> *out); |
f67539c2 TL |
44 | |
45 | std::vector<pg_shard_t> get_replica_recovery_order() const { | |
46 | return pg->get_replica_recovery_order(); | |
47 | } | |
20effc67 | 48 | blocking_interruptible_future<> recover_missing( |
f67539c2 TL |
49 | const hobject_t &soid, eversion_t need); |
50 | size_t prep_object_replica_deletes( | |
51 | const hobject_t& soid, | |
52 | eversion_t need, | |
20effc67 | 53 | std::vector<blocking_interruptible_future<>> *in_progress); |
f67539c2 TL |
54 | size_t prep_object_replica_pushes( |
55 | const hobject_t& soid, | |
56 | eversion_t need, | |
20effc67 | 57 | std::vector<blocking_interruptible_future<>> *in_progress); |
f67539c2 TL |
58 | |
59 | void on_local_recover( | |
60 | const hobject_t& soid, | |
61 | const ObjectRecoveryInfo& recovery_info, | |
62 | bool is_delete, | |
63 | ceph::os::Transaction& t); | |
64 | void on_global_recover ( | |
65 | const hobject_t& soid, | |
66 | const object_stat_sum_t& stat_diff, | |
67 | bool is_delete); | |
68 | void on_failed_recover( | |
20effc67 | 69 | const std::set<pg_shard_t>& from, |
f67539c2 TL |
70 | const hobject_t& soid, |
71 | const eversion_t& v); | |
72 | void on_peer_recover( | |
73 | pg_shard_t peer, | |
74 | const hobject_t &oid, | |
75 | const ObjectRecoveryInfo &recovery_info); | |
76 | void _committed_pushed_object(epoch_t epoch, | |
77 | eversion_t last_complete); | |
78 | friend class ReplicatedRecoveryBackend; | |
79 | friend class crimson::osd::UrgentRecovery; | |
80 | seastar::future<> handle_pull(Ref<MOSDPGPull> m); | |
81 | seastar::future<> handle_push(Ref<MOSDPGPush> m); | |
82 | seastar::future<> handle_push_reply(Ref<MOSDPGPushReply> m); | |
83 | seastar::future<> handle_recovery_delete(Ref<MOSDPGRecoveryDelete> m); | |
84 | seastar::future<> handle_recovery_delete_reply( | |
85 | Ref<MOSDPGRecoveryDeleteReply> m); | |
86 | seastar::future<> handle_pull_response(Ref<MOSDPGPush> m); | |
87 | seastar::future<> handle_scan(MOSDPGScan& m); | |
88 | ||
89 | // backfill begin | |
90 | std::unique_ptr<crimson::osd::BackfillState> backfill_state; | |
91 | std::map<pg_shard_t, | |
20effc67 | 92 | MURef<MOSDPGBackfillRemove>> backfill_drop_requests; |
f67539c2 TL |
93 | |
94 | template <class EventT> | |
95 | void start_backfill_recovery( | |
96 | const EventT& evt); | |
97 | void request_replica_scan( | |
98 | const pg_shard_t& target, | |
99 | const hobject_t& begin, | |
100 | const hobject_t& end) final; | |
101 | void request_primary_scan( | |
102 | const hobject_t& begin) final; | |
103 | void enqueue_push( | |
104 | const hobject_t& obj, | |
105 | const eversion_t& v) final; | |
106 | void enqueue_drop( | |
107 | const pg_shard_t& target, | |
108 | const hobject_t& obj, | |
109 | const eversion_t& v) final; | |
110 | void maybe_flush() final; | |
111 | void update_peers_last_backfill( | |
112 | const hobject_t& new_last_backfill) final; | |
113 | bool budget_available() const final; | |
114 | void backfilled() final; | |
115 | friend crimson::osd::BackfillState::PGFacade; | |
116 | friend crimson::osd::PG; | |
117 | // backfill end | |
118 | }; |