]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: mgr: remove osd_stats map from PGMapDigest
authorGreg Farnum <gfarnum@redhat.com>
Thu, 1 Jun 2017 05:19:02 +0000 (22:19 -0700)
committerSage Weil <sage@redhat.com>
Fri, 2 Jun 2017 17:06:49 +0000 (13:06 -0400)
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 <gfarnum@redhat.com>
src/mon/PGMap.cc
src/mon/PGMap.h

index b9d769e669d700360eabc373001acfeb1c49e7bf..1dbb8d116a94dd38d943b39c9f4e5bb9bad9c19c 100644 (file)
@@ -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<int32_t,osd_stat_t> 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<int32_t,osd_stat_t> 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");
index 30417733b604f305604a66f88b19b807036d11fc..a79dfcdfb3743f9914874dfbdb4106eca1c54b7c 100644 (file)
@@ -39,7 +39,6 @@ public:
   virtual ~PGMapDigest() {}
 
   mempool::pgmap::vector<uint64_t> osd_last_seq;
-  mempool::pgmap::unordered_map<int32_t,osd_stat_t> osd_stat;
 
   mutable std::map<int, int64_t> 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<int32_t,osd_stat_t> osd_stat;
   mempool::pgmap::unordered_map<pg_t,pg_stat_t> pg_stat;
   mempool::pgmap::set<int32_t> full_osds;     // for pre-luminous only
   mempool::pgmap::set<int32_t> 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<pg_t>& 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,