]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: drop create events based on same_primary_since, not interval
authorSage Weil <sage@redhat.com>
Thu, 10 Mar 2016 16:47:47 +0000 (11:47 -0500)
committerSage Weil <sage@redhat.com>
Mon, 14 Mar 2016 15:29:21 +0000 (11:29 -0400)
Creates are resent when the primary changes, not the interval.
Ensure we don't drop something we shouldn't.

Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/OSD.cc
src/osd/OSD.h

index 077a3d3461fbb2cc7667f4ee68690e748ff98a5c..87aa1d323df441e1250a60e94a0b605f81a63646 100644 (file)
@@ -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,
index 57feb8dbd494c49fdd325186f8fbcaba2d063e70..438b855b4b9b135f6f1472ffdd443e59d6db1049 100644 (file)
@@ -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();