]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/osd: handle MOSDPGInfo in OSD
authorKefu Chai <kchai@redhat.com>
Tue, 5 Mar 2019 09:32:11 +0000 (17:32 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 22 Mar 2019 05:21:32 +0000 (13:21 +0800)
will handle it in PG in follow-up changes.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/crimson/osd/osd.cc
src/crimson/osd/osd.h

index a81770e900612a58dcc23c4f3098082f9659e768..98e7e5225d3c68dbdb7cf752f6828fea94900318 100644 (file)
@@ -9,6 +9,7 @@
 #include "messages/MOSDBeacon.h"
 #include "messages/MOSDBoot.h"
 #include "messages/MOSDMap.h"
+#include "messages/MOSDPGInfo.h"
 #include "messages/MOSDPGLog.h"
 #include "messages/MOSDPGNotify.h"
 #include "messages/MPGStats.h"
@@ -364,6 +365,8 @@ seastar::future<> OSD::ms_dispatch(ceph::net::ConnectionRef conn, MessageRef m)
     return handle_osd_map(conn, boost::static_pointer_cast<MOSDMap>(m));
   case MSG_OSD_PG_NOTIFY:
     return handle_pg_notify(conn, boost::static_pointer_cast<MOSDPGNotify>(m));
+  case MSG_OSD_PG_INFO:
+    return handle_pg_info(conn, boost::static_pointer_cast<MOSDPGInfo>(m));
   default:
     return seastar::now();
   }
@@ -727,6 +730,26 @@ seastar::future<> OSD::handle_pg_notify(ceph::net::ConnectionRef conn,
   });
 }
 
+seastar::future<> OSD::handle_pg_info(ceph::net::ConnectionRef conn,
+                                      Ref<MOSDPGInfo> m)
+{
+  // assuming all pgs reside in a single shard
+  // see OSD::dequeue_peering_evt()
+  const int from = m->get_source().num();
+  return seastar::parallel_for_each(m->pg_list,
+    [from, this](pair<pg_notify_t, PastIntervals> p) {
+      auto& pg_notify = p.first;
+      spg_t pgid{pg_notify.info.pgid.pgid, pg_notify.to};
+      MInfoRec info{pg_shard_t{from, pg_notify.from},
+                    pg_notify.info,
+                    pg_notify.epoch_sent};
+      auto evt = std::make_unique<PGPeeringEvent>(pg_notify.epoch_sent,
+                                                  pg_notify.query_epoch,
+                                                  std::move(info));
+      return do_peering_event(pgid, std::move(evt));
+  });
+}
+
 seastar::future<>
 OSD::do_peering_event(spg_t pgid,
                       std::unique_ptr<PGPeeringEvent> evt)
index 74b80176f86981fabddb0b6123932596d9ecd802..0445d3c9d9a96789627a16491d2c4ad2ec906a05 100644 (file)
@@ -128,6 +128,8 @@ private:
                                    Ref<MOSDMap> m);
   seastar::future<> handle_pg_notify(ceph::net::ConnectionRef conn,
                                     Ref<MOSDPGNotify> m);
+  seastar::future<> handle_pg_info(ceph::net::ConnectionRef conn,
+                                  Ref<MOSDPGInfo> m);
 
   seastar::future<> committed_osd_maps(version_t first,
                                        version_t last,