1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
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.
16 #ifndef CEPH_MOSDPGUPDATELOGMISSING_H
17 #define CEPH_MOSDPGUPDATELOGMISSING_H
19 #include "MOSDFastDispatchOp.h"
21 class MOSDPGUpdateLogMissing final
: public MOSDFastDispatchOp
{
23 static constexpr int HEAD_VERSION
= 3;
24 static constexpr int COMPAT_VERSION
= 1;
27 epoch_t map_epoch
= 0, min_epoch
= 0;
30 ceph_tid_t rep_tid
= 0;
31 mempool::osd_pglog::list
<pg_log_entry_t
> entries
;
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
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
; }
41 epoch_t
get_map_epoch() const override
{
44 epoch_t
get_min_epoch() const override
{
47 spg_t
get_spg() const override
{
51 MOSDPGUpdateLogMissing()
52 : MOSDFastDispatchOp
{MSG_OSD_PG_UPDATE_LOG_MISSING
, HEAD_VERSION
,
54 MOSDPGUpdateLogMissing(
55 const mempool::osd_pglog::list
<pg_log_entry_t
> &entries
,
61 eversion_t pg_trim_to
,
62 eversion_t pg_roll_forward_to
)
63 : MOSDFastDispatchOp
{MSG_OSD_PG_UPDATE_LOG_MISSING
, HEAD_VERSION
,
71 pg_trim_to(pg_trim_to
),
72 pg_roll_forward_to(pg_roll_forward_to
)
76 ~MOSDPGUpdateLogMissing() final
{}
79 std::string_view
get_type_name() const override
{ return "PGUpdateLogMissing"; }
80 void print(std::ostream
& out
) const override
{
81 out
<< "pg_update_log_missing(" << pgid
<< " epoch " << map_epoch
83 << " rep_tid " << rep_tid
84 << " entries " << entries
85 << " trim_to " << pg_trim_to
86 << " roll_forward_to " << pg_roll_forward_to
90 void encode_payload(uint64_t features
) override
{
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
);
101 void decode_payload() override
{
103 auto p
= payload
.cbegin();
104 decode(map_epoch
, p
);
109 if (header
.version
>= 2) {
110 decode(min_epoch
, p
);
112 min_epoch
= map_epoch
;
114 if (header
.version
>= 3) {
115 decode(pg_trim_to
, p
);
116 decode(pg_roll_forward_to
, p
);
120 template<class T
, typename
... Args
>
121 friend boost::intrusive_ptr
<T
> ceph::make_message(Args
&&... args
);