]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/PGMonitor: avoid useless pg gets when pool is deleted
authorSage Weil <sage@redhat.com>
Mon, 12 Oct 2015 02:06:33 +0000 (22:06 -0400)
committerSage Weil <sage@redhat.com>
Mon, 23 Nov 2015 13:38:51 +0000 (08:38 -0500)
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 <sage@redhat.com>
src/mon/PGMonitor.cc

index 0640b1a6e8c37d02403a2314b4ee73f91b21e5a3..e250f59ee218f38843f5442a1203cc00e375b8a0 100644 (file)
@@ -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)