From f6edceefe2ab469f13e1ef7a7bc770bb856db061 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 5 Mar 2014 10:44:41 -0800 Subject: [PATCH] mon/PGMap: return empty stats if pool is not in sum Greg was right! When a pool is created, the PGs are not added to the PGMap until the *next* proposal. Weaken the assert here and return empty stats for non-existent (new) pools so that a pool create + tier add sequence does not crash. Signed-off-by: Sage Weil --- src/mon/PGMap.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/mon/PGMap.h b/src/mon/PGMap.h index 65eccd35cbd..d76b90d355a 100644 --- a/src/mon/PGMap.h +++ b/src/mon/PGMap.h @@ -205,10 +205,11 @@ public: stamp = s; } - const pool_stat_t& get_pg_pool_sum_stat(int64_t pool) { + pool_stat_t get_pg_pool_sum_stat(int64_t pool) { ceph::unordered_map::iterator p = pg_pool_sum.find(pool); - assert(p != pg_pool_sum.end()); - return p->second; + if (p != pg_pool_sum.end()) + return p->second; + return pool_stat_t(); } void update_pg(pg_t pgid, bufferlist& bl); -- 2.47.3