From 4ae053439e526fab0451d1502576dce89eb6b44f Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Mon, 4 Sep 2017 13:51:34 +0800 Subject: [PATCH] osd: update info only if new_interval refactor OSD::build_initial_pg_history() so we update the info only if a new interval is identified. also, this is consistent with OSD::build_past_intervals_parallel(). Signed-off-by: Kefu Chai --- src/osd/OSD.cc | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 35c875846900..0dd615527479 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -4423,23 +4423,23 @@ void OSD::build_initial_pg_history( &debug); if (new_interval) { h->same_interval_since = e; - } - if (up != new_up) { - h->same_up_since = e; - } - if (acting_primary != new_acting_primary) { - h->same_primary_since = e; - } - if (pgid.pgid.is_split(lastmap->get_pg_num(pgid.pgid.pool()), - osdmap->get_pg_num(pgid.pgid.pool()), - nullptr)) { - h->last_epoch_split = e; + if (up != new_up) { + h->same_up_since = e; + } + if (acting_primary != new_acting_primary) { + h->same_primary_since = e; + } + if (pgid.pgid.is_split(lastmap->get_pg_num(pgid.pgid.pool()), + osdmap->get_pg_num(pgid.pgid.pool()), + nullptr)) { + h->last_epoch_split = e; + } + up = new_up; + acting = new_acting; + up_primary = new_up_primary; + acting_primary = new_acting_primary; } lastmap = osdmap; - up_primary = new_up_primary; - acting_primary = new_acting_primary; - up = new_up; - acting = new_acting; } dout(20) << __func__ << " " << debug.str() << dendl; dout(10) << __func__ << " " << *h << " " << *pi -- 2.47.3