]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: OSDMonitor: use op requests when sending out full/incrementals
authorJoao Eduardo Luis <joao@suse.de>
Wed, 24 Jun 2015 22:48:23 +0000 (23:48 +0100)
committerJoao Eduardo Luis <joao@suse.de>
Thu, 16 Jul 2015 17:31:22 +0000 (18:31 +0100)
Signed-off-by: Joao Eduardo Luis <joao@suse.de>
src/mon/OSDMonitor.cc
src/mon/OSDMonitor.h
src/mon/PGMonitor.cc

index 26b2fbe6a07dd897ccbb68af56b8425871df9a10..3f80242862aaa334219c3c9eec36c10b7b850250 100644 (file)
@@ -1420,7 +1420,7 @@ bool OSDMonitor::preprocess_failure(MonOpRequestRef op)
        osdmap.get_addr(from) != m->get_orig_source_inst().addr ||
        osdmap.is_down(from)) {
       dout(5) << "preprocess_failure from dead osd." << from << ", ignoring" << dendl;
-      send_incremental(m, m->get_epoch()+1);
+      send_incremental(op, m->get_epoch()+1);
       goto didit;
     }
   }
@@ -1430,14 +1430,14 @@ bool OSDMonitor::preprocess_failure(MonOpRequestRef op)
   if (!osdmap.have_inst(badboy)) {
     dout(5) << "preprocess_failure dne(/dup?): " << m->get_target() << ", from " << m->get_orig_source_inst() << dendl;
     if (m->get_epoch() < osdmap.get_epoch())
-      send_incremental(m, m->get_epoch()+1);
+      send_incremental(op, m->get_epoch()+1);
     goto didit;
   }
   if (osdmap.get_inst(badboy) != m->get_target()) {
     dout(5) << "preprocess_failure wrong osd: report " << m->get_target() << " != map's " << osdmap.get_inst(badboy)
            << ", from " << m->get_orig_source_inst() << dendl;
     if (m->get_epoch() < osdmap.get_epoch())
-      send_incremental(m, m->get_epoch()+1);
+      send_incremental(op, m->get_epoch()+1);
     goto didit;
   }
 
@@ -1446,7 +1446,7 @@ bool OSDMonitor::preprocess_failure(MonOpRequestRef op)
       osdmap.get_up_from(badboy) > m->get_epoch()) {
     dout(5) << "preprocess_failure dup/old: " << m->get_target() << ", from " << m->get_orig_source_inst() << dendl;
     if (m->get_epoch() < osdmap.get_epoch())
-      send_incremental(m, m->get_epoch()+1);
+      send_incremental(op, m->get_epoch()+1);
     goto didit;
   }
 
@@ -1504,7 +1504,7 @@ bool OSDMonitor::preprocess_mark_me_down(MonOpRequestRef op)
       osdmap.get_addr(from) != m->get_target().addr) {
     dout(5) << "preprocess_mark_me_down from dead osd."
            << from << ", ignoring" << dendl;
-    send_incremental(m, m->get_epoch()+1);
+    send_incremental(op, m->get_epoch()+1);
     goto reply;
   }
 
@@ -1757,8 +1757,10 @@ void OSDMonitor::process_failures()
       failure_info.erase(p++);
 
       while (!ls.empty()) {
-        MOSDFailure *m = ls.front()->get_req<MOSDFailure>();
-        send_latest(m, m->get_epoch());
+        MonOpRequestRef o = ls.front();
+        o->mark_event(__func__);
+        MOSDFailure *m = o->get_req<MOSDFailure>();
+       send_latest(o, m->get_epoch());
        ls.pop_front();
       }
     }
@@ -1851,14 +1853,14 @@ bool OSDMonitor::preprocess_boot(MonOpRequestRef op)
   if (osdmap.exists(from) &&
       osdmap.get_info(from).up_from > m->version) {
     dout(7) << "prepare_boot msg from before last up_from, ignoring" << dendl;
-    send_latest(m, m->sb.current_epoch+1);
+    send_latest(op, m->sb.current_epoch+1);
     return true;
   }
 
   // noup?
   if (!can_mark_up(from)) {
     dout(7) << "preprocess_boot ignoring boot from " << m->get_orig_source_inst() << dendl;
-    send_latest(m, m->sb.current_epoch+1);
+    send_latest(op, m->sb.current_epoch+1);
     return true;
   }
 
@@ -2018,7 +2020,7 @@ void OSDMonitor::_booted(MonOpRequestRef op, bool logit)
     mon->clog->info() << m->get_orig_source_inst() << " boot\n";
   }
 
-  send_latest(m, m->sb.current_epoch+1);
+  send_latest(op, m->sb.current_epoch+1);
 }
 
 
@@ -2081,12 +2083,11 @@ bool OSDMonitor::prepare_alive(MonOpRequestRef op)
 
 void OSDMonitor::_reply_map(MonOpRequestRef op, epoch_t e)
 {
-  PaxosServiceMessage *m = static_cast<PaxosServiceMessage*>(op->get_req());
   op->mark_osdmon_event(__func__);
   dout(7) << "_reply_map " << e
-         << " from " << m->get_orig_source_inst()
+         << " from " << op->get_req()->get_orig_source_inst()
          << dendl;
-  send_latest(m, e);
+  send_latest(op, e);
 }
 
 // -------------
@@ -2270,14 +2271,15 @@ bool OSDMonitor::prepare_remove_snaps(MonOpRequestRef op)
 // ---------------
 // map helpers
 
