]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/PG: set last_* PG fields on a creating PG 8881/head
authorSage Weil <sage@redhat.com>
Mon, 2 May 2016 18:28:55 +0000 (14:28 -0400)
committerSage Weil <sage@redhat.com>
Mon, 2 May 2016 18:28:55 +0000 (14:28 -0400)
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>
src/osd/PG.cc

index 55d5495d1c94559d1df6167ec4a2f806f852c334..48bdee84a67d7cfd2646c13ce69e2c41686aea30 100644 (file)
@@ -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)