mirror of
https://github.com/ceph/ceph
synced 2025-04-01 14:51:13 +00:00
mon: decode old PGMap Incrementals differently from new ones
We need to distinguish between the old 0 (meaning undefined) and the new 0 (meaning switch to 0 and disable the flags). So rev the encoding version on PGMap::Incremental, and if you decode an old version with [near]full_ratio == 0, set the ratio to -1 instead. Then when applying the Incremental interpret -1 as no change. Signed-off-by: Greg Farnum <gregory.farnum@dreamhost.com> Reviewed-by: Sage Weil <sage@newdream.net>
This commit is contained in:
parent
34ef3f3765
commit
4bfcbe6ab8
@ -12,7 +12,7 @@
|
||||
|
||||
void PGMap::Incremental::encode(bufferlist &bl) const
|
||||
{
|
||||
__u8 v = 3;
|
||||
__u8 v = 4;
|
||||
::encode(v, bl);
|
||||
::encode(version, bl);
|
||||
::encode(pg_stat_updates, bl);
|
||||
@ -63,6 +63,12 @@ void PGMap::Incremental::decode(bufferlist::iterator &bl)
|
||||
} else {
|
||||
::decode(pg_remove, bl);
|
||||
}
|
||||
if (v < 4 && full_ratio == 0) {
|
||||
full_ratio = -1;
|
||||
}
|
||||
if (v < 4 && nearfull_ratio == 0) {
|
||||
nearfull_ratio = -1;
|
||||
}
|
||||
}
|
||||
|
||||
void PGMap::Incremental::dump(Formatter *f) const
|
||||
@ -131,11 +137,11 @@ void PGMap::apply_incremental(const Incremental& inc)
|
||||
assert(inc.version == version+1);
|
||||
version++;
|
||||
bool ratios_changed = false;
|
||||
if (inc.full_ratio != full_ratio) {
|
||||
if (inc.full_ratio != full_ratio && inc.full_ratio != -1) {
|
||||
full_ratio = inc.full_ratio;
|
||||
ratios_changed = true;
|
||||
}
|
||||
if (inc.nearfull_ratio != nearfull_ratio) {
|
||||
if (inc.nearfull_ratio != nearfull_ratio && inc.full_ratio != -1) {
|
||||
nearfull_ratio = inc.nearfull_ratio;
|
||||
ratios_changed = true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user