]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: PGMonitor: erase entries from 'creating_pgs_by_osd' when set is empty
authorJoao Eduardo Luis <joao.luis@inktank.com>
Thu, 6 Dec 2012 17:03:13 +0000 (17:03 +0000)
committerSage Weil <sage@inktank.com>
Fri, 7 Dec 2012 12:16:15 +0000 (04:16 -0800)
This patch avoids sending empty MOSDPGCreate's every tick.

Fixes: #3571
Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
src/mon/PGMap.cc
src/mon/PGMonitor.cc

index 3aeb796268271c4939836460242d45d73d86f2d3..938e2862aaa315ac0b32b0e07b329735c3bff19c 100644 (file)
@@ -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]);
+    }
   }
 }
 
index 6a6dd60b84b16b6a34487663c77662d48d4cb0b3..b66ae89522539126dcb94cbe082aa929de30dca3 100644 (file)
@@ -775,8 +775,11 @@ void PGMonitor::send_pg_creates()
     vector<int> 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<int, set<pg_t> >::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());