Do not encode new metric|config types for older peers.
The combination of boost::optional and boost::variant make this super
awkward to condition on the features. :(
Fixes: https://tracker.ceph.com/issues/49069
Signed-off-by: Sage Weil <sage@newdream.net>
encode(stats_period, payload);
encode(stats_threshold, payload);
encode(osd_perf_metric_queries, payload);
- encode(metric_config_message, payload);
+ if (metric_config_message && metric_config_message->should_encode(features)) {
+ encode(metric_config_message, payload);
+ } else {
+ boost::optional<MetricConfigMessage> empty;
+ encode(empty, payload);
+ }
}
std::string_view get_type_name() const override { return "mgrconfigure"; }
encode(config_bl, payload);
encode(osd_perf_metric_reports, payload);
encode(task_status, payload);
- encode(metric_report_message, payload);
+ if (metric_report_message && metric_report_message->should_encode(features)) {
+ encode(metric_report_message, payload);
+ } else {
+ boost::optional<MetricReportMessage> empty;
+ encode(empty, payload);
+ }
}
std::string_view get_type_name() const override { return "mgrreport"; }
#include <boost/variant.hpp>
#include "include/denc.h"
+#include "include/ceph_features.h"
#include "mgr/OSDPerfMetricTypes.h"
#include "mgr/MDSPerfMetricTypes.h"
: payload(payload) {
}
+ bool should_encode(uint64_t features) const {
+ if (!HAVE_FEATURE(features, SERVER_PACIFIC) &&
+ boost::get<MDSMetricPayload>(&payload)) {
+ return false;
+ }
+ return true;
+ }
+
void encode(ceph::buffer::list &bl) const {
boost::apply_visitor(EncodeMetricPayloadVisitor(bl), payload);
}
: payload(payload) {
}
+ bool should_encode(uint64_t features) const {
+ if (!HAVE_FEATURE(features, SERVER_PACIFIC) &&
+ boost::get<MDSConfigPayload>(&payload)) {
+ return false;
+ }
+ return true;
+ }
+
void encode(ceph::buffer::list &bl) const {
boost::apply_visitor(EncodeConfigPayloadVisitor(bl), payload);
}