]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: update numpg_* counters when removing a pg
authorSage Weil <sage@redhat.com>
Tue, 20 Feb 2018 21:49:46 +0000 (15:49 -0600)
committerSage Weil <sage@redhat.com>
Wed, 4 Apr 2018 13:26:56 +0000 (08:26 -0500)
Usually on a pg create we see an OSDMap update; on PG removal completion
we may not.

Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/OSD.cc

index 52b30975f6020a6c47184ef0c4fb3c9b9740e63c..6b95be762f46a291862fb3b205df2dac661b8a12 100644 (file)
@@ -1617,6 +1617,14 @@ void OSDService::queue_for_pg_delete(spg_t pgid, epoch_t e)
 
 void OSDService::finish_pg_delete(PG *pg, unsigned old_pg_num)
 {
+  // update pg count now since we might not get an osdmap any time soon.
+  if (pg->is_primary())
+    logger->dec(l_osd_pg_primary);
+  else if (pg->is_replica())
+    logger->dec(l_osd_pg_replica);
+  else
+    logger->dec(l_osd_pg_stray);
+
   osd->unregister_pg(pg);
   for (auto shard : osd->shards) {
     shard->unprime_split_children(pg->pg_id, old_pg_num);