Skip to content

Commit 9d65f7f

Browse files
authored
Merge pull request ceph#57966 from xxhdx1985126/wip-crimson-concurrent-recover-missing
crimson/osd/osd_operations: make the "recover_missing" phase concurrent Reviewed-by: Yingxin Cheng <[email protected]> Reviewed-by: Matan Breizman <[email protected]>
2 parents 40eadba + f90af12 commit 9d65f7f

File tree

4 files changed

+29
-48
lines changed

4 files changed

+29
-48
lines changed

src/crimson/osd/osd_operation_external_tracking.h

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,9 @@ struct LttngBackend
3333
PGActivationBlocker::BlockingEvent::Backend,
3434
scrub::PGScrubber::BlockingEvent::Backend,
3535
ClientRequest::PGPipeline::RecoverMissing::BlockingEvent::Backend,
36-
ClientRequest::PGPipeline::RecoverMissingLockOBC::BlockingEvent::Backend,
37-
ClientRequest::PGPipeline::RecoverMissingLockOBC::
36+
ClientRequest::PGPipeline::RecoverMissing::
3837
BlockingEvent::ExitBarrierEvent::Backend,
39-
ClientRequest::PGPipeline::RecoverMissingSnaps::BlockingEvent::Backend,
38+
ClientRequest::PGPipeline::CheckAlreadyCompleteGetObc::BlockingEvent::Backend,
4039
ClientRequest::PGPipeline::GetOBC::BlockingEvent::Backend,
4140
ClientRequest::PGPipeline::LockOBC::BlockingEvent::Backend,
4241
ClientRequest::PGPipeline::LockOBC::BlockingEvent::ExitBarrierEvent::Backend,
@@ -109,19 +108,13 @@ struct LttngBackend
109108
const ClientRequest::PGPipeline::RecoverMissing& blocker) override {
110109
}
111110

