|
| 1 | +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- |
| 2 | +// vim: ts=8 sw=2 smarttab |
| 3 | + |
| 4 | +#include "logmissing_request.h" |
| 5 | + |
| 6 | +#include "common/Formatter.h" |
| 7 | + |
| 8 | +#include "crimson/osd/osd.h" |
| 9 | +#include "crimson/osd/osd_connection_priv.h" |
| 10 | +#include "crimson/osd/osd_operation_external_tracking.h" |
| 11 | +#include "crimson/osd/pg.h" |
| 12 | +#include "crimson/osd/replicated_backend.h" |
| 13 | + |
| 14 | +SET_SUBSYS(osd); |
| 15 | + |
| 16 | +namespace crimson::osd { |
| 17 | + |
| 18 | +PGPCTRequest::PGPCTRequest(crimson::net::ConnectionRef&& conn, |
| 19 | + Ref<MOSDPGPCT> &&req) |
| 20 | + : l_conn{std::move(conn)}, |
| 21 | + req{std::move(req)} |
| 22 | +{} |
| 23 | + |
| 24 | +void PGPCTRequest::print(std::ostream& os) const |
| 25 | +{ |
| 26 | + os << "PGPCTRequest(" |
| 27 | + << " req=" << *req |
| 28 | + << ")"; |
| 29 | +} |
| 30 | + |
| 31 | +void PGPCTRequest::dump_detail(Formatter *f) const |
| 32 | +{ |
| 33 | + f->open_object_section("PGPCTRequest"); |
| 34 | + f->dump_stream("pgid") << req->get_spg(); |
| 35 | + f->dump_unsigned("map_epoch", req->get_map_epoch()); |
| 36 | + f->dump_unsigned("min_epoch", req->get_min_epoch()); |
| 37 | + f->dump_stream("pg_committed_to") << req->pg_committed_to; |
| 38 | + f->close_section(); |
| 39 | +} |
| 40 | + |
| 41 | +ConnectionPipeline &PGPCTRequest::get_connection_pipeline() |
| 42 | +{ |
| 43 | + return get_osd_priv( |
| 44 | + &get_local_connection() |
| 45 | + ).client_request_conn_pipeline; |
| 46 | +} |
| 47 | + |
| 48 | +PerShardPipeline &PGPCTRequest::get_pershard_pipeline( |
| 49 | + ShardServices &shard_services) |
| 50 | +{ |
| 51 | + return shard_services.get_replicated_request_pipeline(); |
| 52 | +} |
| 53 | + |
| 54 | +PGPCTRequest::interruptible_future<> PGPCTRequest::with_pg_interruptible( |
| 55 | + PG &pg) |
| 56 | +{ |
| 57 | + LOG_PREFIX(PGPCTRequest::with_pg_interruptible); |
| 58 | + DEBUGDPP("{}", pg, *this); |
| 59 | + co_await this->template enter_stage<interruptor>(pg.repop_pipeline.process); |
| 60 | + |
| 61 | + { |
| 62 | + auto fut = this->template with_blocking_event< |
| 63 | + PG_OSDMapGate::OSDMapBlocker::BlockingEvent |
| 64 | + >([this, &pg](auto &&trigger) { |
| 65 | + return pg.osdmap_gate.wait_for_map( |
| 66 | + std::move(trigger), req->min_epoch); |
| 67 | + }); |
| 68 | + co_await interruptor::make_interruptible(std::move(fut)); |
| 69 | + } |
| 70 | + |
| 71 | + // This *must* be a replicated backend, ec doesn't have pct messages |
| 72 | + static_cast<ReplicatedBackend&>(*(pg.backend)).do_pct(*req); |
| 73 | +} |
| 74 | + |
| 75 | +seastar::future<> PGPCTRequest::with_pg( |
| 76 | + ShardServices &shard_services, Ref<PG> pgref) |
| 77 | +{ |
| 78 | + LOG_PREFIX(PGPCTRequest::with_pg); |
| 79 | + DEBUGDPP("{}", *pgref, *this); |
| 80 | + |
| 81 | + PG &pg = *pgref; |
| 82 | + IRef ref = this; |
| 83 | + return interruptor::with_interruption([this, &pg] { |
| 84 | + return with_pg_interruptible(pg); |
| 85 | + }, [](std::exception_ptr) { |
| 86 | + return seastar::now(); |
| 87 | + }, pgref, pgref->get_osdmap_epoch()).finally( |
| 88 | + [FNAME, this, ref=std::move(ref), pgref=std::move(pgref)]() mutable { |
| 89 | + DEBUGDPP("exit", *pgref, *this); |
| 90 | + return handle.complete( |
| 91 | + ).then([ref=std::move(ref), pgref=std::move(pgref)] {}); |
| 92 | + }); |
| 93 | +} |
| 94 | + |
| 95 | +} |
0 commit comments