From: Sage Weil Date: Mon, 12 Oct 2015 02:06:33 +0000 (-0400) Subject: mon/PGMonitor: avoid useless pg gets when pool is deleted X-Git-Tag: v10.0.1~26^2~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9864a79abcc977b7254cfb40814f19ec69d6bc3a;p=ceph.git mon/PGMonitor: avoid useless pg gets when pool is deleted If the .0 pg no longer exists, we know the entire pool was deleted, and can avoid querying every other pg. (This is a good thing because leveldb and rocksdb can be very slow to query missing keys.) Signed-off-by: Sage Weil --- diff --git a/src/mon/PGMonitor.cc b/src/mon/PGMonitor.cc index 0640b1a6e8c3..e250f59ee218 100644 --- a/src/mon/PGMonitor.cc +++ b/src/mon/PGMonitor.cc @@ -432,16 +432,22 @@ void PGMonitor::apply_pgmap_delta(bufferlist& bl) while (!p.end()) { pg_t pgid; ::decode(pgid, p); - bufferlist bl; - int r = mon->store->get(pgmap_pg_prefix, stringify(pgid), bl); - dout(20) << " refreshing pg " << pgid << " got " << r << " len " - << bl.length() << dendl; - if (pg_pool_sum_old.count(pgid.pool()) == 0) - pg_pool_sum_old[pgid.pool()] = pg_map.pg_pool_sum[pgid.pool()]; + int r; + bufferlist pgbl; + if (deleted_pools.count(pgid.pool())) { + r = -ENOENT; + } else { + r = mon->store->get(pgmap_pg_prefix, stringify(pgid), pgbl); + dout(20) << " refreshing pg " << pgid << " got " << r << " len " + << pgbl.length() << dendl; + + if (pg_pool_sum_old.count(pgid.pool()) == 0) + pg_pool_sum_old[pgid.pool()] = pg_map.pg_pool_sum[pgid.pool()]; + } if (r >= 0) { - pg_map.update_pg(pgid, bl); + pg_map.update_pg(pgid, pgbl); } else { pg_map.remove_pg(pgid); if (pgid.ps() == 0)