osd_types.cc: reorder encoding/decoding of fields in pg_stat_t

Fields state, purged_snaps and snaptrimq_len are new to Mimic.
Reorder them in a way that newest field (snaptrimq_len) is before
two others and uses other encoding version, so the pull request
https://github.com/ceph/ceph/pull/19520 can be backported to Luminous
without breaking Luminous -> Mimic upgrade.
This also changes encoding/decoding version back to 24 as both state
and purged snaps were added post-Luminous and pre-Mimic, so we can
push it into a single struct version and keep snaptrimq_len into other
version.

Signed-off-by: Piotr Dałek <piotr.dalek@corp.ovh.com>
This commit is contained in:
Piotr Dałek 2018-01-16 10:28:58 +01:00
parent aab2defaca
commit ae7472fb07

View File

@ -2369,7 +2369,7 @@ void pg_stat_t::dump_brief(Formatter *f) const
void pg_stat_t::encode(bufferlist &bl) const
{
ENCODE_START(25, 22, bl);
ENCODE_START(24, 22, bl);
encode(version, bl);
encode(reported_seq, bl);
encode(reported_epoch, bl);
@ -2410,9 +2410,9 @@ void pg_stat_t::encode(bufferlist &bl) const
encode(last_peered, bl);
encode(last_became_peered, bl);
encode(pin_stats_invalid, bl);
encode(snaptrimq_len, bl);
encode(state, bl);
encode(purged_snaps, bl);
encode(snaptrimq_len, bl);
ENCODE_FINISH(bl);
}
@ -2468,14 +2468,12 @@ void pg_stat_t::decode(bufferlist::iterator &bl)
decode(tmp, bl);
pin_stats_invalid = tmp;
if (struct_v >= 23) {
decode(state, bl);
} else {
state = old_state;
}
if (struct_v >= 24) {
decode(purged_snaps, bl);
if (struct_v >= 25) {
decode(snaptrimq_len, bl);
decode(snaptrimq_len, bl);
if (struct_v >= 24) {
decode(state, bl);
decode(purged_snaps, bl);
} else {
state = old_state;
}
}
DECODE_FINISH(bl);