]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
OSDMonitor::prepare_pgtemp: only update up_thru if newer 11937/head
authorSamuel Just <sjust@redhat.com>
Wed, 8 Jun 2016 00:15:05 +0000 (17:15 -0700)
committerNathan Cutler <ncutler@suse.com>
Sat, 12 Nov 2016 13:36:23 +0000 (14:36 +0100)
Fixes: http://tracker.ceph.com/issues/16185
Signed-off-by: Samuel Just <sjust@redhat.com>
(cherry picked from commit 5f2bd7b6b28aad96d68444b22c04b8b24564616b)

Conflicts:
src/mon/OSDMonitor.cc (master uses C++11 "auto" for new_up_thru
        iterator, replace with explicit type)
src/mon/OSDMonitor.h (trivial resolution)

src/mon/OSDMonitor.cc
src/mon/OSDMonitor.h

index a006dbde648ffa319ed8b831cb50e735b3968f6b..ccc62a18224e5d803c1ecf7699bfc551a24907da 100644 (file)
@@ -1974,7 +1974,7 @@ bool OSDMonitor::prepare_alive(MOSDAlive *m)
 
   dout(7) << "prepare_alive want up_thru " << m->want << " have " << m->version
          << " from " << m->get_orig_source_inst() << dendl;
-  pending_inc.new_up_thru[from] = m->version;  // set to the latest map the OSD has
+  update_up_thru(from, m->version); // set to the latest map the OSD has
   wait_for_finished_proposal(new C_ReplyMap(this, m, m->version));
   return true;
 }
@@ -2076,6 +2076,19 @@ bool OSDMonitor::preprocess_pgtemp(MOSDPGTemp *m)
   return true;
 }
 
+void OSDMonitor::update_up_thru(int from, epoch_t up_thru)
+{
+  epoch_t old_up_thru = osdmap.get_up_thru(from);
+  map<int32_t,epoch_t>::iterator ut = pending_inc.new_up_thru.find(from);
+  if (ut != pending_inc.new_up_thru.end()) {
+    old_up_thru = ut->second;
+  }
+  if (up_thru > old_up_thru) {
+    // set up_thru too, so the osd doesn't have to ask again
+    pending_inc.new_up_thru[from] = up_thru;
+  }
+}
+
 bool OSDMonitor::prepare_pgtemp(MOSDPGTemp *m)
 {
   int from = m->get_orig_source().num();
@@ -2101,7 +2114,10 @@ bool OSDMonitor::prepare_pgtemp(MOSDPGTemp *m)
        pending_inc.new_primary_temp.count(p->first))
       pending_inc.new_primary_temp[p->first] = -1;
   }
-  pending_inc.new_up_thru[from] = m->map_epoch;   // set up_thru too, so the osd doesn't have to ask again
+
+  // set up_thru too, so the osd doesn't have to ask again
+  update_up_thru(from, m->map_epoch);
+
   wait_for_finished_proposal(new C_ReplyMap(this, m, m->map_epoch));
   return true;
 }
index d8a3e1fa4575e926a1adbe482a2565b0d0d739a7..fe9893af464228bfffbc484bd2586df101d47a1e 100644 (file)
@@ -246,6 +246,7 @@ private:
   bool prepare_boot(class MOSDBoot *m);
   void _booted(MOSDBoot *m, bool logit);
 
+  void update_up_thru(int from, epoch_t up_thru);
   bool preprocess_alive(class MOSDAlive *m);
   bool prepare_alive(class MOSDAlive *m);
   void _reply_map(PaxosServiceMessage *m, epoch_t e);