summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Farnum <gregory.farnum@dreamhost.com>2012-04-24 15:13:02 -0700
committerSage Weil <sage.weil@dreamhost.com>2012-04-24 16:44:23 -0700
commit4bfcbe6ab890bf0112cd60ed451002dfb7516c1e (patch)
tree582f3aa11be22935fe7789ad7e2a832588c76d5b
parent34ef3f37655a42c376cd1e9e490e4cccf2f44855 (diff)
downloadceph-4bfcbe6ab890bf0112cd60ed451002dfb7516c1e.tar.gz
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>
-rw-r--r--src/mon/PGMap.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/mon/PGMap.cc b/src/mon/PGMap.cc
index 8dd9ced452e..1f6c73b6878 100644
--- a/src/mon/PGMap.cc
+++ b/src/mon/PGMap.cc
@@ -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;
}