From 433afce6288207b4fa8fcd6f1d72aa617cbd57a3 Mon Sep 17 00:00:00 2001 From: Sage Weil <sage@redhat.com> Date: Tue, 8 Mar 2016 13:46:58 -0500 Subject: [PATCH] mon: initialize last_* timestamps on new pgs to creation time Currently, when you create a pool, until the PGs peer you generate a health error like 8 pgs are stuck inactive for more than 300 seconds which is inaccurate and misleading. Instead, set the timestamps to the creation time so that warnings don't appear until it's clear they're stuck. Fixes: #14952 Signed-off-by: Sage Weil <sage@redhat.com> --- src/mon/PGMonitor.cc | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/mon/PGMonitor.cc b/src/mon/PGMonitor.cc index 31cc9868bec..5cd2edb58c2 100644 --- a/src/mon/PGMonitor.cc +++ b/src/mon/PGMonitor.cc @@ -999,11 +999,28 @@ void PGMonitor::register_pg(OSDMap *osdmap, stats.mapping_epoch = epoch; if (parent_found) { - stats.last_scrub_stamp = pg_map.pg_stat[parent].last_scrub_stamp; - stats.last_deep_scrub_stamp = pg_map.pg_stat[parent].last_deep_scrub_stamp; - stats.last_clean_scrub_stamp = pg_map.pg_stat[parent].last_clean_scrub_stamp; + pg_stat_t &ps = pg_map.pg_stat[parent]; + stats.last_fresh = ps.last_fresh; + stats.last_active = ps.last_active; + stats.last_change = ps.last_change; + stats.last_peered = ps.last_peered; + stats.last_clean = ps.last_clean; + stats.last_unstale = ps.last_unstale; + stats.last_undegraded = ps.last_undegraded; + stats.last_fullsized = ps.last_fullsized; + stats.last_scrub_stamp = ps.last_scrub_stamp; + stats.last_deep_scrub_stamp = ps.last_deep_scrub_stamp; + stats.last_clean_scrub_stamp = ps.last_clean_scrub_stamp; } else { utime_t now = ceph_clock_now(g_ceph_context); + stats.last_fresh = now; + stats.last_active = now; + stats.last_change = now; + stats.last_peered = now; + stats.last_clean = now; + stats.last_unstale = now; + stats.last_undegraded = now; + stats.last_fullsized = now; stats.last_scrub_stamp = now; stats.last_deep_scrub_stamp = now; stats.last_clean_scrub_stamp = now;