From: Samuel Just Date: Wed, 24 Apr 2024 23:50:40 +0000 (+0000) Subject: osd: introduce acting set specific feature vector X-Git-Tag: v20.0.0~707^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8e14ce00c802e5a942fbe767b81202ac0d1af0ab;p=ceph.git osd: introduce acting set specific feature vector Signed-off-by: Samuel Just --- diff --git a/src/crimson/osd/osd_operations/peering_event.cc b/src/crimson/osd/osd_operations/peering_event.cc index a8d9fce69b61..fb5696b0a9e3 100644 --- a/src/crimson/osd/osd_operations/peering_event.cc +++ b/src/crimson/osd/osd_operations/peering_event.cc @@ -166,7 +166,8 @@ void RemotePeeringEvent::on_pg_absent(ShardServices &shard_services) ctx.send_notify(q.from.osd, {q.query.from, q.query.to, q.query.epoch_sent, map_epoch, empty, - PastIntervals{}}); + PastIntervals{}, + PG_FEATURE_CRIMSON_ALL}); } } } diff --git a/src/crimson/osd/pg.cc b/src/crimson/osd/pg.cc index 7c88dbc4e8cc..1b6bf152dbe8 100644 --- a/src/crimson/osd/pg.cc +++ b/src/crimson/osd/pg.cc @@ -132,6 +132,7 @@ PG::PG( pool, name), osdmap, + PG_FEATURE_CRIMSON_ALL, this, this), scrubber(*this), diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index ce46bb245ea2..f5b75b726997 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -9485,7 +9485,8 @@ void OSD::handle_pg_query_nopg(const MQuery& q) q.query.epoch_sent, osdmap->get_epoch(), empty, - PastIntervals()}; + PastIntervals(), + PG_FEATURE_CLASSIC_ALL}; m = new MOSDPGNotify2(spg_t{pgid.pgid, q.query.from}, std::move(notify)); } diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 71b9b7133850..a327c407e367 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -212,6 +212,7 @@ PG::PG(OSDService *o, OSDMapRef curmap, p, _pool, curmap, + PG_FEATURE_CLASSIC_ALL, this, this), pool(recovery_state.get_pgpool()), diff --git a/src/osd/PeeringState.cc b/src/osd/PeeringState.cc index 08ae9b201af2..967101286354 100644 --- a/src/osd/PeeringState.cc +++ b/src/osd/PeeringState.cc @@ -109,6 +109,7 @@ PeeringState::PeeringState( spg_t spgid, const PGPool &_pool, OSDMapRef curmap, + pg_feature_vec_t supported_pg_acting_features, DoutPrefixProvider *dpp, PeeringListener *pl) : state_history(*pl), @@ -122,6 +123,8 @@ PeeringState::PeeringState( pg_whoami(pg_whoami), info(spgid), pg_log(cct), + local_pg_acting_features(supported_pg_acting_features), + pg_acting_features(local_pg_acting_features), last_require_osd_release(curmap->require_osd_release), missing_loc(spgid, this, dpp, cct), machine(this, cct, spgid, dpp, pl, &state_history) @@ -348,6 +351,10 @@ bool PeeringState::proc_replica_notify(const pg_shard_t &from, const pg_notify_t } } + if (is_acting(from)) { + pg_acting_features &= notify.pg_features; + } + // was this a new info? if so, update peers! if (p == peer_info.end()) update_heartbeat_peers(); @@ -748,6 +755,7 @@ void PeeringState::on_new_interval() // initialize features acting_features = CEPH_FEATURES_SUPPORTED_DEFAULT; upacting_features = CEPH_FEATURES_SUPPORTED_DEFAULT; + pg_acting_features = local_pg_acting_features; for (auto p = acting.begin(); p != acting.end(); ++p) { if (*p == CRUSH_ITEM_NONE) continue; @@ -3209,7 +3217,8 @@ void PeeringState::fulfill_query(const MQuery& query, PeeringCtxWrapper &rctx) query.query_epoch, get_osdmap_epoch(), notify_info.second, - past_intervals)); + past_intervals, + local_pg_acting_features)); } else { update_history(query.query.history); fulfill_log(query.from, query.query, query.query_epoch); @@ -4806,7 +4815,8 @@ boost::statechart::result PeeringState::Reset::react(const ActMap&) ps->get_osdmap_epoch(), ps->get_osdmap_epoch(), ps->info, - ps->past_intervals)); + ps->past_intervals, + ps->local_pg_acting_features)); } ps->update_heartbeat_peers(); @@ -6536,7 +6546,8 @@ boost::statechart::result PeeringState::ReplicaActive::react(const ActMap&) ps->get_osdmap_epoch(), ps->get_osdmap_epoch(), ps->info, - ps->past_intervals)); + ps->past_intervals, + ps->local_pg_acting_features)); } return discard_event(); } @@ -6673,7 +6684,8 @@ boost::statechart::result PeeringState::Stray::react(const ActMap&) ps->get_osdmap_epoch(), ps->get_osdmap_epoch(), ps->info, - ps->past_intervals)); + ps->past_intervals, + ps->local_pg_acting_features)); } return discard_event(); } @@ -6903,6 +6915,7 @@ boost::statechart::result PeeringState::GetInfo::react(const MNotifyRec& infoevt psdout(20) << "Common peer features: " << hex << ps->get_min_peer_features() << dec << dendl; psdout(20) << "Common acting features: " << hex << ps->get_min_acting_features() << dec << dendl; psdout(20) << "Common upacting features: " << hex << ps->get_min_upacting_features() << dec << dendl; + psdout(20) << "Common pg_acting_features: " << hex << ps->get_pg_acting_features() << dec << dendl; post_event(GotInfo()); } } diff --git a/src/osd/PeeringState.h b/src/osd/PeeringState.h index 14d62bbd1234..de2a4cae042f 100644 --- a/src/osd/PeeringState.h +++ b/src/osd/PeeringState.h @@ -1507,6 +1507,18 @@ public: std::set peer_log_requested; ///< logs i've requested (and start stamps) std::set peer_missing_requested; ///< missing sets requested + /// not constexpr because classic/crimson might differ + const pg_feature_vec_t local_pg_acting_features; + + /** + * acting_pg_features + * + * PG specific features common to entire acting set. Valid only on primary + * after activation. + */ + pg_feature_vec_t pg_acting_features; + + /// features supported by all peers uint64_t peer_features = CEPH_FEATURES_SUPPORTED_DEFAULT; /// features supported by acting set @@ -1765,6 +1777,7 @@ public: spg_t spgid, const PGPool &pool, OSDMapRef curmap, + pg_feature_vec_t supported_pg_acting_features, DoutPrefixProvider *dpp, PeeringListener *pl); @@ -2467,6 +2480,8 @@ public: /// Get feature vector common to up/acting set uint64_t get_min_upacting_features() const { return upacting_features; } + /// Get pg features common to acting set + pg_feature_vec_t get_pg_acting_features() const { return pg_acting_features; } // Flush control interface private: diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index c9f3f7d1464b..b2e8d8f297aa 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -3677,13 +3677,14 @@ void pg_info_t::generate_test_instances(list& o) // -- pg_notify_t -- void pg_notify_t::encode(ceph::buffer::list &bl) const { - ENCODE_START(3, 2, bl); + ENCODE_START(4, 2, bl); encode(query_epoch, bl); encode(epoch_sent, bl); encode(info, bl); encode(to, bl); encode(from, bl); encode(past_intervals, bl); + encode(pg_features, bl); ENCODE_FINISH(bl); } @@ -3698,6 +3699,9 @@ void pg_notify_t::decode(ceph::buffer::list::const_iterator &bl) if (struct_v >= 3) { decode(past_intervals, bl); } + if (struct_v >= 4) { + decode(pg_features, bl); + } DECODE_FINISH(bl); } @@ -3719,9 +3723,11 @@ void pg_notify_t::generate_test_instances(list& o) { o.push_back(new pg_notify_t); o.push_back(new pg_notify_t(shard_id_t(3), shard_id_t::NO_SHARD, 1, 1, - pg_info_t(spg_t(pg_t(0,10), shard_id_t(-1))), PastIntervals())); + pg_info_t(spg_t(pg_t(0,10), shard_id_t(-1))), PastIntervals(), + PG_FEATURE_CLASSIC_ALL)); o.push_back(new pg_notify_t(shard_id_t(0), shard_id_t(2), 3, 10, - pg_info_t(spg_t(pg_t(10,10), shard_id_t(2))), PastIntervals())); + pg_info_t(spg_t(pg_t(10,10), shard_id_t(2))), PastIntervals(), + PG_FEATURE_CLASSIC_ALL)); } ostream &operator<<(ostream &lhs, const pg_notify_t ¬ify) diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index e2edaa39dfc2..f80adbbfd111 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -51,6 +51,7 @@ #include "librados/ListObjectImpl.h" #include "compressor/Compressor.h" #include "osd_perf_counters.h" +#include "pg_features.h" #define CEPH_OSD_ONDISK_MAGIC "ceph osd volume v026" @@ -3790,6 +3791,7 @@ struct pg_notify_t { shard_id_t to; shard_id_t from; PastIntervals past_intervals; + pg_feature_vec_t pg_features = PG_FEATURE_NONE; pg_notify_t() : query_epoch(0), epoch_sent(0), to(shard_id_t::NO_SHARD), from(shard_id_t::NO_SHARD) {} @@ -3799,11 +3801,12 @@ struct pg_notify_t { epoch_t query_epoch, epoch_t epoch_sent, const pg_info_t &info, - const PastIntervals& pi) + const PastIntervals& pi, + pg_feature_vec_t pg_features) : query_epoch(query_epoch), epoch_sent(epoch_sent), info(info), to(to), from(from), - past_intervals(pi) { + past_intervals(pi), pg_features(pg_features) { ceph_assert(from == info.pgid.shard); } void encode(ceph::buffer::list &bl) const; diff --git a/src/osd/pg_features.h b/src/osd/pg_features.h new file mode 100644 index 000000000000..1205f8f3ba73 --- /dev/null +++ b/src/osd/pg_features.h @@ -0,0 +1,23 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab + +#pragma once + +/* This feature set defines a set of features supported by OSDs once a PG has + * gone active. + * Mechanically, pretty much the same as include/ceph_features.h */ + +using pg_feature_vec_t = uint64_t; +static constexpr pg_feature_vec_t PG_FEATURE_INCARNATION_1 = 0ull; + +#define DEFINE_PG_FEATURE(bit, incarnation, name) \ + static constexpr pg_feature_vec_t PG_FEATURE_##name = (1ull << bit); \ + static constexpr pg_feature_vec_t PG_FEATUREMASK_##name = \ + (1ull << bit) | PG_FEATURE_INCARNATION_##incarnation; + +#define PG_HAVE_FEATURE(x, name) \ + (((x) & (PG_FEATUREMASK_##name)) == (PG_FEATUREMASK_##name)) + +static constexpr pg_feature_vec_t PG_FEATURE_NONE = 0ull; +static constexpr pg_feature_vec_t PG_FEATURE_CLASSIC_ALL = 0ull; +static constexpr pg_feature_vec_t PG_FEATURE_CRIMSON_ALL = 0ull;