mirror of
https://github.com/ceph/ceph
synced 2025-01-01 16:42:29 +00:00
osd: set min_epoch for push/pull/reply
Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
parent
8c961a311f
commit
cb1a5190cd
@ -18,7 +18,7 @@
|
||||
#include "MOSDFastDispatchOp.h"
|
||||
|
||||
class MOSDPGPull : public MOSDFastDispatchOp {
|
||||
static const int HEAD_VERSION = 2;
|
||||
static const int HEAD_VERSION = 3;
|
||||
static const int COMPAT_VERSION = 2;
|
||||
|
||||
vector<PullOp> pulls;
|
||||
@ -26,12 +26,15 @@ class MOSDPGPull : public MOSDFastDispatchOp {
|
||||
public:
|
||||
pg_shard_t from;
|
||||
spg_t pgid;
|
||||
epoch_t map_epoch;
|
||||
epoch_t map_epoch, min_epoch;
|
||||
uint64_t cost;
|
||||
|
||||
epoch_t get_map_epoch() const override {
|
||||
return map_epoch;
|
||||
}
|
||||
epoch_t get_min_epoch() const override {
|
||||
return min_epoch;
|
||||
}
|
||||
spg_t get_spg() const override {
|
||||
return pgid;
|
||||
}
|
||||
@ -69,6 +72,11 @@ public:
|
||||
::decode(cost, p);
|
||||
::decode(pgid.shard, p);
|
||||
::decode(from, p);
|
||||
if (header.version >= 3) {
|
||||
::decode(min_epoch, p);
|
||||
} else {
|
||||
min_epoch = map_epoch;
|
||||
}
|
||||
}
|
||||
|
||||
void encode_payload(uint64_t features) override {
|
||||
@ -78,13 +86,14 @@ public:
|
||||
::encode(cost, payload);
|
||||
::encode(pgid.shard, payload);
|
||||
::encode(from, payload);
|
||||
::encode(min_epoch, payload);
|
||||
}
|
||||
|
||||
const char *get_type_name() const override { return "MOSDPGPull"; }
|
||||
|
||||
void print(ostream& out) const override {
|
||||
out << "MOSDPGPull(" << pgid
|
||||
<< " e" << map_epoch
|
||||
<< " e" << map_epoch << "/" << min_epoch
|
||||
<< " cost " << cost
|
||||
<< ")";
|
||||
}
|
||||
|
@ -18,13 +18,13 @@
|
||||
#include "MOSDFastDispatchOp.h"
|
||||
|
||||
class MOSDPGPush : public MOSDFastDispatchOp {
|
||||
static const int HEAD_VERSION = 2;
|
||||
static const int HEAD_VERSION = 3;
|
||||
static const int COMPAT_VERSION = 2;
|
||||
|
||||
public:
|
||||
pg_shard_t from;
|
||||
spg_t pgid;
|
||||
epoch_t map_epoch;
|
||||
epoch_t map_epoch, min_epoch;
|
||||
vector<PushOp> pushes;
|
||||
|
||||
private:
|
||||
@ -47,6 +47,9 @@ public:
|
||||
epoch_t get_map_epoch() const override {
|
||||
return map_epoch;
|
||||
}
|
||||
epoch_t get_min_epoch() const override {
|
||||
return min_epoch;
|
||||
}
|
||||
spg_t get_spg() const override {
|
||||
return pgid;
|
||||
}
|
||||
@ -68,6 +71,11 @@ public:
|
||||
::decode(cost, p);
|
||||
::decode(pgid.shard, p);
|
||||
::decode(from, p);
|
||||
if (header.version >= 3) {
|
||||
::decode(min_epoch, p);
|
||||
} else {
|
||||
min_epoch = map_epoch;
|
||||
}
|
||||
}
|
||||
|
||||
void encode_payload(uint64_t features) override {
|
||||
@ -77,13 +85,14 @@ public:
|
||||
::encode(cost, payload);
|
||||
::encode(pgid.shard, payload);
|
||||
::encode(from, payload);
|
||||
::encode(min_epoch, payload);
|
||||
}
|
||||
|
||||
const char *get_type_name() const override { return "MOSDPGPush"; }
|
||||
|
||||
void print(ostream& out) const override {
|
||||
out << "MOSDPGPush(" << pgid
|
||||
<< " " << map_epoch
|
||||
<< " " << map_epoch << "/" << min_epoch
|
||||
<< " " << pushes;
|
||||
out << ")";
|
||||
}
|
||||
|
@ -18,19 +18,22 @@
|
||||
#include "MOSDFastDispatchOp.h"
|
||||
|
||||
class MOSDPGPushReply : public MOSDFastDispatchOp {
|
||||
static const int HEAD_VERSION = 2;
|
||||
static const int HEAD_VERSION = 3;
|
||||
static const int COMPAT_VERSION = 2;
|
||||
|
||||
public:
|
||||
pg_shard_t from;
|
||||
spg_t pgid;
|
||||
epoch_t map_epoch;
|
||||
epoch_t map_epoch, min_epoch;
|
||||
vector<PushReplyOp> replies;
|
||||
uint64_t cost;
|
||||
|
||||
epoch_t get_map_epoch() const override {
|
||||
return map_epoch;
|
||||
}
|
||||
epoch_t get_min_epoch() const override {
|
||||
return min_epoch;
|
||||
}
|
||||
spg_t get_spg() const override {
|
||||
return pgid;
|
||||
}
|
||||
@ -61,6 +64,11 @@ public:
|
||||
::decode(cost, p);
|
||||
::decode(pgid.shard, p);
|
||||
::decode(from, p);
|
||||
if (header.version >= 3) {
|
||||
::decode(min_epoch, p);
|
||||
} else {
|
||||
min_epoch = map_epoch;
|
||||
}
|
||||
}
|
||||
|
||||
void encode_payload(uint64_t features) override {
|
||||
@ -70,11 +78,12 @@ public:
|
||||
::encode(cost, payload);
|
||||
::encode(pgid.shard, payload);
|
||||
::encode(from, payload);
|
||||
::encode(min_epoch, payload);
|
||||
}
|
||||
|
||||
void print(ostream& out) const override {
|
||||
out << "MOSDPGPushReply(" << pgid
|
||||
<< " " << map_epoch
|
||||
<< " " << map_epoch << "/" << min_epoch
|
||||
<< " " << replies;
|
||||
out << ")";
|
||||
}
|
||||
|
@ -480,6 +480,7 @@ void ECBackend::dispatch_recovery_messages(RecoveryMessages &m, int priority)
|
||||
MOSDPGPush *msg = new MOSDPGPush();
|
||||
msg->set_priority(priority);
|
||||
msg->map_epoch = get_parent()->get_epoch();
|
||||
msg->min_epoch = get_parent()->get_last_peering_reset_epoch();
|
||||
msg->from = get_parent()->whoami_shard();
|
||||
msg->pgid = spg_t(get_parent()->get_info().pgid.pgid, i->first.shard);
|
||||
msg->pushes.swap(i->second);
|
||||
@ -496,6 +497,7 @@ void ECBackend::dispatch_recovery_messages(RecoveryMessages &m, int priority)
|
||||
MOSDPGPushReply *msg = new MOSDPGPushReply();
|
||||
msg->set_priority(priority);
|
||||
msg->map_epoch = get_parent()->get_epoch();
|
||||
msg->min_epoch = get_parent()->get_last_peering_reset_epoch();
|
||||
msg->from = get_parent()->whoami_shard();
|
||||
msg->pgid = spg_t(get_parent()->get_info().pgid.pgid, i->first.shard);
|
||||
msg->replies.swap(i->second);
|
||||
|
@ -824,6 +824,7 @@ void ReplicatedBackend::_do_push(OpRequestRef op)
|
||||
reply->set_priority(m->get_priority());
|
||||
reply->pgid = get_info().pgid;
|
||||
reply->map_epoch = m->map_epoch;
|
||||
reply->min_epoch = m->min_epoch;
|
||||
reply->replies.swap(replies);
|
||||
reply->compute_cost(cct);
|
||||
|
||||
@ -902,6 +903,7 @@ void ReplicatedBackend::_do_pull_response(OpRequestRef op)
|
||||
reply->set_priority(m->get_priority());
|
||||
reply->pgid = get_info().pgid;
|
||||
reply->map_epoch = m->map_epoch;
|
||||
reply->min_epoch = m->min_epoch;
|
||||
reply->set_pulls(&replies);
|
||||
reply->compute_cost(cct);
|
||||
|
||||
@ -1847,6 +1849,7 @@ void ReplicatedBackend::send_pushes(int prio, map<pg_shard_t, vector<PushOp> > &
|
||||
msg->from = get_parent()->whoami_shard();
|
||||
msg->pgid = get_parent()->primary_spg_t();
|
||||
msg->map_epoch = get_osdmap()->get_epoch();
|
||||
msg->min_epoch = get_parent()->get_last_peering_reset_epoch();
|
||||
msg->set_priority(prio);
|
||||
for (;
|
||||
(j != i->second.end() &&
|
||||
@ -1882,6 +1885,7 @@ void ReplicatedBackend::send_pulls(int prio, map<pg_shard_t, vector<PullOp> > &p
|
||||
msg->set_priority(prio);
|
||||
msg->pgid = get_parent()->primary_spg_t();
|
||||
msg->map_epoch = get_osdmap()->get_epoch();
|
||||
msg->min_epoch = get_parent()->get_last_peering_reset_epoch();
|
||||
msg->set_pulls(&i->second);
|
||||
msg->compute_cost(cct);
|
||||
get_parent()->send_message_osd_cluster(msg, con);
|
||||
|
Loading…
Reference in New Issue
Block a user