]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: move osd epoch cache update into helper, add fixme
authorSage Weil <sage@redhat.com>
Thu, 12 Feb 2015 21:50:42 +0000 (13:50 -0800)
committerSage Weil <sage@redhat.com>
Fri, 13 Feb 2015 13:48:25 +0000 (05:48 -0800)
There is no semantic change here, just a helper to make things more
clear.

Add warning about a potential bug so we don't lose track.

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

index c008e20680e8eda0ecef031e768e9d1147a9a253..16840b8048f3a5d9f3bd4e71637bb4316729b064 100644 (file)
@@ -2145,7 +2145,7 @@ void OSDMonitor::send_incremental(PaxosServiceMessage *req, epoch_t first)
     mon->send_reply(req, m);
 
     if (osd >= 0)
-      osd_epoch[osd] = osdmap.get_epoch();
+      note_osd_has_epoch(osd, osdmap.get_epoch());
     return;
   }
 
@@ -2158,7 +2158,27 @@ void OSDMonitor::send_incremental(PaxosServiceMessage *req, epoch_t first)
   mon->send_reply(req, m);
 
   if (osd >= 0)
-    osd_epoch[osd] = last;
+    note_osd_has_epoch(osd, last);
+}
+
+// FIXME: we assume the OSD actually receives this.  if the mon
+// session drops and they reconnect we may not share the same maps
+// with them again, which could cause a strange hang (perhaps stuck
+// 'waiting for osdmap' requests?).  this information should go in the
+// MonSession, but I think these functions need to be refactored in
+// terms of MonSession first for that to work.
+void OSDMonitor::note_osd_has_epoch(int osd, epoch_t epoch)
+{
+  dout(20) << __func__ << " osd." << osd << " epoch " << epoch << dendl;
+  map<int,epoch_t>::iterator p = osd_epoch.find(osd);
+  if (p != osd_epoch.end()) {
+    dout(20) << __func__ << " osd." << osd << " epoch " << epoch
+            << " (was " << p->second << ")" << dendl;
+    p->second = epoch;
+  } else {
+    dout(20) << __func__ << " osd." << osd << " epoch " << epoch << dendl;
+    osd_epoch[osd] = epoch;
+  }
 }
 
 void OSDMonitor::send_incremental(epoch_t first, MonSession *session,
index e6c295a595e257154bad16a6bf8966efbdc2918a..afeacde4a524341957d0d680cffba9568e2a3bb5 100644 (file)
@@ -140,6 +140,8 @@ private:
    */
   map<int,epoch_t> osd_epoch;
 
+  void note_osd_has_epoch(int osd, epoch_t epoch);
+
   void check_failures(utime_t now);
   bool check_failure(utime_t now, int target_osd, failure_info_t& fi);