]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr: apply PGMap incremental at same interval as reports
authorSage Weil <sage@redhat.com>
Tue, 23 May 2017 13:49:16 +0000 (09:49 -0400)
committerSage Weil <sage@redhat.com>
Fri, 2 Jun 2017 17:02:53 +0000 (13:02 -0400)
We were doing an incremental per osd stat report; this screws up the
delta stats updates when there are more than a handful of OSDs.  Instead,
do it with the same period as the mgr->mon reports.

Signed-off-by: Sage Weil <sage@redhat.com>
src/mgr/ClusterState.cc
src/mgr/ClusterState.h
src/mgr/DaemonServer.cc

index 127ac06d4dc5b955d4f1ab81fb4c35506f09ca92..b8d35d30453b0a9886c218082cd8b42bb114eeaa 100644 (file)
@@ -49,8 +49,6 @@ void ClusterState::load_digest(MMgrDigest *m)
 void ClusterState::ingest_pgstats(MPGStats *stats)
 {
   Mutex::Locker l(lock);
-  PGMap::Incremental pending_inc;
-  pending_inc.version = pg_map.version + 1; // to make apply_incremental happy
 
   const int from = stats->get_orig_source().num();
   bool is_in = false;
@@ -87,7 +85,13 @@ void ClusterState::ingest_pgstats(MPGStats *stats)
 
     pending_inc.pg_stat_updates[pgid] = pg_stats;
   }
+}
 
+void ClusterState::update_delta_stats()
+{
+  pending_inc.stamp = ceph_clock_now();
+  pending_inc.version = pg_map.version + 1; // to make apply_incremental happy
+  dout(10) << " v" << pending_inc.version << dendl;
   pg_map.apply_incremental(g_ceph_context, pending_inc);
 }
 
@@ -95,8 +99,9 @@ void ClusterState::notify_osdmap(const OSDMap &osd_map)
 {
   Mutex::Locker l(lock);
 
-  PGMap::Incremental pending_inc;
+  pending_inc.stamp = ceph_clock_now();
   pending_inc.version = pg_map.version + 1; // to make apply_incremental happy
+  dout(10) << " v" << pending_inc.version << dendl;
 
   PGMapUpdater::check_osd_map(g_ceph_context, osd_map, pg_map, &pending_inc);
 
index ca7deddaea118ea6fc84ff8a7d81047f886c6648..56ed080b8294a6aceaf3b09b4b9b996a78c1133c 100644 (file)
@@ -39,6 +39,7 @@ protected:
   mutable Mutex lock;
 
   PGMap pg_map;
+  PGMap::Incremental pending_inc;
 
   bufferlist health_json;
   bufferlist mon_status_json;
@@ -48,6 +49,8 @@ public:
   void load_digest(MMgrDigest *m);
   void ingest_pgstats(MPGStats *stats);
 
+  void update_delta_stats();
+
   const bufferlist &get_health() const {return health_json;}
   const bufferlist &get_mon_status() const {return mon_status_json;}
 
index 07526bae62143d070d3f6651212d16108fb726a3..7fe9208ab23b875624029cc902a561b5d477abcb 100644 (file)
@@ -819,6 +819,8 @@ void DaemonServer::send_report()
 {
   auto m = new MMonMgrReport();
   cluster_state.with_pgmap([&](const PGMap& pg_map) {
+      cluster_state.update_delta_stats();
+
       // FIXME: no easy way to get mon features here.  this will do for
       // now, though, as long as we don't make a backward-incompat change.
       pg_map.encode_digest(m->get_data(), CEPH_FEATURES_ALL);