crimson/osd: handle MOSDPGQuery in OSD
authorKefu Chai <kchai@redhat.com>
Tue, 12 Mar 2019 12:22:57 +0000 (20:22 +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 98e7e5225d3c68dbdb7cf752f6828fea94900318..f2145dbc47ab38aeb8433fef86085a3908ddef00 100644 (file)
 #include "messages/MOSDPGInfo.h"
 #include "messages/MOSDPGLog.h"
 #include "messages/MOSDPGNotify.h"
+#include "messages/MOSDPGQuery.h"
 #include "messages/MPGStats.h"
 
 #include "crimson/mon/MonClient.h"
-
 #include "crimson/net/Connection.h"
 #include "crimson/net/Messenger.h"
 #include "crimson/os/cyan_collection.h"
@@ -367,6 +367,8 @@ seastar::future<> OSD::ms_dispatch(ceph::net::ConnectionRef conn, MessageRef m)
     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));
+  case MSG_OSD_PG_QUERY:
+    return handle_pg_query(conn, boost::static_pointer_cast<MOSDPGQuery>(m));
   default:
     return seastar::now();
   }
@@ -750,6 +752,22 @@ seastar::future<> OSD::handle_pg_info(ceph::net::ConnectionRef conn,
   });
 }
 
+seastar::future<> OSD::handle_pg_query(ceph::net::ConnectionRef conn,
+                                       Ref<MOSDPGQuery> m)
+{
+  const int from = m->get_source().num();
+  return seastar::parallel_for_each(m->pg_list,
+    [from, this](pair<spg_t, pg_query_t> p) {
+      auto& [pgid, pg_query] = p;
+      MQuery query{pgid, pg_shard_t{from, pg_query.from},
+                   pg_query, pg_query.epoch_sent};
+      auto evt = std::make_unique<PGPeeringEvent>(pg_query.epoch_sent,
+                                                  pg_query.epoch_sent,
+                                                  std::move(query));
+      return do_peering_event(pgid, std::move(evt));
+  });
+}
+
 seastar::future<>
 OSD::do_peering_event(spg_t pgid,
                       std::unique_ptr<PGPeeringEvent> evt)
index 0445d3c9d9a96789627a16491d2c4ad2ec906a05..7ec2ef6eebf6c60c51f06982cd6d52d769cbee87 100644 (file)
@@ -130,6 +130,8 @@ private:
                                     Ref<MOSDPGNotify> m);
   seastar::future<> handle_pg_info(ceph::net::ConnectionRef conn,
                                   Ref<MOSDPGInfo> m);
+  seastar::future<> handle_pg_query(ceph::net::ConnectionRef conn,
+                                   Ref<MOSDPGQuery> m);
 
   seastar::future<> committed_osd_maps(version_t first,
                                        version_t last,