From: Joao Eduardo Luis Date: Thu, 6 Dec 2012 17:03:13 +0000 (+0000) Subject: mon: PGMonitor: erase entries from 'creating_pgs_by_osd' when set is empty X-Git-Tag: v0.56~97 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=bc6f726825b60f63e3099ca578f7e3f67862e279;p=ceph.git mon: PGMonitor: erase entries from 'creating_pgs_by_osd' when set is empty This patch avoids sending empty MOSDPGCreate's every tick. Fixes: #3571 Signed-off-by: Joao Eduardo Luis --- diff --git a/src/mon/PGMap.cc b/src/mon/PGMap.cc index 3aeb79626827..938e2862aaa3 100644 --- a/src/mon/PGMap.cc +++ b/src/mon/PGMap.cc @@ -309,8 +309,11 @@ void PGMap::stat_pg_sub(const pg_t &pgid, const pg_stat_t &s) pg_sum.sub(s); if (s.state & PG_STATE_CREATING) { creating_pgs.erase(pgid); - if (s.acting.size()) + if (s.acting.size()) { creating_pgs_by_osd[s.acting[0]].erase(pgid); + if (creating_pgs_by_osd[s.acting[0]].size() == 0) + creating_pgs_by_osd.erase(s.acting[0]); + } } } diff --git a/src/mon/PGMonitor.cc b/src/mon/PGMonitor.cc index 6a6dd60b84b1..b66ae8952253 100644 --- a/src/mon/PGMonitor.cc +++ b/src/mon/PGMonitor.cc @@ -775,8 +775,11 @@ void PGMonitor::send_pg_creates() vector acting; int nrep = mon->osdmon()->osdmap.pg_to_acting_osds(on, acting); - if (s.acting.size()) + if (s.acting.size()) { pg_map.creating_pgs_by_osd[s.acting[0]].erase(pgid); + if (pg_map.creating_pgs_by_osd[s.acting[0]].size() == 0) + pg_map.creating_pgs_by_osd.erase(s.acting[0]); + } s.acting = acting; // don't send creates for localized pgs @@ -812,6 +815,7 @@ void PGMonitor::send_pg_creates(int osd, Connection *con) map >::iterator p = pg_map.creating_pgs_by_osd.find(osd); if (p == pg_map.creating_pgs_by_osd.end()) return; + assert(p->second.size() > 0); dout(20) << "send_pg_creates osd." << osd << " pgs " << p->second << dendl; MOSDPGCreate *m = new MOSDPGCreate(mon->osdmon()->osdmap.get_epoch());