]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: introduce acting set specific feature vector
authorSamuel Just <sjust@redhat.com>
Wed, 24 Apr 2024 23:50:40 +0000 (23:50 +0000)
committerSamuel Just <sjust@redhat.com>
Sat, 19 Oct 2024 01:40:12 +0000 (01:40 +0000)
Signed-off-by: Samuel Just <sjust@redhat.com>
src/crimson/osd/osd_operations/peering_event.cc
src/crimson/osd/pg.cc
src/osd/OSD.cc
src/osd/PG.cc
src/osd/PeeringState.cc
src/osd/PeeringState.h
src/osd/osd_types.cc
src/osd/osd_types.h
src/osd/pg_features.h [new file with mode: 0644]

index a8d9fce69b6118b68793a15c0722408625b7a492..fb5696b0a9e3ea7bdb9677d442229719c1a1cb8e 100644 (file)
@@ -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});
     }
   }
 }
index 7c88dbc4e8cc45b51da5b024bc1199b70a167313..1b6bf152dbe8951ec537ad5b19954b96809d93ce 100644 (file)
@@ -132,6 +132,7 @@ PG::PG(
        pool,
        name),
       osdmap,
+      PG_FEATURE_CRIMSON_ALL,
       this,
       this),
     scrubber(*this),
index ce46bb245ea2c7746cc1978f9b74108e4aa9ea90..f5b75b726997f6e85c8dfe3e64fdf3a8781d0f97 100644 (file)
@@ -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));
     }
index 71b9b713385061a29e0f16d3f8050e24679c3ed3..a327c407e367b26e87ec7bd4fd40ccb7a92bbf8d 100644 (file)
@@ -212,6 +212,7 @@ PG::PG(OSDService *o, OSDMapRef curmap,
     p,
     _pool,
     curmap,
+    PG_FEATURE_CLASSIC_ALL,
     this,
     this),
   pool(recovery_state.get_pgpool()),
index 08ae9b201af25ae92a355d8380a9a8b53d73b114..967101286354fd41639e67964742f65c0af496ad 100644 (file)
@@ -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());
     }
   }
index 14d62bbd1234e604ba37b730dacf64df7c739340..de2a4cae042facdcb68608f1d0f52db78c2cd120 100644 (file)
@@ -1507,6 +1507,18 @@ public:
   std::set<pg_shard_t> peer_log_requested; ///< logs i've requested (and start stamps)
   std::set<pg_shard_t> 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:
index c9f3f7d1464b7d839c978ffe91a806bf81e70329..b2e8d8f297aa143d8340863ec91a41b66aaaa786 100644 (file)
@@ -3677,13 +3677,14 @@ void pg_info_t::generate_test_instances(list<pg_info_t*>& 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<pg_notify_t*>& 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 &notify)
index e2edaa39dfc2dd7a263d226ab951fbaed6e604ed..f80adbbfd111220b4959c36b688b9131715844ac 100644 (file)
@@ -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 (file)
index 0000000..1205f8f
--- /dev/null
@@ -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;