112-
void handle(ClientRequest::PGPipeline::RecoverMissingLockOBC::BlockingEvent& ev,
113-
const Operation& op,
114-
const ClientRequest::PGPipeline::RecoverMissingLockOBC& blocker) override {
115-
}
116-
117-
void handle(ClientRequest::PGPipeline::RecoverMissingLockOBC::
118-
BlockingEvent::ExitBarrierEvent& ev,
119-
const Operation& op) override {
111+
void handle(ClientRequest::PGPipeline::RecoverMissing::BlockingEvent::ExitBarrierEvent& ev,
112+
const Operation& op) override {
120113
}
121114

122-
void handle(ClientRequest::PGPipeline::RecoverMissingSnaps::BlockingEvent& ev,
115+
void handle(ClientRequest::PGPipeline::CheckAlreadyCompleteGetObc::BlockingEvent& ev,
123116
const Operation& op,
124-
const ClientRequest::PGPipeline::RecoverMissingSnaps& blocker) override {
117+
const ClientRequest::PGPipeline::CheckAlreadyCompleteGetObc& blocker) override {
125118
}
126119

127120
void handle(ClientRequest::PGPipeline::GetOBC::BlockingEvent& ev,
@@ -175,10 +168,9 @@ struct HistoricBackend
175168
PGActivationBlocker::BlockingEvent::Backend,
176169
scrub::PGScrubber::BlockingEvent::Backend,
177170
ClientRequest::PGPipeline::RecoverMissing::BlockingEvent::Backend,
178-
ClientRequest::PGPipeline::RecoverMissingLockOBC::BlockingEvent::Backend,
179-
ClientRequest::PGPipeline::RecoverMissingLockOBC::
171+
ClientRequest::PGPipeline::RecoverMissing::
180172
BlockingEvent::ExitBarrierEvent::Backend,
181-
ClientRequest::PGPipeline::RecoverMissingSnaps::BlockingEvent::Backend,
173+
ClientRequest::PGPipeline::CheckAlreadyCompleteGetObc::BlockingEvent::Backend,
182174
ClientRequest::PGPipeline::GetOBC::BlockingEvent::Backend,
183175
ClientRequest::PGPipeline::LockOBC::BlockingEvent::Backend,
184176
ClientRequest::PGPipeline::LockOBC::BlockingEvent::ExitBarrierEvent::Backend,
@@ -251,19 +243,13 @@ struct HistoricBackend
251243
const ClientRequest::PGPipeline::RecoverMissing& blocker) override {
252244
}
253245

254-
void handle(ClientRequest::PGPipeline::RecoverMissingLockOBC::BlockingEvent& ev,
255-
const Operation& op,
256-
const ClientRequest::PGPipeline::RecoverMissingLockOBC& blocker) override {
257-
}
258-
259-
void handle(ClientRequest::PGPipeline::RecoverMissingLockOBC::
260-
BlockingEvent::ExitBarrierEvent& ev,
246+
void handle(ClientRequest::PGPipeline::RecoverMissing::BlockingEvent::ExitBarrierEvent& ev,
261247
const Operation& op) override {
262248
}
263249

264-
void handle(ClientRequest::PGPipeline::RecoverMissingSnaps::BlockingEvent& ev,
250+
void handle(ClientRequest::PGPipeline::CheckAlreadyCompleteGetObc::BlockingEvent& ev,
265251
const Operation& op,
266-
const ClientRequest::PGPipeline::RecoverMissingSnaps& blocker) override {
252+
const ClientRequest::PGPipeline::CheckAlreadyCompleteGetObc& blocker) override {
267253
}
268254

269255
void handle(ClientRequest::PGPipeline::GetOBC::BlockingEvent& ev,

src/crimson/osd/osd_operations/client_request.cc

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -294,9 +294,7 @@ ClientRequest::recover_missing_snaps(
294294
ObjectContextRef head,
295295
std::set<snapid_t> &snaps)
296296
{
297-
LOG_PREFIX(ClientRequest::process_op);
298-
co_await ihref.enter_stage<interruptor>(
299-
client_pp(*pg).recover_missing_snaps, *this);
297+
LOG_PREFIX(ClientRequest::recover_missing_snaps);
300298
for (auto &snap : snaps) {
301299
auto coid = head->obs.oi.soid;
302300
coid.snap = snap;
@@ -323,9 +321,7 @@ ClientRequest::process_op(
323321
instance_handle_t &ihref, Ref<PG> pg, unsigned this_instance_id)
324322
{
325323
LOG_PREFIX(ClientRequest::process_op);
326-
co_await ihref.enter_stage<interruptor>(
327-
client_pp(*pg).recover_missing, *this
328-
);
324+
ihref.enter_stage_sync(client_pp(*pg).recover_missing, *this);
329325
if (!pg->is_primary()) {
330326
DEBUGDPP(
331327
"Skipping recover_missings on non primary pg for soid {}",
@@ -341,9 +337,6 @@ ClientRequest::process_op(
341337

342338
std::set<snapid_t> snaps = snaps_need_to_recover();
343339
if (!snaps.empty()) {
344-
// call with_obc() in order, but wait concurrently for loading.
345-
ihref.enter_stage_sync(
346-
client_pp(*pg).recover_missing_lock_obc, *this);
347340
auto with_obc = pg->obc_loader.with_obc<RWState::RWREAD>(
348341
m->get_hobj().get_head(),
349342
[&snaps, &ihref, pg, this](auto head, auto) {
@@ -356,6 +349,16 @@ ClientRequest::process_op(
356349
}
357350
}
358351

352+
/**
353+
* The previous stage of recover_missing is a concurrent phase.
354+
* Checking for already_complete requests must done exclusively.
355+
* Since get_obc is also an exclusive stage, we can merge both stages into
356+
* a single stage and avoid stage switching overhead.
357+
*/
358+
DEBUGDPP("{}.{}: entering check_already_complete_get_obc",
359+
*pg, *this, this_instance_id);
360+
co_await ihref.enter_stage<interruptor>(
361+
client_pp(*pg).check_already_complete_get_obc, *this);
359362
DEBUGDPP("{}.{}: checking already_complete",
360363
*pg, *this, this_instance_id);
361364
auto completed = co_await pg->already_complete(m->get_reqid());
@@ -374,11 +377,7 @@ ClientRequest::process_op(
374377
co_return;
375378
}
376379

377-
DEBUGDPP("{}.{}: not completed, entering get_obc stage",
378-
*pg, *this, this_instance_id);
379-
co_await ihref.enter_stage<interruptor>(client_pp(*pg).get_obc, *this);
380-
381-
DEBUGDPP("{}.{}: entered get_obc stage, about to wait_scrub",
380+
DEBUGDPP("{}.{}: not completed, about to wait_scrub",
382381
*pg, *this, this_instance_id);
383382
co_await ihref.enter_blocker(
384383
*this, pg->scrubber, &decltype(pg->scrubber)::wait_scrub,

src/crimson/osd/osd_operations/client_request.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,6 @@ class ClientRequest final : public PhasedOperationT<ClientRequest>,
4444
public:
4545
class PGPipeline : public CommonPGPipeline {
4646
public:
47-
struct RecoverMissingLockOBC : OrderedConcurrentPhaseT<RecoverMissingLockOBC> {
48-
static constexpr auto type_name = "ClientRequest::PGPipeline::recover_missing_lock_obc";
49-
} recover_missing_lock_obc;
50-
struct RecoverMissingSnaps : OrderedExclusivePhaseT<RecoverMissingSnaps> {
51-
static constexpr auto type_name = "ClientRequest::PGPipeline::recover_missing_snaps";
52-
} recover_missing_snaps;
5347
struct AwaitMap : OrderedExclusivePhaseT<AwaitMap> {
5448
static constexpr auto type_name = "ClientRequest::PGPipeline::await_map";
5549
} await_map;
@@ -108,9 +102,8 @@ class ClientRequest final : public PhasedOperationT<ClientRequest>,
108102
PGPipeline::WaitForActive::BlockingEvent,
109103
PGActivationBlocker::BlockingEvent,
110104
PGPipeline::RecoverMissing::BlockingEvent,
111-
PGPipeline::RecoverMissingLockOBC::BlockingEvent,
112-
PGPipeline::RecoverMissingSnaps::BlockingEvent,
113105
scrub::PGScrubber::BlockingEvent,
106+
PGPipeline::CheckAlreadyCompleteGetObc::BlockingEvent,
114107
PGPipeline::GetOBC::BlockingEvent,
115108
PGPipeline::LockOBC::BlockingEvent,
116109
PGPipeline::Process::BlockingEvent,

src/crimson/osd/osd_operations/common/pg_pipeline.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,12 @@ class CommonPGPipeline {
1717
struct WaitForActive : OrderedExclusivePhaseT<WaitForActive> {
1818
static constexpr auto type_name = "CommonPGPipeline:::wait_for_active";
1919
} wait_for_active;
20-
struct RecoverMissing : OrderedExclusivePhaseT<RecoverMissing> {
20+
struct RecoverMissing : OrderedConcurrentPhaseT<RecoverMissing> {
2121
static constexpr auto type_name = "CommonPGPipeline::recover_missing";
2222
} recover_missing;
23+
struct CheckAlreadyCompleteGetObc : OrderedExclusivePhaseT<CheckAlreadyCompleteGetObc> {
24+
static constexpr auto type_name = "CommonPGPipeline::check_already_complete_get_obc";
25+
} check_already_complete_get_obc;
2326
struct GetOBC : OrderedExclusivePhaseT<GetOBC> {
2427
static constexpr auto type_name = "CommonPGPipeline::get_obc";
2528
} get_obc;

0 commit comments

Comments
 (0)