From 2c03e02a04c217b8461b858fd3b46b73c4a370d1 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 2 May 2016 14:27:16 -0400 Subject: [PATCH 1/2] osd: set pg history last_clean_scrub_stamp on create We were setting the other two; set this one as well. Signed-off-by: Sage Weil (cherry picked from commit 47f540d5b7ecc4ae193057df429db24ca6b3de8d) --- src/osd/OSD.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index d7134cf2f389a..b85083b724fc3 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -7521,6 +7521,7 @@ void OSD::handle_pg_create(OpRequestRef op) history.epoch_created = created; history.last_scrub_stamp = ci->second; history.last_deep_scrub_stamp = ci->second; + history.last_clean_scrub_stamp = ci->second; // project history from created epoch (handle_pg_peering_evt does // it from msg send epoch) From 74dd0359d4d6db3c6dac4fd41703270e5020aad7 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 2 May 2016 14:28:55 -0400 Subject: [PATCH 2/2] 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 (cherry picked from commit 3be3bc60c12448a36f607c8d4fbf3300c7bbdbee) --- 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 9f8b0fb7475d5..69331a5243ac2 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -5892,8 +5892,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)