]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: track osd_epoch of all MonSessions
authorKefu Chai <kchai@redhat.com>
Mon, 20 Jul 2015 16:33:19 +0000 (00:33 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 11 Aug 2015 06:49:09 +0000 (14:49 +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>
src/mon/OSDMonitor.cc

index 813d6c3dbcf9e34993ca119c2dcc69b94740b088..b770601e7ca1f765f41681d10d83d7362f28ff39 100644 (file)
@@ -2343,12 +2343,10 @@ void OSDMonitor::send_incremental(MonOpRequestRef op, epoch_t first)
          << " to " << op->get_req()->get_orig_source_inst()
          << dendl;
 
-  MonSession *s = NULL;
-  if (op->get_req()->get_source().is_osd()) {
-    s = op->get_session();
-  }
+  MonSession *s = op->get_session();
+  assert(s);
 
-  if (s && first <= s->osd_epoch) {
+  if (first <= s->osd_epoch) {
     dout(10) << __func__ << s->inst << " should already have epoch "
             << s->osd_epoch << dendl;
     first = s->osd_epoch + 1;
@@ -2372,8 +2370,7 @@ void OSDMonitor::send_incremental(MonOpRequestRef op, epoch_t first)
     m->maps[first] = bl;
     mon->send_reply(op, m);
 
-    if (s)
-      s->osd_epoch = osdmap.get_epoch();
+    s->osd_epoch = osdmap.get_epoch();
     return;
   }
 
@@ -2385,8 +2382,7 @@ void OSDMonitor::send_incremental(MonOpRequestRef op, epoch_t first)
   m->newest_map = osdmap.get_epoch();
   mon->send_reply(op, m);
 
-  if (s)
-    s->osd_epoch = last;
+  s->osd_epoch = last;
 }
 
 void OSDMonitor::send_incremental(epoch_t first, MonSession *session,
@@ -2410,9 +2406,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++;
   }
 
@@ -2421,10 +2415,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;