From f41cb1668672b550baad75bd4cab79258a2af99d Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 10 Mar 2016 11:47:47 -0500 Subject: [PATCH] osd: drop create events based on same_primary_since, not interval Creates are resent when the primary changes, not the interval. Ensure we don't drop something we shouldn't. Signed-off-by: Sage Weil --- src/osd/OSD.cc | 24 ++++++++++++++++++++++-- src/osd/OSD.h | 1 + 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 077a3d3461fbb..87aa1d323df44 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -3329,6 +3329,7 @@ void OSD::handle_pg_peering_evt( const pg_history_t& orig_history, pg_interval_map_t& pi, epoch_t epoch, + bool same_primary, PG::CephPeeringEvtRef evt) { if (service.splitting(pgid)) { @@ -3350,7 +3351,14 @@ void OSD::handle_pg_peering_evt( bool valid_history = project_pg_history( pgid, history, epoch, up, up_primary, acting, acting_primary); - if (!valid_history || epoch < history.same_interval_since) { + if (same_primary && epoch < history.same_primary_since) { + dout(10) << "get_or_create_pg " << pgid << " primary changed in " + << history.same_primary_since << " (msg from " << epoch << ")" + << dendl; + return; + } + if (!valid_history || + (!same_primary && epoch < history.same_interval_since)) { dout(10) << "get_or_create_pg " << pgid << " acting changed in " << history.same_interval_since << " (msg from " << epoch << ")" << dendl; @@ -3476,7 +3484,15 @@ void OSD::handle_pg_peering_evt( } else { // already had it. did the mapping change? PG *pg = _lookup_lock_pg(pgid); - if (epoch < pg->info.history.same_interval_since) { + if (same_primary && epoch < pg->info.history.same_primary_since) { + dout(10) << "get_or_create_pg " << pgid << " primary changed in " + << pg->info.history.same_primary_since + << " (msg from " << epoch << ")" + << dendl; + pg->unlock(); + return; + } + if (!same_primary && epoch < pg->info.history.same_interval_since) { dout(10) << *pg << " get_or_create_pg acting changed in " << pg->info.history.same_interval_since << " (msg from " << epoch << ")" << dendl; @@ -7350,6 +7366,7 @@ void OSD::handle_pg_create(OpRequestRef op) history, pi, m->epoch, + true, // same primary, bc this is a create PG::CephPeeringEvtRef( new PG::CephPeeringEvt( m->epoch, @@ -7582,6 +7599,7 @@ void OSD::handle_pg_notify(OpRequestRef op) spg_t(it->first.info.pgid.pgid, it->first.to), it->first.info.history, it->second, it->first.query_epoch, + false, // same interval PG::CephPeeringEvtRef( new PG::CephPeeringEvt( it->first.epoch_sent, it->first.query_epoch, @@ -7613,6 +7631,7 @@ void OSD::handle_pg_log(OpRequestRef op) handle_pg_peering_evt( spg_t(m->info.pgid.pgid, m->to), m->info.history, m->past_intervals, m->get_epoch(), + false, // same interval PG::CephPeeringEvtRef( new PG::CephPeeringEvt( m->get_epoch(), m->get_query_epoch(), @@ -7646,6 +7665,7 @@ void OSD::handle_pg_info(OpRequestRef op) handle_pg_peering_evt( spg_t(p->first.info.pgid.pgid, p->first.to), p->first.info.history, p->second, p->first.epoch_sent, + false, // same interval PG::CephPeeringEvtRef( new PG::CephPeeringEvt( p->first.epoch_sent, p->first.query_epoch, diff --git a/src/osd/OSD.h b/src/osd/OSD.h index 57feb8dbd494c..438b855b4b9b1 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -1942,6 +1942,7 @@ protected: const pg_history_t& orig_history, pg_interval_map_t& pi, epoch_t epoch, + bool same_primary, PG::CephPeeringEvtRef evt); void load_pgs(); -- 2.39.5