Skip to content

Commit

Permalink
osd_types.cc: reorder encoding/decoding of fields in pg_stat_t
Browse files Browse the repository at this point in the history
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
ceph#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>
  • Loading branch information
branch-predictor authored and cache-nez committed Feb 6, 2018
1 parent b08e019 commit ec78fee
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/osd/osd_types.cc
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit ec78fee

Please sign in to comment.