]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: track osd_epoch of all MonSessions 5773/head
authorKefu Chai <kchai@redhat.com>
Mon, 20 Jul 2015 16:33:19 +0000 (00:33 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 26 Oct 2015 09:12:02 +0000 (17:12 +0800)
previously, we only track the osd_epoch for OSD peers. but other
MonClients who receives osdmaps can also benefit from osd_epoch.

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit de43a02e06650a552f048dc8acd17f255126fed9)

Conflicts:
src/mon/OSDMonitor.cc:
do not assume that the MonSession is always available when
        OSDMonitor::send_incremental() is called. as when the
        connection to the mon client is dropped, the Monitor is
        aware of this, but not the OSDMonitor.

src/mon/OSDMonitor.cc

index 31cfa04816bddafa398d9947ba5c098ce472a66a..ce9bdee7e0f5a1dcbea19d2df53c277cba8abb60 100644 (file)
@@ -2139,11 +2139,7 @@ void OSDMonitor::send_incremental(PaxosServiceMessage *req, epoch_t first)
          << " to " << req->get_orig_source_inst()
          << dendl;
 
-  MonSession *s = NULL;
-  if (op->get_req()->get_source().is_osd()) {
-    s = op->get_session();
-  }
-
+  MonSession *s = req->get_session();
   if (s && first <= s->osd_epoch) {
     dout(10) << __func__ << s->inst << " should already have epoch "
             << s->osd_epoch << dendl;
@@ -2152,7 +2148,7 @@ void OSDMonitor::send_incremental(PaxosServiceMessage *req, epoch_t first)
       return;
   }
 
-  if (first < get_first_committed()) {
+  if (s && first < get_first_committed()) {
     first = get_first_committed();
     bufferlist bl;
     int err = get_version_full(first, bl);
@@ -2168,8 +2164,7 @@ void OSDMonitor::send_incremental(PaxosServiceMessage *req, epoch_t first)
     m->maps[first] = bl;
     mon->send_reply(req, m);
 
-    if (s)
-      s->osd_epoch = osdmap.get_epoch();
+    s->osd_epoch = osdmap.get_epoch();
     return;
   }
 
@@ -2206,9 +2201,7 @@ void OSDMonitor::send_incremental(epoch_t first, MonSession *session,
     m->newest_map = osdmap.get_epoch();
     m->maps[first] = bl;
     session->con->send_message(m);
-    if (session->inst.name.is_osd()) {
-      session->osd_epoch = first;
-    }
+    session->osd_epoch = first;
     first++;
   }
 
@@ -2217,10 +2210,7 @@ void OSDMonitor::send_incremental(epoch_t first, MonSession *session,
     MOSDMap *m = build_incremental(first, last);
     session->con->send_message(m);
     first = last + 1;
-
-    if (session->inst.name.is_osd()) {
-      session->osd_epoch = last;
-    }
+    session->osd_epoch = last;
 
     if (onetime)
       break;