From cf503610665089a80cb463a81f8f92834eaf7c56 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 20 Feb 2018 15:49:46 -0600 Subject: [PATCH] osd: update numpg_* counters when removing a pg Usually on a pg create we see an OSDMap update; on PG removal completion we may not. Signed-off-by: Sage Weil --- src/osd/OSD.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 52b30975f6020..6b95be762f46a 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -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); -- 2.39.5