]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
nvmeofgw: fix sending acks during upgrade 63883/head
authorLeonid Chernin <leonidc@il.ibm.com>
Thu, 5 Jun 2025 07:59:03 +0000 (10:59 +0300)
committerLeonid Chernin <leonidc@il.ibm.com>
Wed, 11 Jun 2025 18:40:27 +0000 (21:40 +0300)
          fix gw-epoch during upgrade
          1.fixed issue  when during upgrade before feature NVMEOFHAMAP is
          applyed, monitor did not send acks to beacon - this cause
          expiration GW mon-client beacon ack timeout and assert of the GW.
          2. fixed issue that during upgrade new GW epoch, generated
  after applying of new feature NVMEOFHAMAP was less than
  global epoch. So GW mon-client asserted on receiving new epoch
          that is less than its last received epoch

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

index 12bd93cef7466f59c90e26ab4b3ce1f53d34224b..d5479b1ffce28a08bbf91a7006871fd7d0250c15 100755 (executable)
@@ -267,6 +267,11 @@ void  NVMeofGwMap::gw_performed_startup(const NvmeGwId &gw_id,
 void NVMeofGwMap::increment_gw_epoch(const NvmeGroupKey& group_key)
 {
   if (HAVE_FEATURE(mon->get_quorum_con_features(), NVMEOFHAMAP)) {
+    if (gw_epoch.find(group_key) == gw_epoch.end()) {
+      gw_epoch[group_key] = epoch;
+      dout(4) << "recreated GW epoch of " << group_key
+           << " " << gw_epoch[group_key] << dendl;
+    }
     gw_epoch[group_key] ++;
     dout(4) << "incremented epoch of " << group_key
          << " " << gw_epoch[group_key] << dendl;
index e41060084eae95a9d6b42ef0cc88d196c4bc0896..96611d08750be88d14a0d15f6384f180c0c8a2d6 100644 (file)
@@ -158,7 +158,8 @@ version_t NVMeofGwMon::get_trim_to() const
  * function called during new paxos epochs
  * function called to restore in pending map all data that is not serialized
  * to paxos peons. Othervise it would be overriden in "pending_map = map"
- * currently "allow_failovers_ts" and "last_gw_down_ts" variables restored
+ * currently "allow_failovers_ts", "last_gw_down_ts",
+ * "last_gw_map_epoch_valid" variables are restored
  */
 void NVMeofGwMon::restore_pending_map_info(NVMeofGwMap & tmp_map) {
   std::chrono::system_clock::time_point now = std::chrono::system_clock::now();
@@ -175,6 +176,8 @@ void NVMeofGwMon::restore_pending_map_info(NVMeofGwMap & tmp_map) {
       }
       pending_map.created_gws[group_key][gw_id].last_gw_down_ts =
           gw_created_pair.second.last_gw_down_ts;
+      pending_map.created_gws[group_key][gw_id].last_gw_map_epoch_valid =
+         gw_created_pair.second.last_gw_map_epoch_valid;
     }
   }
 }
@@ -806,12 +809,13 @@ bool NVMeofGwMon::prepare_beacon(MonOpRequestRef op)
     send_ack = true;
     if (apply_ack_logic) {
       dout(20) << "ack sent: beacon index "
-       << pending_map.created_gws[group_key][gw_id].beacon_index
-       << " gw " << gw_id <<dendl;
+      << pending_map.created_gws[group_key][gw_id].beacon_index
+      << " gw " << gw_id << " epoch-filter  " << epoch_filter_enabled
+      << " propose " << propose << " gw-propose " << gw_propose << dendl;
     }
   }
   if (send_ack && ((!gw_propose && epoch_filter_enabled) ||
-                    (propose && !epoch_filter_enabled) ||
+                    (!propose && !epoch_filter_enabled) ||
                     (avail == gw_availability_t::GW_CREATED)) ) {
           /* always send beacon ack to gw in Created state,
            * it should be temporary state