From 841f2885318d1bcf37aab3f2947b1f40fee772a9 Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Mon, 16 Apr 2012 11:13:45 -0700 Subject: [PATCH] mon: unconditionally encode PGMap full ratios in the Incremental This properly spreads the real value to peon monitors -- they weren't seeing the right values at all before. Initialize all related values to zero so that it's obvious if they somehow avoided becoming set properly. This doesn't require any kind of protocol revision, luckily -- mixing monitors from before and after this change might result in extra work recalculating full sets, but it won't spread bad values or anything. Signed-off-by: Greg Farnum --- src/mon/PGMap.cc | 4 ++-- src/mon/PGMap.h | 2 +- src/mon/PGMonitor.cc | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/mon/PGMap.cc b/src/mon/PGMap.cc index 107c1130fc41b..444d02869dbe7 100644 --- a/src/mon/PGMap.cc +++ b/src/mon/PGMap.cc @@ -131,11 +131,11 @@ void PGMap::apply_incremental(const Incremental& inc) assert(inc.version == version+1); version++; bool ratios_changed = false; - if (inc.full_ratio != 0) { + if (inc.full_ratio != 0 && inc.full_ratio != full_ratio) { full_ratio = inc.full_ratio; ratios_changed = true; } - if (inc.nearfull_ratio != 0) { + if (inc.nearfull_ratio != 0 && inc.nearfull_ratio != nearfull_ratio) { nearfull_ratio = inc.nearfull_ratio; ratios_changed = true; } diff --git a/src/mon/PGMap.h b/src/mon/PGMap.h index 90df77db8a826..d6b9327857683 100644 --- a/src/mon/PGMap.h +++ b/src/mon/PGMap.h @@ -82,7 +82,7 @@ public: PGMap() : version(0), last_osdmap_epoch(0), last_pg_scan(0), - full_ratio(.8), nearfull_ratio(.9), + full_ratio(0), nearfull_ratio(0), num_pg(0), num_osd(0) {} diff --git a/src/mon/PGMonitor.cc b/src/mon/PGMonitor.cc index 56a0722f00c14..8d8a2190bbfc2 100644 --- a/src/mon/PGMonitor.cc +++ b/src/mon/PGMonitor.cc @@ -307,6 +307,8 @@ void PGMonitor::create_pending() { pending_inc = PGMap::Incremental(); pending_inc.version = pg_map.version + 1; + pending_inc.full_ratio = pg_map.full_ratio; + pending_inc.nearfull_ratio = pg_map.nearfull_ratio; dout(10) << "create_pending v " << pending_inc.version << dendl; } -- 2.39.5