-void OSDMonitor::send_latest(PaxosServiceMessage *m, epoch_t start)
+void OSDMonitor::send_latest(MonOpRequestRef op, epoch_t start)
 {
-  dout(5) << "send_latest to " << m->get_orig_source_inst()
+  op->mark_osdmon_event(__func__);
+  dout(5) << "send_latest to " << op->get_req()->get_orig_source_inst()
          << " start " << start << dendl;
   if (start == 0)
-    send_full(m);
+    send_full(op);
   else
-    send_incremental(m, start);
+    send_incremental(op, start);
 }
 
 
@@ -2323,10 +2325,11 @@ MOSDMap *OSDMonitor::build_incremental(epoch_t from, epoch_t to)
   return m;
 }
 
-void OSDMonitor::send_full(PaxosServiceMessage *m)
+void OSDMonitor::send_full(MonOpRequestRef op)
 {
-  dout(5) << "send_full to " << m->get_orig_source_inst() << dendl;
-  mon->send_reply(m, build_latest_full());
+  op->mark_osdmon_event(__func__);
+  dout(5) << "send_full to " << op->get_req()->get_orig_source_inst() << dendl;
+  mon->send_reply(op, build_latest_full());
 }
 
 /* TBH, I'm fairly certain these two functions could somehow be using a single
@@ -2336,15 +2339,16 @@ void OSDMonitor::send_full(PaxosServiceMessage *m)
  *
  * TODO: create a helper function and get rid of the duplicated code.
  */
-void OSDMonitor::send_incremental(PaxosServiceMessage *req, epoch_t first)
+void OSDMonitor::send_incremental(MonOpRequestRef op, epoch_t first)
 {
+  op->mark_osdmon_event(__func__);
   dout(5) << "send_incremental [" << first << ".." << osdmap.get_epoch() << "]"
-         << " to " << req->get_orig_source_inst()
+         << " to " << op->get_req()->get_orig_source_inst()
          << dendl;
 
   int osd = -1;
-  if (req->get_source().is_osd()) {
-    osd = req->get_source().num();
+  if (op->get_req()->get_source().is_osd()) {
+    osd = op->get_req()->get_source().num();
     map<int,epoch_t>::iterator p = osd_epoch.find(osd);
     if (p != osd_epoch.end()) {
       if (first <= p->second) {
@@ -2371,7 +2375,7 @@ void OSDMonitor::send_incremental(PaxosServiceMessage *req, epoch_t first)
     m->oldest_map = first;
     m->newest_map = osdmap.get_epoch();
     m->maps[first] = bl;
-    mon->send_reply(req, m);
+    mon->send_reply(op, m);
 
     if (osd >= 0)
       note_osd_has_epoch(osd, osdmap.get_epoch());
@@ -2384,7 +2388,7 @@ void OSDMonitor::send_incremental(PaxosServiceMessage *req, epoch_t first)
   MOSDMap *m = build_incremental(first, last);
   m->oldest_map = get_first_committed();
   m->newest_map = osdmap.get_epoch();
-  mon->send_reply(req, m);
+  mon->send_reply(op, m);
 
   if (osd >= 0)
     note_osd_has_epoch(osd, last);
index 0796361fb855f893e19bd3ed737b6868db998abb..cede74c6e152e06b5258be8e01ee74b3cf1cbc4a 100644 (file)
@@ -224,8 +224,8 @@ private:
   // ...
   MOSDMap *build_latest_full();
   MOSDMap *build_incremental(epoch_t first, epoch_t last);
-  void send_full(PaxosServiceMessage *m);
-  void send_incremental(PaxosServiceMessage *m, epoch_t first);
+  void send_full(MonOpRequestRef op);
+  void send_incremental(MonOpRequestRef op, epoch_t first);
   void send_incremental(epoch_t first, MonSession *session, bool onetime);
 
   int reweight_by_utilization(int oload, std::string& out_str, bool by_pg,
@@ -416,9 +416,10 @@ private:
                           std::map<int,utime_t> &last_osd_report);
   void mark_all_down();
 
-  void send_latest(PaxosServiceMessage *m, epoch_t start=0);
-  void send_latest_now_nodelete(PaxosServiceMessage *m, epoch_t start=0) {
-    send_incremental(m, start);
+  void send_latest(MonOpRequestRef op, epoch_t start=0);
+  void send_latest_now_nodelete(MonOpRequestRef op, epoch_t start=0) {
+    op->mark_osdmon_event(__func__);
+    send_incremental(op, start);
   }
 
   epoch_t blacklist(const entity_addr_t& a, utime_t until);
index 2be053745764e9ba5abd2659a4d73e6cc69f555b..a3eb9340df8e13b18e559805acd1cdd5e8a13e4b 100644 (file)
@@ -714,7 +714,7 @@ bool PGMonitor::preprocess_pg_stats(MonOpRequestRef op)
   if (stats->had_map_for > 30.0 && 
       mon->osdmon()->is_readable() &&
       stats->epoch < mon->osdmon()->osdmap.get_epoch())
-    mon->osdmon()->send_latest_now_nodelete(stats, stats->epoch+1);
+    mon->osdmon()->send_latest_now_nodelete(op, stats->epoch+1);
 
   // Always forward the PGStats to the leader, even if they are the same as
   // the old PGStats. The leader will mark as down osds that haven't sent