]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: Fix last_epoch_started initialization on new PGs
authorGreg Farnum <gregory.farnum@dreamhost.com>
Thu, 4 Aug 2011 21:34:57 +0000 (14:34 -0700)
committerGreg Farnum <gregory.farnum@dreamhost.com>
Thu, 4 Aug 2011 21:34:57 +0000 (14:34 -0700)
This used to be safe by virtue of assigning same_acting_since
to osdmap->get_epoch(), but since we fixed bugs by handling
that better we now need to update the last_epoch_started
initialization.

Signed-off-by: Greg Farnum <gregory.farnum@dreamhost.com>
src/osd/OSD.cc

index 83eac378aca2697e76e7aad71969c9cd04eefe96..ce8668d3208db2a84e7edd2f3adb40b49647564c 100644 (file)
@@ -991,7 +991,12 @@ PG *OSD::_create_lock_new_pg(pg_t pgid, vector<int>& acting, ObjectStore::Transa
   pg->acting.swap(acting);
   pg->up = pg->acting;
   pg->info.history = history;
-  pg->info.history.last_epoch_started = osdmap->get_epoch() - 1; // FIXME: Really? It's a brand new PG!
+  /* This is weird, but all the peering code needs last_epoch_start
+   * to be less than same_acting_since. Make it so!
+   * This is easier to deal with if you remember that the PG, while
+   * now created in memory, still hasn't peered and started -- and
+   * the map epoch could change before that happens! */
+  pg->info.history.last_epoch_started = history.epoch_created - 1;
 
   pg->write_info(t);
   pg->write_log(t);