From 3be3bc60c12448a36f607c8d4fbf3300c7bbdbee Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 2 May 2016 14:28:55 -0400 Subject: [PATCH] osd/PG: set last_* PG fields on a creating PG Use the value from pg_history_t that ultimately came from the mon if last_epoch_started == 0. This establishes a sane lower bound on these timestamps, and prevents a mon health error from coming up about how a PG is stuck in whatever state while it is being created. (We addressed half of this problem in commit 6ca6aeac, but the warning comes back as soon as the OSD reports with a creating state.) Fixes: http://tracker.ceph.com/issues/14952 Signed-off-by: Sage Weil --- src/osd/PG.cc | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 55d5495d1c9..48bdee84a67 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -5865,8 +5865,23 @@ PG::RecoveryState::Primary::Primary(my_context ctx) assert(pg->want_acting.empty()); // set CREATING bit until we have peered for the first time. - if (pg->info.history.last_epoch_started == 0) + if (pg->info.history.last_epoch_started == 0) { pg->state_set(PG_STATE_CREATING); + // use the history timestamp, which ultimately comes from the + // monitor in the create case. + utime_t t = pg->info.history.last_scrub_stamp; + pg->info.stats.last_fresh = t; + pg->info.stats.last_active = t; + pg->info.stats.last_change = t; + pg->info.stats.last_peered = t; + pg->info.stats.last_clean = t; + pg->info.stats.last_unstale = t; + pg->info.stats.last_undegraded = t; + pg->info.stats.last_fullsized = t; + pg->info.stats.last_scrub_stamp = t; + pg->info.stats.last_deep_scrub_stamp = t; + pg->info.stats.last_clean_scrub_stamp = t; + } } boost::statechart::result PG::RecoveryState::Primary::react(const MNotifyRec& notevt) -- 2.39.5