]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- |
2 | // vim: ts=8 sw=2 smarttab | |
3 | /* | |
4 | * Ceph - scalable distributed file system | |
5 | * | |
6 | * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net> | |
7 | * | |
8 | * This is free software; you can redistribute it and/or | |
9 | * modify it under the terms of the GNU Lesser General Public | |
10 | * License version 2.1, as published by the Free Software | |
11 | * Foundation. See file COPYING. | |
12 | * | |
13 | */ | |
14 | ||
15 | ||
16 | #ifndef CEPH_MOSDPGUPDATELOGMISSING_H | |
17 | #define CEPH_MOSDPGUPDATELOGMISSING_H | |
18 | ||
19 | #include "MOSDFastDispatchOp.h" | |
20 | ||
9f95a23c | 21 | class MOSDPGUpdateLogMissing : public MOSDFastDispatchOp { |
11fdf7f2 TL |
22 | private: |
23 | static constexpr int HEAD_VERSION = 3; | |
24 | static constexpr int COMPAT_VERSION = 1; | |
7c673cae | 25 | |
7c673cae | 26 | public: |
11fdf7f2 | 27 | epoch_t map_epoch = 0, min_epoch = 0; |
7c673cae FG |
28 | spg_t pgid; |
29 | shard_id_t from; | |
11fdf7f2 | 30 | ceph_tid_t rep_tid = 0; |
31f18b77 | 31 | mempool::osd_pglog::list<pg_log_entry_t> entries; |
94b18763 FG |
32 | // piggybacked osd/pg state |
33 | eversion_t pg_trim_to; // primary->replica: trim to here | |
34 | eversion_t pg_roll_forward_to; // primary->replica: trim rollback info to here | |
7c673cae FG |
35 | |
36 | epoch_t get_epoch() const { return map_epoch; } | |
37 | spg_t get_pgid() const { return pgid; } | |
38 | epoch_t get_query_epoch() const { return map_epoch; } | |
39 | ceph_tid_t get_tid() const { return rep_tid; } | |
40 | ||
41 | epoch_t get_map_epoch() const override { | |
42 | return map_epoch; | |
43 | } | |
44 | epoch_t get_min_epoch() const override { | |
45 | return min_epoch; | |
46 | } | |
47 | spg_t get_spg() const override { | |
48 | return pgid; | |
49 | } | |
50 | ||
51 | MOSDPGUpdateLogMissing() | |
9f95a23c TL |
52 | : MOSDFastDispatchOp{MSG_OSD_PG_UPDATE_LOG_MISSING, HEAD_VERSION, |
53 | COMPAT_VERSION} {} | |
7c673cae | 54 | MOSDPGUpdateLogMissing( |
31f18b77 | 55 | const mempool::osd_pglog::list<pg_log_entry_t> &entries, |
7c673cae FG |
56 | spg_t pgid, |
57 | shard_id_t from, | |
58 | epoch_t epoch, | |
59 | epoch_t min_epoch, | |
94b18763 FG |
60 | ceph_tid_t rep_tid, |
61 | eversion_t pg_trim_to, | |
62 | eversion_t pg_roll_forward_to) | |
9f95a23c TL |
63 | : MOSDFastDispatchOp{MSG_OSD_PG_UPDATE_LOG_MISSING, HEAD_VERSION, |
64 | COMPAT_VERSION}, | |
7c673cae FG |
65 | map_epoch(epoch), |
66 | min_epoch(min_epoch), | |
67 | pgid(pgid), | |
68 | from(from), | |
69 | rep_tid(rep_tid), | |
94b18763 FG |
70 | entries(entries), |
71 | pg_trim_to(pg_trim_to), | |
72 | pg_roll_forward_to(pg_roll_forward_to) | |
73 | {} | |
7c673cae FG |
74 | |
75 | private: | |
76 | ~MOSDPGUpdateLogMissing() override {} | |
77 | ||
78 | public: | |
11fdf7f2 | 79 | std::string_view get_type_name() const override { return "PGUpdateLogMissing"; } |
7c673cae FG |
80 | void print(ostream& out) const override { |
81 | out << "pg_update_log_missing(" << pgid << " epoch " << map_epoch | |
82 | << "/" << min_epoch | |
83 | << " rep_tid " << rep_tid | |
94b18763 FG |
84 | << " entries " << entries |
85 | << " trim_to " << pg_trim_to | |
86 | << " roll_forward_to " << pg_roll_forward_to | |
87 | << ")"; | |
7c673cae FG |
88 | } |
89 | ||
90 | void encode_payload(uint64_t features) override { | |
11fdf7f2 TL |
91 | using ceph::encode; |
92 | encode(map_epoch, payload); | |
93 | encode(pgid, payload); | |
94 | encode(from, payload); | |
95 | encode(rep_tid, payload); | |
96 | encode(entries, payload); | |
97 | encode(min_epoch, payload); | |
98 | encode(pg_trim_to, payload); | |
99 | encode(pg_roll_forward_to, payload); | |
7c673cae FG |
100 | } |
101 | void decode_payload() override { | |
11fdf7f2 TL |
102 | auto p = payload.cbegin(); |
103 | decode(map_epoch, p); | |
104 | decode(pgid, p); | |
105 | decode(from, p); | |
106 | decode(rep_tid, p); | |
107 | decode(entries, p); | |
7c673cae | 108 | if (header.version >= 2) { |
11fdf7f2 | 109 | decode(min_epoch, p); |
7c673cae FG |
110 | } else { |
111 | min_epoch = map_epoch; | |
112 | } | |
94b18763 | 113 | if (header.version >= 3) { |
11fdf7f2 TL |
114 | decode(pg_trim_to, p); |
115 | decode(pg_roll_forward_to, p); | |
94b18763 | 116 | } |
7c673cae | 117 | } |
9f95a23c TL |
118 | private: |
119 | template<class T, typename... Args> | |
120 | friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args); | |
7c673cae FG |
121 | }; |
122 | ||
123 | #endif |