]>
Commit | Line | Data |
---|---|---|
1e59de90 TL |
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 | ||
13 | namespace { | |
14 | seastar::logger& logger() { | |
15 | return crimson::get_logger(ceph_subsys_osd); | |
16 | } | |
17 | } | |
18 | ||
19 | namespace crimson::osd { | |
20 | ||
21 | LogMissingRequest::LogMissingRequest(crimson::net::ConnectionRef&& conn, | |
22 | Ref<MOSDPGUpdateLogMissing> &&req) | |
23 | : conn{std::move(conn)}, | |
24 | req{std::move(req)} | |
25 | {} | |
26 | ||
27 | void LogMissingRequest::print(std::ostream& os) const | |
28 | { | |
29 | os << "LogMissingRequest(" | |
30 | << "from=" << req->from | |
31 | << " req=" << *req | |
32 | << ")"; | |
33 | } | |
34 | ||
35 | void LogMissingRequest::dump_detail(Formatter *f) const | |
36 | { | |
37 | f->open_object_section("LogMissingRequest"); | |
38 | f->dump_stream("req_tid") << req->get_tid(); | |
39 | f->dump_stream("pgid") << req->get_spg(); | |
40 | f->dump_unsigned("map_epoch", req->get_map_epoch()); | |
41 | f->dump_unsigned("min_epoch", req->get_min_epoch()); | |
42 | f->dump_stream("entries") << req->entries; | |
43 | f->dump_stream("from") << req->from; | |
44 | f->close_section(); | |
45 | } | |
46 | ||
47 | ConnectionPipeline &LogMissingRequest::get_connection_pipeline() | |
48 | { | |
49 | return get_osd_priv(conn.get()).replicated_request_conn_pipeline; | |
50 | } | |
51 | ||
aee94f69 | 52 | ClientRequest::PGPipeline &LogMissingRequest::client_pp(PG &pg) |
1e59de90 TL |
53 | { |
54 | return pg.request_pg_pipeline; | |
55 | } | |
56 | ||
57 | seastar::future<> LogMissingRequest::with_pg( | |
58 | ShardServices &shard_services, Ref<PG> pg) | |
59 | { | |
60 | logger().debug("{}: LogMissingRequest::with_pg", *this); | |
61 | ||
62 | IRef ref = this; | |
63 | return interruptor::with_interruption([this, pg] { | |
aee94f69 TL |
64 | logger().debug("{}: pg present", *this); |
65 | return this->template enter_stage<interruptor>(client_pp(*pg).await_map | |
66 | ).then_interruptible([this, pg] { | |
67 | return this->template with_blocking_event< | |
68 | PG_OSDMapGate::OSDMapBlocker::BlockingEvent | |
69 | >([this, pg](auto &&trigger) { | |
70 | return pg->osdmap_gate.wait_for_map( | |
71 | std::move(trigger), req->min_epoch); | |
72 | }); | |
73 | }).then_interruptible([this, pg](auto) { | |
74 | return pg->do_update_log_missing(req, conn); | |
75 | }); | |
1e59de90 TL |
76 | }, [ref](std::exception_ptr) { return seastar::now(); }, pg); |
77 | } | |
78 | ||
79 | } |