osd: min_epoch for MOSDPGUpdateLogMissing[Reply]

Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
Sage Weil 2017-02-27 20:46:35 -06:00
parent 024235fcd8
commit fad0994cba
3 changed files with 31 additions and 4 deletions

View File

@ -20,12 +20,12 @@
class MOSDPGUpdateLogMissing : public MOSDFastDispatchOp {
static const int HEAD_VERSION = 1;
static const int HEAD_VERSION = 2;
static const int COMPAT_VERSION = 1;
public:
epoch_t map_epoch;
epoch_t map_epoch, min_epoch;
spg_t pgid;
shard_id_t from;
ceph_tid_t rep_tid;
@ -35,9 +35,13 @@ public:
spg_t get_pgid() const { return pgid; }
epoch_t get_query_epoch() const { return map_epoch; }
ceph_tid_t get_tid() const { return rep_tid; }
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;
}
@ -50,10 +54,12 @@ public:
spg_t pgid,
shard_id_t from,
epoch_t epoch,
epoch_t min_epoch,
ceph_tid_t rep_tid)
: MOSDFastDispatchOp(MSG_OSD_PG_UPDATE_LOG_MISSING, HEAD_VERSION,
COMPAT_VERSION),
map_epoch(epoch),
min_epoch(min_epoch),
pgid(pgid),
from(from),
rep_tid(rep_tid),
@ -66,6 +72,7 @@ public:
const char *get_type_name() const override { return "PGUpdateLogMissing"; }
void print(ostream& out) const override {
out << "pg_update_log_missing(" << pgid << " epoch " << map_epoch
<< "/" << min_epoch
<< " rep_tid " << rep_tid
<< " entries " << entries << ")";
}
@ -76,6 +83,7 @@ public:
::encode(from, payload);
::encode(rep_tid, payload);
::encode(entries, payload);
::encode(min_epoch, payload);
}
void decode_payload() override {
bufferlist::iterator p = payload.begin();
@ -84,6 +92,11 @@ public:
::decode(from, p);
::decode(rep_tid, p);
::decode(entries, p);
if (header.version >= 2) {
::decode(min_epoch, p);
} else {
min_epoch = map_epoch;
}
}
};

View File

@ -20,12 +20,12 @@
class MOSDPGUpdateLogMissingReply : public MOSDFastDispatchOp {
static const int HEAD_VERSION = 1;
static const int HEAD_VERSION = 2;
static const int COMPAT_VERSION = 1;
public:
epoch_t map_epoch;
epoch_t map_epoch, min_epoch;
spg_t pgid;
shard_id_t from;
ceph_tid_t rep_tid;
@ -40,6 +40,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;
}
@ -54,12 +57,14 @@ public:
spg_t pgid,
shard_id_t from,
epoch_t epoch,
epoch_t min_epoch,
ceph_tid_t rep_tid)
: MOSDFastDispatchOp(
MSG_OSD_PG_UPDATE_LOG_MISSING_REPLY,
HEAD_VERSION,
COMPAT_VERSION),
map_epoch(epoch),
min_epoch(min_epoch),
pgid(pgid),
from(from),
rep_tid(rep_tid)
@ -72,6 +77,7 @@ public:
const char *get_type_name() const override { return "PGUpdateLogMissingReply"; }
void print(ostream& out) const override {
out << "pg_update_log_missing_reply(" << pgid << " epoch " << map_epoch
<< "/" << min_epoch
<< " rep_tid " << rep_tid << ")";
}
@ -80,6 +86,7 @@ public:
::encode(pgid, payload);
::encode(from, payload);
::encode(rep_tid, payload);
::encode(min_epoch, payload);
}
void decode_payload() override {
bufferlist::iterator p = payload.begin();
@ -87,6 +94,11 @@ public:
::decode(pgid, p);
::decode(from, p);
::decode(rep_tid, p);
if (header.version >= 2) {
::decode(min_epoch, p);
} else {
min_epoch = map_epoch;
}
}
};

View File

@ -8867,6 +8867,7 @@ void PrimaryLogPG::submit_log_entries(
spg_t(info.pgid.pgid, i->shard),
pg_whoami.shard,
get_osdmap()->get_epoch(),
last_peering_reset,
repop->rep_tid);
osd->send_message_osd_cluster(
peer.osd, m, get_osdmap()->get_epoch());
@ -9903,6 +9904,7 @@ void PrimaryLogPG::do_update_log_missing(OpRequestRef &op)
spg_t(info.pgid.pgid, primary_shard().shard),
pg_whoami.shard,
msg->get_epoch(),
msg->min_epoch,
msg->get_tid());
reply->set_priority(CEPH_MSG_PRIO_HIGH);
msg->get_connection()->send_message(reply);