]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
osd: add new notify, query, and info messages
authorSage Weil <sage@redhat.com>
Thu, 22 Aug 2019 18:50:37 +0000 (13:50 -0500)
committerSage Weil <sage@redhat.com>
Mon, 9 Sep 2019 16:22:11 +0000 (11:22 -0500)
These are streamlined to only include the information we need for the
peering events, as reflected by the old handle_fast_pg_{notify,query,info}
messages.

Signed-off-by: Sage Weil <sage@redhat.com>
src/messages/MOSDPGInfo2.h [new file with mode: 0644]
src/messages/MOSDPGNotify2.h [new file with mode: 0644]
src/messages/MOSDPGQuery2.h [new file with mode: 0644]
src/msg/Message.cc
src/msg/Message.h
src/osd/OSD.cc
src/osd/OSD.h

diff --git a/src/messages/MOSDPGInfo2.h b/src/messages/MOSDPGInfo2.h
new file mode 100644 (file)
index 0000000..4cf1eff
--- /dev/null
@@ -0,0 +1,86 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
+#pragma once
+
+#include "messages/MOSDPeeringOp.h"
+#include "osd/PGPeeringEvent.h"
+
+class MOSDPGInfo2 : public MOSDPeeringOp {
+private:
+  static constexpr int HEAD_VERSION = 1;
+  static constexpr int COMPAT_VERSION = 1;
+
+public:
+  spg_t spgid;
+  epoch_t epoch_sent;
+  epoch_t min_epoch;
+  pg_info_t info;
+
+  spg_t get_spg() const override {
+    return spgid;
+  }
+  epoch_t get_map_epoch() const override {
+    return epoch_sent;
+  }
+  epoch_t get_min_epoch() const override {
+    return min_epoch;
+  }
+
+  PGPeeringEvent *get_event() override {
+    return new PGPeeringEvent(
+      epoch_sent,
+      min_epoch,
+      MInfoRec(
+       pg_shard_t(get_source().num(), info.pgid.shard),
+       info,
+       epoch_sent));
+  }
+
+  MOSDPGInfo2() : MOSDPeeringOp{MSG_OSD_PG_INFO2,
+                                 HEAD_VERSION, COMPAT_VERSION} {
+    set_priority(CEPH_MSG_PRIO_HIGH);
+  }
+  MOSDPGInfo2(
+    spg_t s,
+    pg_info_t q,
+    epoch_t sent,
+    epoch_t min)
+    : MOSDPeeringOp{MSG_OSD_PG_INFO2, HEAD_VERSION, COMPAT_VERSION},
+      spgid(s),
+      epoch_sent(sent),
+      min_epoch(min),
+      info(q) {
+    set_priority(CEPH_MSG_PRIO_HIGH);
+  }
+
+private:
+  ~MOSDPGInfo2() override {}
+
+public:
+  std::string_view get_type_name() const override {
+    return "pg_info2";
+  }
+  void inner_print(std::ostream& out) const override {
+    out << spgid << " " << info;
+  }
+
+  void encode_payload(uint64_t features) override {
+    using ceph::encode;
+    encode(spgid, payload);
+    encode(epoch_sent, payload);
+    encode(min_epoch, payload);
+    encode(info, payload);
+  }
+  void decode_payload() override {
+    using ceph::decode;
+    auto p = payload.cbegin();
+    decode(spgid, p);
+    decode(epoch_sent, p);
+    decode(min_epoch, p);
+    decode(info, p);
+  }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
+};
diff --git a/src/messages/MOSDPGNotify2.h b/src/messages/MOSDPGNotify2.h
new file mode 100644 (file)
index 0000000..a04ed4a
--- /dev/null
@@ -0,0 +1,84 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
+#pragma once
+
+#include "messages/MOSDPeeringOp.h"
+#include "osd/PGPeeringEvent.h"
+
+class MOSDPGNotify2 : public MOSDPeeringOp {
+private:
+  static constexpr int HEAD_VERSION = 1;
+  static constexpr int COMPAT_VERSION = 1;
+
+public:
+  spg_t spgid;
+  pg_notify_t notify;
+
+  spg_t get_spg() const override {
+    return spgid;
+  }
+  epoch_t get_map_epoch() const override {
+    return notify.epoch_sent;
+  }
+  epoch_t get_min_epoch() const override {
+    return notify.query_epoch;
+  }
+
+  PGPeeringEvent *get_event() override {
+    return new PGPeeringEvent(
+      notify.epoch_sent,
+      notify.query_epoch,
+      MNotifyRec(
+       spgid,
+       pg_shard_t(get_source().num(), notify.from),
+       notify,
+       get_connection()->get_features()),
+      true,
+      new PGCreateInfo(
+       spgid,
+       notify.epoch_sent,
+       notify.info.history,
+       notify.past_intervals,
+       false));
+  }
+
+  MOSDPGNotify2() : MOSDPeeringOp{MSG_OSD_PG_NOTIFY2,
+                                 HEAD_VERSION, COMPAT_VERSION} {
+    set_priority(CEPH_MSG_PRIO_HIGH);
+  }
+  MOSDPGNotify2(
+    spg_t s,
+    pg_notify_t n)
+    : MOSDPeeringOp{MSG_OSD_PG_NOTIFY2, HEAD_VERSION, COMPAT_VERSION},
+      spgid(s),
+      notify(n) {
+    set_priority(CEPH_MSG_PRIO_HIGH);
+  }
+
+private:
+  ~MOSDPGNotify2() override {}
+
+public:
+  std::string_view get_type_name() const override {
+    return "pg_notify2";
+  }
+  void inner_print(std::ostream& out) const override {
+    out << spgid << " " << notify;
+  }
+
+  void encode_payload(uint64_t features) override {
+    using ceph::encode;
+    encode(spgid, payload);
+    encode(notify, payload);
+  }
+  void decode_payload() override {
+    using ceph::decode;
+    auto p = payload.cbegin();
+    decode(spgid, p);
+    decode(notify, p);
+  }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
+};
diff --git a/src/messages/MOSDPGQuery2.h b/src/messages/MOSDPGQuery2.h
new file mode 100644 (file)
index 0000000..d7a1bdd
--- /dev/null
@@ -0,0 +1,78 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
+#pragma once
+
+#include "messages/MOSDPeeringOp.h"
+#include "osd/PGPeeringEvent.h"
+
+class MOSDPGQuery2 : public MOSDPeeringOp {
+private:
+  static constexpr int HEAD_VERSION = 1;
+  static constexpr int COMPAT_VERSION = 1;
+
+public:
+  spg_t spgid;
+  pg_query_t query;
+
+  spg_t get_spg() const override {
+    return spgid;
+  }
+  epoch_t get_map_epoch() const override {
+    return query.epoch_sent;
+  }
+  epoch_t get_min_epoch() const override {
+    return query.epoch_sent;
+  }
+
+  PGPeeringEvent *get_event() override {
+    return new PGPeeringEvent(
+      query.epoch_sent,
+      query.epoch_sent,
+      MQuery(
+       spgid,
+       pg_shard_t(get_source().num(), query.from),
+       query,
+       query.epoch_sent),
+      false);
+  }
+
+  MOSDPGQuery2() : MOSDPeeringOp{MSG_OSD_PG_QUERY2,
+                                 HEAD_VERSION, COMPAT_VERSION} {
+    set_priority(CEPH_MSG_PRIO_HIGH);
+  }
+  MOSDPGQuery2(
+    spg_t s,
+    pg_query_t q)
+    : MOSDPeeringOp{MSG_OSD_PG_QUERY2, HEAD_VERSION, COMPAT_VERSION},
+      spgid(s),
+      query(q) {
+    set_priority(CEPH_MSG_PRIO_HIGH);
+  }
+
+private:
+  ~MOSDPGQuery2() override {}
+
+public:
+  std::string_view get_type_name() const override {
+    return "pg_query2";
+  }
+  void inner_print(std::ostream& out) const override {
+    out << spgid << " " << query;
+  }
+
+  void encode_payload(uint64_t features) override {
+    using ceph::encode;
+    encode(spgid, payload);
+    encode(query, payload, features);
+  }
+  void decode_payload() override {
+    using ceph::decode;
+    auto p = payload.cbegin();
+    decode(spgid, p);
+    decode(query, p);
+  }
+private:
+  template<class T, typename... Args>
+  friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
+};
index 1460132ea4ed63da68092c6589429849e1f4da65..b36d63afb5734fa2026689b7c874d99e967e55be 100644 (file)
 
 #include "messages/MOSDPGCreated.h"
 #include "messages/MOSDPGNotify.h"
