From: Sage Weil Date: Thu, 22 Aug 2019 18:50:37 +0000 (-0500) Subject: osd: add new notify, query, and info messages X-Git-Tag: v15.1.0~1584^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ce05c17299d75fe1f4e527352172f9e5d55a2647;p=ceph.git osd: add new notify, query, and info messages 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 --- diff --git a/src/messages/MOSDPGInfo2.h b/src/messages/MOSDPGInfo2.h new file mode 100644 index 000000000000..4cf1eff8a646 --- /dev/null +++ b/src/messages/MOSDPGInfo2.h @@ -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 + friend boost::intrusive_ptr ceph::make_message(Args&&... args); +}; diff --git a/src/messages/MOSDPGNotify2.h b/src/messages/MOSDPGNotify2.h new file mode 100644 index 000000000000..a04ed4ab3395 --- /dev/null +++ b/src/messages/MOSDPGNotify2.h @@ -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 + friend boost::intrusive_ptr ceph::make_message(Args&&... args); +}; diff --git a/src/messages/MOSDPGQuery2.h b/src/messages/MOSDPGQuery2.h new file mode 100644 index 000000000000..d7a1bddadadb --- /dev/null +++ b/src/messages/MOSDPGQuery2.h @@ -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 + friend boost::intrusive_ptr ceph::make_message(Args&&... args); +}; diff --git a/src/msg/Message.cc b/src/msg/Message.cc index 1460132ea4ed..b36d63afb573 100644 --- a/src/msg/Message.cc +++ b/src/msg/Message.cc @@ -76,10 +76,13 @@ #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(); break; + case MSG_OSD_PG_NOTIFY2: + m = make_message(); + break; case MSG_OSD_PG_QUERY: m = make_message(); break; + case MSG_OSD_PG_QUERY2: + m = make_message(); + break; case MSG_OSD_PG_LOG: m = make_message(); break; @@ -533,6 +542,9 @@ Message *decode_message(CephContext *cct, int crcflags, case MSG_OSD_PG_INFO: m = make_message(); break; + case MSG_OSD_PG_INFO2: + m = make_message(); + break; case MSG_OSD_PG_CREATE: m = make_message(); break; diff --git a/src/msg/Message.h b/src/msg/Message.h index 8a159044deb1..b5d2d0f023e2 100644 --- a/src/msg/Message.h +++ b/src/msg/Message.h @@ -83,10 +83,13 @@ #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 diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index ef38715637f1..25508ddda494 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -88,10 +88,13 @@ #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: { diff --git a/src/osd/OSD.h b/src/osd/OSD.h index 534d083d48d9..f03fd13188ba 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -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: