Skip to content

Commit 3a22bb2

Browse files
authored
Merge pull request ceph#63125 from Matan-B/wip-matanb-crimson-tentacle-62847
tentacle: crimson/osd/pg_recovery: rework start_recovery_ops Reviewed-by: Aishwarya Mathuria <[email protected]>
2 parents 7248859 + e453ae7 commit 3a22bb2

File tree

9 files changed

+163
-140
lines changed

9 files changed

+163
-140
lines changed

src/crimson/common/interruptible_future.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1486,6 +1486,17 @@ struct interruptor
14861486
futurize_invoke_if_func(std::forward<FutOrFuncs>(fut_or_funcs))...);
14871487
}
14881488

1489+
// This is a simpler implemation than seastar::when_all_succeed.
1490+
// We are not using ::seastar::internal::complete_when_all
1491+
template <typename T>
1492+
static inline auto when_all_succeed(std::vector<interruptible_future<InterruptCond, T>>&& futures) noexcept {
1493+
return interruptor::parallel_for_each(futures,
1494+
[] (auto&& ifut) -> interruptible_future<InterruptCond, T> {
1495+
return std::move(ifut);
1496+
});
1497+
}
1498+
1499+
14891500
template <typename Func,
14901501
typename Result = futurize_t<std::invoke_result_t<Func>>>
14911502
static inline Result async(Func&& func) {

src/crimson/osd/backfill_state.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ void BackfillState::Enqueuing::maybe_update_range()
122122
ceph_assert(primary_bi.version == eversion_t());
123123
return;
124124
}
125-
DEBUGDPP("{}: bi is old, ({}) can be updated with log to {}",
125+
DEBUGDPP("bi is old, ({}) can be updated with log to {}",
126126
pg(),
127127
primary_bi.version,
128128
pg().get_projected_last_update());
@@ -183,9 +183,9 @@ void BackfillState::Enqueuing::maybe_update_range()
183183
}
184184
}
185185
};
186-
DEBUGDPP("{}: scanning pg log first", pg());
186+
DEBUGDPP("scanning pg log first", pg());
187187
peering_state().scan_log_after(primary_bi.version, func);
188-
DEBUGDPP("{}: scanning projected log", pg());
188+
DEBUGDPP("scanning projected log", pg());
189189
pg().get_projected_log().scan_log_after(primary_bi.version, func);
190190
primary_bi.version = pg().get_projected_last_update();
191191
} else {

src/crimson/osd/osd_operations/background_recovery.cc

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,8 @@ seastar::future<> BackgroundRecoveryT<T>::start()
8181
return interruptor::with_interruption([this] {
8282
return do_recovery();
8383
}, [](std::exception_ptr) {
84-
return seastar::make_ready_future<bool>(false);
85-
}, pg, epoch_started).then([](bool do_recovery) {
86-
if (do_recovery) {
87-
return seastar::stop_iteration::no;
88-
} else {
89-
return seastar::stop_iteration::yes;
90-
}
91-
});
84+
return seastar::make_ready_future<seastar::stop_iteration>(seastar::stop_iteration::yes);
85+
}, pg, epoch_started);
9286
});
9387
});
9488
}
@@ -105,13 +99,13 @@ UrgentRecovery::UrgentRecovery(
10599
{
106100
}
107101

108-
UrgentRecovery::interruptible_future<bool>
102+
UrgentRecovery::interruptible_future<seastar::stop_iteration>
109103
UrgentRecovery::do_recovery()
110104
{
111105
LOG_PREFIX(UrgentRecovery::do_recovery);
112106
DEBUGDPPI("{}: {}", *pg, __func__, *this);
113107
if (pg->has_reset_since(epoch_started)) {
114-
return seastar::make_ready_future<bool>(false);
108+
return seastar::make_ready_future<seastar::stop_iteration>(seastar::stop_iteration::yes);
115109
}
116110

117111
return pg->find_unfound(epoch_started
@@ -121,7 +115,7 @@ UrgentRecovery::do_recovery()
121115
return pg->get_recovery_handler()->recover_missing(
122116
trigger, soid, need, false);
123117
}).then_interruptible([] {
124-
return seastar::make_ready_future<bool>(false);
118+
return seastar::make_ready_future<seastar::stop_iteration>(seastar::stop_iteration::yes);
125119
});
126120
});
127121
}
@@ -157,13 +151,13 @@ PglogBasedRecovery::PglogBasedRecovery(
157151
delay)
158152
{}
159153

160-
PglogBasedRecovery::interruptible_future<bool>
154+
PglogBasedRecovery::interruptible_future<seastar::stop_iteration>
161155
PglogBasedRecovery::do_recovery()
162156
{
163157
LOG_PREFIX(PglogBasedRecovery::do_recovery);
164158
DEBUGDPPI("{}: {}", *pg, __func__, *this);
165159
if (pg->has_reset_since(epoch_started)) {
166-
return seastar::make_ready_future<bool>(false);
160+
return seastar::make_ready_future<seastar::stop_iteration>(seastar::stop_iteration::yes);
167161
}
168162
return pg->find_unfound(epoch_started
169163
).then_interruptible([this] {

src/crimson/osd/osd_operations/background_recovery.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class BackgroundRecoveryT : public PhasedOperationT<T> {
4444
scheduler_class
4545
};
4646
}
47-
using do_recovery_ret_t = typename PhasedOperationT<T>::template interruptible_future<bool>;
47+
using do_recovery_ret_t = typename PhasedOperationT<T>::template interruptible_future<seastar::stop_iteration>;
4848
virtual do_recovery_ret_t do_recovery() = 0;
4949
ShardServices &ss;
5050
const crimson::osd::scheduler::scheduler_class_t scheduler_class;
@@ -71,7 +71,7 @@ class UrgentRecovery final : public BackgroundRecoveryT<UrgentRecovery> {
7171

7272
private:
7373
void dump_detail(Formatter* f) const final;
74-
interruptible_future<bool> do_recovery() override;
74+
interruptible_future<seastar::stop_iteration> do_recovery() override;
7575
const hobject_t soid;
7676
const eversion_t need;
7777
};
@@ -100,7 +100,7 @@ class PglogBasedRecovery final : public BackgroundRecoveryT<PglogBasedRecovery>
100100
return epoch_started;
101101
}
102102
private:
103-
interruptible_future<bool> do_recovery() override;
103+
interruptible_future<seastar::stop_iteration> do_recovery() override;
104104
bool cancelled = false;
105105
};
106106

src/crimson/osd/pg.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ void PG::on_active_actmap()
630630
publish_stats_to_osd();
631631
});
632632
} else {
633-
logger().debug("{}: pg not clean, skipping snap trim");
633+
logger().debug("pg not clean, skipping snap trim");
634634
ceph_assert(!peering_state.state_test(PG_STATE_SNAPTRIM));
635635
}
636636
}

src/crimson/osd/pg.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ class PG : public boost::intrusive_ref_counter<
309309
LOG_PREFIX(PG::request_remote_recovery_reservation);
310310
SUBDEBUGDPP(
311311
osd, "priority {} on_grant {} on_preempt {}",
312-
*this, on_grant->get_desc(), on_preempt->get_desc());
312+
*this, priority, on_grant->get_desc(), on_preempt->get_desc());
313313
shard_services.remote_request_reservation(
314314
orderer,
315315
pgid,

0 commit comments

Comments
 (0)