From: Sage Weil Date: Mon, 8 Jul 2013 20:27:58 +0000 (-0700) Subject: osd: report pg stats to mon at least every N (=500) epochs X-Git-Tag: v0.67-rc1~131^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=da81228cc73c95737f26c630e5c3eccf6ae1aaec;p=ceph.git osd: report pg stats to mon at least every N (=500) epochs 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 --- diff --git a/src/common/config_opts.h b/src/common/config_opts.h index 07e4e01fefce..92f859179360 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -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) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index cdea6b28166f..dd636d9e7f93 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -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(); }