From: Sage Weil Date: Wed, 5 Mar 2014 18:44:41 +0000 (-0800) Subject: mon/PGMap: return empty stats if pool is not in sum X-Git-Tag: v0.78~87^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F1375%2Fhead;p=ceph.git 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 --- 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);