]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
fix beacon-dif feature/version logic wip-leonidc1409-beacon-diff-cr
authorLeonid Chernin <leonidc@il.ibm.com>
Tue, 9 Sep 2025 11:20:13 +0000 (14:20 +0300)
committerLeonid Chernin <leonidc@il.ibm.com>
Sun, 14 Sep 2025 06:37:52 +0000 (09:37 +0300)
set  beacon compatible version back to 1
add initialiser of BeaconSubsystem change descriptor
in encode of legacy beaconsubsystem  ignore invalid change descriptors

Signed-off-by: Leonid Chernin <leonidc@il.ibm.com>
src/messages/MNVMeofGwBeacon.h
src/mon/NVMeofGwMap.cc
src/mon/NVMeofGwMon.cc
src/mon/NVMeofGwSerialize.h
src/mon/NVMeofGwTypes.h

index 0a1a54603efb906e5c5db997ba7e2ca0b92e587d..f10eba19d164cabdcecd7f5dd6c42e8dd6b9c821 100644 (file)
@@ -26,7 +26,7 @@ class MNVMeofGwBeacon final : public PaxosServiceMessage {
 private:
   static constexpr int BEACON_VERSION_LEGACY = 1;      // legacy beacon format (no diff support)
   static constexpr int BEACON_VERSION_ENHANCED = 2;    // enhanced beacon format (with diff support)
-  static constexpr int COMPAT_VERSION = BEACON_VERSION_ENHANCED;  // minimum version to decode enhanced format
+  static constexpr int COMPAT_VERSION = BEACON_VERSION_LEGACY;  // minimum version to decode enhanced format
 
 protected:
     std::string       gw_id;
index 2ebf58d93993a70ecce0e6c719ee4813967d6091..ce0c5adb75b162b16a7927fc88bada8a3c88088a 100755 (executable)
@@ -1157,7 +1157,7 @@ bool NVMeofGwMap::put_gw_beacon_sequence_number(const NvmeGwId &gw_id,
   NvmeGwMonState& gw_map = created_gws[group_key][gw_id];
   //gw_map.beacon_sequence_ooo = false;
 
-  if (HAVE_FEATURE(mon->get_quorum_con_features(), NVMEOF_BEACON_DIFF) &&
+  if (HAVE_FEATURE(mon->get_quorum_con_features(), NVMEOF_BEACON_DIFF) ||
                  (gw_version > 0) ) {
     if (beacon_sequence == 40 && inject1 == 0) { //Inject sequence ooo
         inject1 = 1;
@@ -1183,9 +1183,10 @@ bool NVMeofGwMap::set_gw_beacon_sequence_number(const NvmeGwId &gw_id,
         int gw_version, const NvmeGroupKey& group_key, uint64_t beacon_sequence)
 {
   NvmeGwMonState& gw_map = created_gws[group_key][gw_id];
-  if (HAVE_FEATURE(mon->get_quorum_con_features(), NVMEOF_BEACON_DIFF) &&
+  if (HAVE_FEATURE(mon->get_quorum_con_features(), NVMEOF_BEACON_DIFF) ||
                  (gw_version > 0)) {
       gw_map.beacon_sequence = beacon_sequence;
+      gw_map.beacon_sequence_ooo = false;
       dout(10) << gw_id << " set beacon_sequence " << beacon_sequence << dendl;
   }
   return true;
index 2ef7669bd7877b48136274489abbbd1bf383b685..251b1b9a40354f37eb82956bb8923807e865781b 100644 (file)
@@ -243,7 +243,7 @@ void NVMeofGwMon::encode_pending(MonitorDBStore::TransactionRef t)
   pending_map.encode(bl, features);
   dout(10) << " has NVMEOFHA: " << HAVE_FEATURE(features, NVMEOFHA)
        << " has NVMEOFHAMAP: " <<  HAVE_FEATURE(features, NVMEOFHAMAP)
-       << " has BEACON_DIFF: " <<  HAVE_FEATURE(features,NVMEOFHAMAP) << dendl;// BEACONDIFF
+       << " has BEACON_DIFF: " <<  HAVE_FEATURE(features, NVMEOF_BEACON_DIFF) << dendl;
   put_version(t, pending_map.epoch, bl);
   put_last_committed(t, pending_map.epoch);
 
@@ -257,7 +257,7 @@ void NVMeofGwMon::update_from_paxos(bool *need_bootstrap)
 {
   version_t version = get_last_committed();
   uint64_t features = mon.get_quorum_con_features();
-  dout(10) << " has BEACON_DIFF: " <<  HAVE_FEATURE(features,NVMEOFHAMAP)
+  dout(10) << " has BEACON_DIFF: " <<  HAVE_FEATURE(features, NVMEOF_BEACON_DIFF)
                   << dendl;
   if (version != map.epoch) {
     dout(10) << " NVMeGW loading version " << version
@@ -681,6 +681,8 @@ void NVMeofGwMon::do_send_map_ack(MonOpRequestRef op,
       " sending ACK due to receiving beacon_sequence out of order" << dendl;
       ack_map.created_gws[group_key][gw_id].beacon_sequence = stored_sequence;
       ack_map.created_gws[group_key][gw_id].beacon_sequence_ooo = true;
+    } else {
+        ack_map.created_gws[group_key][gw_id].beacon_sequence_ooo = false;
     }
     if (gw_propose) {
      dout(10) << "GW in Created " << gw_id << " ack map " << ack_map << dendl;
@@ -720,7 +722,7 @@ int NVMeofGwMon::apply_beacon(const NvmeGwId &gw_id, int gw_version,
                      pending_map.created_gws[group_key][gw_id].subsystems;
   auto &state = pending_map.created_gws[group_key][gw_id];
 
-  if (!HAVE_FEATURE(mon.get_quorum_con_features(), NVMEOF_BEACON_DIFF) ||
+  if (!HAVE_FEATURE(mon.get_quorum_con_features(), NVMEOF_BEACON_DIFF) &&
                  gw_version == 0) {
     if (gw_subs != sub) {
       dout(10) << "BEACON_DIFF logic not applied."
index 664bc3fa85d50b3beffa3b8f0e824c3d505f455a..e8f6803eb22855c3274228d089e8f10a2995f7cc 100755 (executable)
@@ -856,11 +856,11 @@ inline void encode(const BeaconSubsystem& sub,  ceph::bufferlist &bl, uint64_t f
   if (HAVE_FEATURE(features, NVMEOF_BEACON_DIFF)) {
     version = BEACON_SUBSYS_VERSION_ENHANCED;  // Use enhanced version if feature supported
   }
-
   // For legacy encoding, skip deleted subsystems to maintain compatibility
-  if (version == BEACON_SUBSYS_VERSION_LEGACY && sub.change_descriptor == subsystem_change_t::SUBSYSTEM_DELETED) {
-    dout(20) << "encode BeaconSubsystem: skipping deleted subsystem " << sub.nqn << " in legacy mode" << dendl;
-    return;  // Skip encoding this subsystem entirely
+  if (version == BEACON_SUBSYS_VERSION_LEGACY && sub.change_descriptor != subsystem_change_t::SUBSYSTEM_ADDED) {
+    dout(4) << "encode BeaconSubsystem: skipping subsystem " << sub.nqn
+            << " with change_descriptor " << (int)sub.change_descriptor << " in legacy mode" << dendl;
+    return; // Skip encoding this subsystem entirely
   }
 
   ENCODE_START(version, version, bl);
index 7922a106ba0b468cb863dac63aa3f32b1a865497..6f6df237c6a7ff2c3fcc42144b76453ee26c4623 100755 (executable)
@@ -97,7 +97,7 @@ struct BeaconSubsystem {
   NvmeNqnId nqn;
   std::list<BeaconListener>  listeners;
   std::list<BeaconNamespace> namespaces;
-  subsystem_change_t change_descriptor;
+  subsystem_change_t change_descriptor = subsystem_change_t::SUBSYSTEM_ADDED;
 
   // Define the equality operator
   bool operator==(const BeaconSubsystem& other) const {