From 22e25247c37691d8704085617948fb9fd16d3ea3 Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Thu, 4 Aug 2011 14:34:57 -0700 Subject: [PATCH] osd: Fix last_epoch_started initialization on new PGs 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 --- src/osd/OSD.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 83eac378aca26..ce8668d3208db 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -991,7 +991,12 @@ PG *OSD::_create_lock_new_pg(pg_t pgid, vector& 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); -- 2.39.5