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 <greg@inktank.com>
This commit is contained in:
Greg Farnum 2014-01-15 15:24:38 -08:00
parent e2db4aea87
commit 412afea976

View File

@ -427,6 +427,26 @@ void OSDMonitor::remove_redundant_pg_temp()
}
}
}
if (!osdmap.primary_temp->empty()) {
OSDMap templess(osdmap);
templess.primary_temp.reset(new map<pg_t,int>(*osdmap.primary_temp));
templess.primary_temp->clear();
for (map<pg_t,int>::iterator p = osdmap.primary_temp->begin();
p != osdmap.primary_temp->end();
++p) {
if (pending_inc.new_primary_temp.count(p->first) == 0) {
vector<int> 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()