]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/PG: set last_* PG fields on a creating PG 10007/head
authorSage Weil <sage@redhat.com>
Mon, 2 May 2016 18:28:55 +0000 (14:28 -0400)
committerLoic Dachary <ldachary@redhat.com>
Wed, 29 Jun 2016 08:47:42 +0000 (10:47 +0200)
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 <sage@redhat.com>
(cherry picked from commit 3be3bc60c12448a36f607c8d4fbf3300c7bbdbee)

src/osd/PG.cc

index 9f8b0fb7475d543c7a72caa647460fdf3a8b1264..69331a5243ac2c90aed83b7b6f5c302edb079c31 100644 (file)
@@ -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)