+#include "messages/MOSDPGNotify2.h"
 #include "messages/MOSDPGQuery.h"
+#include "messages/MOSDPGQuery2.h"
 #include "messages/MOSDPGLog.h"
 #include "messages/MOSDPGRemove.h"
 #include "messages/MOSDPGInfo.h"
+#include "messages/MOSDPGInfo2.h"
 #include "messages/MOSDPGCreate.h"
 #include "messages/MOSDPGCreate2.h"
 #include "messages/MOSDPGTrim.h"
@@ -521,9 +524,15 @@ Message *decode_message(CephContext *cct, int crcflags,
   case MSG_OSD_PG_NOTIFY:
     m = make_message<MOSDPGNotify>();
     break;
+  case MSG_OSD_PG_NOTIFY2:
+    m = make_message<MOSDPGNotify2>();
+    break;
   case MSG_OSD_PG_QUERY:
     m = make_message<MOSDPGQuery>();
     break;
+  case MSG_OSD_PG_QUERY2:
+    m = make_message<MOSDPGQuery2>();
+    break;
   case MSG_OSD_PG_LOG:
     m = make_message<MOSDPGLog>();
     break;
@@ -533,6 +542,9 @@ Message *decode_message(CephContext *cct, int crcflags,
   case MSG_OSD_PG_INFO:
     m = make_message<MOSDPGInfo>();
     break;
+  case MSG_OSD_PG_INFO2:
+    m = make_message<MOSDPGInfo2>();
+    break;
   case MSG_OSD_PG_CREATE:
     m = make_message<MOSDPGCreate>();
     break;
index 8a159044deb18c08cf5a690dffd73f8c6c050962..b5d2d0f023e26df831b14ba391d011e98d430e91 100644 (file)
 #define MSG_OSD_BEACON       79
 
 #define MSG_OSD_PG_NOTIFY      80
+#define MSG_OSD_PG_NOTIFY2    130
 #define MSG_OSD_PG_QUERY       81
+#define MSG_OSD_PG_QUERY2     131
 #define MSG_OSD_PG_LOG         83
 #define MSG_OSD_PG_REMOVE      84
 #define MSG_OSD_PG_INFO        85
+#define MSG_OSD_PG_INFO2      132
 #define MSG_OSD_PG_TRIM        86
 
 #define MSG_PGSTATS            87
index ef38715637f1763dcdabfd55e3d40b26acba00cc..25508ddda4941422e441439bd3310cf50a81c8a7 100644 (file)
 #include "messages/MOSDMap.h"
 #include "messages/MMonGetOSDMap.h"
 #include "messages/MOSDPGNotify.h"
+#include "messages/MOSDPGNotify2.h"
 #include "messages/MOSDPGQuery.h"
+#include "messages/MOSDPGQuery2.h"
 #include "messages/MOSDPGLog.h"
 #include "messages/MOSDPGRemove.h"
 #include "messages/MOSDPGInfo.h"
+#include "messages/MOSDPGInfo2.h"
 #include "messages/MOSDPGCreate.h"
 #include "messages/MOSDPGCreate2.h"
 #include "messages/MOSDPGTrim.h"
@@ -7249,6 +7252,9 @@ void OSD::ms_fast_dispatch(Message *m)
     // these are single-pg messages that handle themselves
   case MSG_OSD_PG_LOG:
   case MSG_OSD_PG_TRIM:
+  case MSG_OSD_PG_NOTIFY2:
+  case MSG_OSD_PG_QUERY2:
+  case MSG_OSD_PG_INFO2:
   case MSG_OSD_BACKFILL_RESERVE:
   case MSG_OSD_RECOVERY_RESERVE:
     {
index 534d083d48d9b04659b2970f227754be9eca32da..f03fd13188baa8282b71bfe380360ff5bb345e22 100644 (file)
@@ -2041,8 +2041,11 @@ private:
     case MSG_MON_COMMAND:
     case MSG_OSD_PG_CREATE2:
     case MSG_OSD_PG_QUERY:
+    case MSG_OSD_PG_QUERY2:
     case MSG_OSD_PG_INFO:
+    case MSG_OSD_PG_INFO2:
     case MSG_OSD_PG_NOTIFY:
+    case MSG_OSD_PG_NOTIFY2:
     case MSG_OSD_PG_LOG:
     case MSG_OSD_PG_TRIM:
     case MSG_OSD_PG_REMOVE: