]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: report pg stats to mon at least every N (=500) epochs
authorSage Weil <sage@inktank.com>
Mon, 8 Jul 2013 20:27:58 +0000 (13:27 -0700)
committerSage Weil <sage@inktank.com>
Tue, 9 Jul 2013 20:42:34 +0000 (13:42 -0700)
The mon needs a moderately accurate last_epoch_clean value in order to trim
old osdmaps.  To prevent a PG that hasn't peered or received IO in forever
from preventing this, send pg stats at some minimum frequency.  This will
increase the pg stat report workload for the mon over an idle pool, but
should be no worse that a cluster that is getting actual IO and sees these
updates from normal stat updates.

This makes the reported update a bit more aggressive/useful in that the epoch
is the last map epoch processed by this PG and not just one that is >= the
currenting interval.  Note that the semantics of this field are pretty useless
at this point.

See #5519

Signed-off-by: Sage Weil <sage@inktank.com>
src/common/config_opts.h
src/osd/PG.cc

index 07e4e01fefcea379181ae017e655b08e4b07ff50..92f85917936087a55aebfabe0c0a722b56ad70e4 100644 (file)
@@ -419,6 +419,7 @@ OPTION(osd_heartbeat_min_peers, OPT_INT, 10)     // minimum number of peers
 OPTION(osd_mon_heartbeat_interval, OPT_INT, 30)  // (seconds) how often to ping monitor if no peers
 OPTION(osd_mon_report_interval_max, OPT_INT, 120)
 OPTION(osd_mon_report_interval_min, OPT_INT, 5)  // pg stats, failures, up_thru, boot.
+OPTION(osd_pg_stat_report_interval_max, OPT_INT, 500)  // report pg stats for any given pg at least this often
 OPTION(osd_mon_ack_timeout, OPT_INT, 30) // time out a mon if it doesn't ack stats
 OPTION(osd_default_data_pool_replay_window, OPT_INT, 45)
 OPTION(osd_preserve_trimmed_log, OPT_BOOL, false)
index cdea6b28166fd5fac5c638f4c38a78bc7297182e..dd636d9e7f93abac252e257aa9ab06e9d70c7416 100644 (file)
@@ -1888,7 +1888,7 @@ void PG::publish_stats_to_osd()
   pg_stats_publish_lock.Lock();
   if (is_primary()) {
     // update our stat summary
-    info.stats.reported.inc(info.history.same_primary_since);
+    info.stats.reported.inc(get_osdmap()->get_epoch());
     info.stats.version = info.last_update;
     info.stats.created = info.history.epoch_created;
     info.stats.last_scrub = info.history.last_scrub;
@@ -5929,6 +5929,14 @@ boost::statechart::result PG::RecoveryState::Active::react(const AdvMap& advmap)
       pg->state_set(PG_STATE_DEGRADED);
     pg->publish_stats_to_osd(); // degraded may have changed
   }
+
+  // if we haven't reported our PG stats in a long time, do so now.
+  if (pg->info.stats.reported.epoch + g_conf->osd_pg_stat_report_interval_max < advmap.osdmap->get_epoch()) {
+    dout(20) << "reporting stats to osd after " << (advmap.osdmap->get_epoch() - pg->info.stats.reported.epoch)
+            << " epochs" << dendl;
+    pg->publish_stats_to_osd();
+  }
+
   return forward_event();
 }