From: Greg Farnum Date: Thu, 1 Jun 2017 05:19:02 +0000 (-0700) Subject: mon: mgr: remove osd_stats map from PGMapDigest X-Git-Tag: ses5-milestone6~8^2~19^2~8 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=27c5f6b6e977c3dda617ee1045746a2c47f49958;p=ceph.git mon: mgr: remove osd_stats map from PGMapDigest We use this information only for dumps. Stop dumping per-OSD stats as they're not needed. In order to maintain pool "fullness" information, calculate the OSDMap-based rule availibility ratios on the monitor and include those values in the PGMapDigest. Also do it whenever we call dump_pool_stats_full() on the manager. Signed-off-by: Greg Farnum --- diff --git a/src/mon/PGMap.cc b/src/mon/PGMap.cc index b9d769e669d70..1dbb8d116a94d 100644 --- a/src/mon/PGMap.cc +++ b/src/mon/PGMap.cc @@ -29,7 +29,8 @@ void PGMapDigest::encode(bufferlist& bl, uint64_t features) const ::encode(num_pg, bl); ::encode(num_pg_active, bl); ::encode(num_osd, bl); - ::encode(osd_stat, bl); + unordered_map osd_stat_temp; + ::encode(osd_stat_temp, bl); ::encode(pg_pool_sum, bl, features); ::encode(osd_sum, bl); ::encode(pg_sum, bl, features); @@ -52,7 +53,8 @@ void PGMapDigest::decode(bufferlist::iterator& p) ::decode(num_pg, p); ::decode(num_pg_active, p); ::decode(num_osd, p); - ::decode(osd_stat, p); + unordered_map osd_stat_temp; + ::decode(osd_stat_temp, p); ::decode(pg_pool_sum, p); ::decode(osd_sum, p); ::decode(pg_sum, p); @@ -89,12 +91,15 @@ void PGMapDigest::dump(Formatter *f) const } f->close_section(); f->open_array_section("osd_stats"); - for (auto& p : osd_stat) { + int i = 0; + // TODO: this isn't really correct since we can dump non-existent OSDs + // I dunno what osd_last_seq is set to in that case... + for (auto& p : osd_last_seq) { f->open_object_section("osd_stat"); - f->dump_int("osd", p.first); - f->dump_unsigned("seq", osd_last_seq[p.first]); - p.second.dump(f); + f->dump_int("osd", i); + f->dump_unsigned("seq", p); f->close_section(); + ++i; } f->close_section(); f->open_array_section("num_pg_by_state"); diff --git a/src/mon/PGMap.h b/src/mon/PGMap.h index 30417733b604f..a79dfcdfb3743 100644 --- a/src/mon/PGMap.h +++ b/src/mon/PGMap.h @@ -39,7 +39,6 @@ public: virtual ~PGMapDigest() {} mempool::pgmap::vector osd_last_seq; - mempool::pgmap::unordered_map osd_stat; mutable std::map avail_space_by_rule; @@ -145,8 +144,8 @@ public: void pool_cache_io_rate_summary(Formatter *f, ostream *out, uint64_t poolid) const; - void dump_pool_stats_full(const OSDMap &osd_map, stringstream *ss, Formatter *f, - bool verbose) const; + virtual void dump_pool_stats_full(const OSDMap &osd_map, stringstream *ss, + Formatter *f, bool verbose) const; void dump_fs_stats(stringstream *ss, Formatter *f, bool verbose) const; static void dump_object_stat_sum(TextTable &tbl, Formatter *f, const object_stat_sum_t &sum, @@ -214,6 +213,7 @@ public: version_t version; epoch_t last_osdmap_epoch; // last osdmap epoch i applied to the pgmap epoch_t last_pg_scan; // osdmap epoch + mempool::pgmap::unordered_map osd_stat; mempool::pgmap::unordered_map pg_stat; mempool::pgmap::set full_osds; // for pre-luminous only mempool::pgmap::set nearfull_osds; // for pre-luminous only @@ -438,6 +438,11 @@ public: void dump_osd_stats(Formatter *f) const; void dump_delta(Formatter *f) const; void dump_filtered_pg_stats(Formatter *f, set& pgs) const; + void dump_pool_stats_full(const OSDMap &osd_map, stringstream *ss, + Formatter *f, bool verbose) const override { + get_rules_avail(osd_map, &avail_space_by_rule); + PGMapDigest::dump_pool_stats_full(osd_map, ss, f, verbose); + } void dump_pg_stats_plain( ostream& ss,