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 <sage@inktank.com>
This commit is contained in:
Sage Weil 2013-07-08 13:27:58 -07:00
parent 449283f802
commit da81228cc7
2 changed files with 10 additions and 1 deletions

View 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)

View 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();
}