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
: public MOSDFastDispatchOp
{
23 static const int HEAD_VERSION
= 3;
24 static const int COMPAT_VERSION
= 1;
28 epoch_t map_epoch
, min_epoch
;
32 mempool::osd_pglog::list
<pg_log_entry_t
> entries
;
33 // piggybacked osd/pg state
34 eversion_t pg_trim_to
; // primary->replica: trim to here
35 eversion_t pg_roll_forward_to
; // primary->replica: trim rollback info to here
37 epoch_t
get_epoch() const { return map_epoch
; }
38 spg_t
get_pgid() const { return pgid
; }
39 epoch_t
get_query_epoch() const { return map_epoch
; }
40 ceph_tid_t
get_tid() const { return rep_tid
; }
42 epoch_t
get_map_epoch() const override
{
45 epoch_t
get_min_epoch() const override
{
48 spg_t
get_spg() const override
{
52 MOSDPGUpdateLogMissing()
53 : MOSDFastDispatchOp(MSG_OSD_PG_UPDATE_LOG_MISSING
, HEAD_VERSION
,
55 MOSDPGUpdateLogMissing(
56 const mempool::osd_pglog::list
<pg_log_entry_t
> &entries
,
62 eversion_t pg_trim_to
,
63 eversion_t pg_roll_forward_to
)
64 : MOSDFastDispatchOp(MSG_OSD_PG_UPDATE_LOG_MISSING
, HEAD_VERSION
,
72 pg_trim_to(pg_trim_to
),
73 pg_roll_forward_to(pg_roll_forward_to
)
77 ~MOSDPGUpdateLogMissing() override
{}
80 const char *get_type_name() const override
{ return "PGUpdateLogMissing"; }
81 void print(ostream
& out
) const override
{
82 out
<< "pg_update_log_missing(" << pgid
<< " epoch " << map_epoch
84 << " rep_tid " << rep_tid
85 << " entries " << entries
86 << " trim_to " << pg_trim_to
87 << " roll_forward_to " << pg_roll_forward_to
91 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
{
102 bufferlist::iterator p
= payload
.begin();
103 ::decode(map_epoch
, p
);
106 ::decode(rep_tid
, p
);
107 ::decode(entries
, p
);
108 if (header
.version
>= 2) {
109 ::decode(min_epoch
, p
);
111 min_epoch
= map_epoch
;
113 if (header
.version
>= 3) {
114 ::decode(pg_trim_to
, p
);
115 ::decode(pg_roll_forward_to
, p
);