]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/osd: handle MOSDOp in OSD
authorKefu Chai <kchai@redhat.com>
Fri, 8 Mar 2019 13:51:14 +0000 (21:51 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 25 Mar 2019 15:34:00 +0000 (23:34 +0800)
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/crimson/osd/osd.cc
src/crimson/osd/osd.h
src/crimson/osd/pg.cc
src/crimson/osd/pg.h

index c291d1de90777262481d03894385adf4eea8cd86..99e6684d19e49dc6d9fdca2507d42d456d00de1e 100644 (file)
@@ -11,6 +11,7 @@
 #include "messages/MOSDBeacon.h"
 #include "messages/MOSDBoot.h"
 #include "messages/MOSDMap.h"
+#include "messages/MOSDOp.h"
 #include "messages/MOSDPGInfo.h"
 #include "messages/MOSDPGLog.h"
 #include "messages/MOSDPGNotify.h"
@@ -378,6 +379,8 @@ seastar::future<> OSD::ms_dispatch(ceph::net::ConnectionRef conn, MessageRef m)
   switch (m->get_type()) {
   case CEPH_MSG_OSD_MAP:
     return handle_osd_map(conn, boost::static_pointer_cast<MOSDMap>(m));
+  case CEPH_MSG_OSD_OP:
+    return handle_osd_op(conn, boost::static_pointer_cast<MOSDOp>(m));
   case MSG_OSD_PG_NOTIFY:
     return handle_pg_notify(conn, boost::static_pointer_cast<MOSDPGNotify>(m));
   case MSG_OSD_PG_INFO:
@@ -651,6 +654,24 @@ seastar::future<> OSD::committed_osd_maps(version_t first,
   });
 }
 
+seastar::future<> OSD::handle_osd_op(ceph::net::ConnectionRef conn,
+                                     Ref<MOSDOp> m)
+{
+  return wait_for_map(m->get_map_epoch()).then([=](epoch_t epoch) {
+    if (auto found = pgs.find(m->get_spg()); found != pgs.end()) {
+      return found->second->handle_op(conn, std::move(m));
+    } else if (osdmap->is_up_acting_osd_shard(m->get_spg(), whoami)) {
+      logger().info("no pg, should exist e{}, will wait", epoch);
+      // todo, wait for peering, etc
+      return seastar::now();
+    } else {
+      logger().info("no pg, shouldn't exist e{}, dropping", epoch);
+      // todo: share map with client
+      return seastar::now();
+    }
+  });
+}
+
 bool OSD::should_restart() const
 {
   if (!osdmap->is_up(whoami)) {
index fbd0341261d7aeb6f2bbbd9abfe838771953de43..d6ef79e43aa478e17808c635495ed01b2a5e4291 100644 (file)
@@ -21,6 +21,7 @@
 #include "osd/osd_types.h"
 
 class MOSDMap;
+class MOSDOp;
 class OSDMap;
 class OSDMeta;
 class PG;
@@ -130,6 +131,8 @@ private:
 
   seastar::future<> handle_osd_map(ceph::net::ConnectionRef conn,
                                    Ref<MOSDMap> m);
+  seastar::future<> handle_osd_op(ceph::net::ConnectionRef conn,
+                                 Ref<MOSDOp> m);
   seastar::future<> handle_pg_log(ceph::net::ConnectionRef conn,
                                  Ref<MOSDPGLog> m);
   seastar::future<> handle_pg_notify(ceph::net::ConnectionRef conn,
index 684120af57902d678af792f7ec49265d8a39261c..d43ac29d6f989d4551effdba0c94fc5eb33fccc9 100644 (file)
@@ -943,3 +943,10 @@ seastar::future<> PG::share_pg_info()
       return send_to_osd(peer.osd, m, get_osdmap_epoch());
     });
 }
+
+seastar::future<> PG::handle_op(ceph::net::ConnectionRef conn,
+                                Ref<MOSDOp> m)
+{
+  // todo
+  return seastar::now();
+}
index f2e8deb8222e8ec21e2022de4e33cee26860c6a2..ae1aa70c49feeb64216acc5b45c2eaca683488a0 100644 (file)
@@ -8,6 +8,7 @@
 #include <boost/smart_ptr/local_shared_ptr.hpp>
 #include <seastar/core/future.hh>
 
+#include "crimson/net/Fwd.h"
 #include "osd/osd_types.h"
 #include "recovery_state.h"
 
@@ -109,9 +110,9 @@ public:
   seastar::future<> handle_activate_map();
   seastar::future<> share_pg_info();
   void reply_pg_query(const MQuery& query, recovery::Context* ctx);
-
+  seastar::future<> handle_op(ceph::net::ConnectionRef conn,
+                             Ref<MOSDOp> m);
   void print(ostream& os) const;
-
 private:
   seastar::future<> activate_peer(pg_shard_t peer);
   void reply_pg_query_for_info(const MQuery& query, recovery::Context* ctx);