From 412afea976702087d2de14b6c8791d764fe1fc50 Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Wed, 15 Jan 2014 15:24:38 -0800 Subject: [PATCH] OSDMonitor: make remove_redundant_pg_temp clear primary, too So that this works with future CRUSH changes, we copy the map and clear out the primary_temp, then compare its output with the real map's output. If they match, remove the primary_temp from the real map. Signed-off-by: Greg Farnum --- src/mon/OSDMonitor.cc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 77d33a04bbe..c8623cd206e 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -427,6 +427,26 @@ void OSDMonitor::remove_redundant_pg_temp() } } } + if (!osdmap.primary_temp->empty()) { + OSDMap templess(osdmap); + templess.primary_temp.reset(new map(*osdmap.primary_temp)); + templess.primary_temp->clear(); + for (map::iterator p = osdmap.primary_temp->begin(); + p != osdmap.primary_temp->end(); + ++p) { + if (pending_inc.new_primary_temp.count(p->first) == 0) { + vector real_up, templess_up; + int real_primary, templess_primary; + osdmap.pg_to_acting_osds(p->first, &real_up, &real_primary); + templess.pg_to_acting_osds(p->first, &templess_up, &templess_primary); + if (real_primary == templess_primary){ + dout(10) << " removing unnecessary primary_temp " + << p->first << " -> " << p->second << dendl; + pending_inc.new_primary_temp[p->first] = -1; + } + } + } + } } void OSDMonitor::remove_down_pg_temp()