]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
ceph-nvmeof-mon fixes
authorLeonid Chernin <leonidc@il.ibm.com>
Wed, 3 Apr 2024 07:59:36 +0000 (07:59 +0000)
committerAlexander Indenbaum <aindenba@redhat.com>
Thu, 20 Nov 2025 08:55:26 +0000 (10:55 +0200)
- Remove last_leader logic, some  cleanups in NVMeofGwMon.h
  (cherry picked from commit 20bd67ee3dc6c4038f40a71c170683d2488efd1f)

- fix slow ops
  (cherry picked from commit 12ef028e30def7f77ac937868a61e7891cb9e8f2)

Resolves: rhbz#2273836
Signed-off-by: Alexander Indenbaum <aindenba@redhat.com>
src/mon/NVMeofGwMon.cc
src/mon/NVMeofGwMon.h

index 4f3ba16261d24ee886bd31d287f43d9accbe0433..0584bdb9ab5a1dd698ca0422577edbec2521176f 100644 (file)
@@ -32,15 +32,14 @@ void NVMeofGwMon::on_restart(){
     dout(4) <<  "called " << dendl;
     last_beacon.clear();
     last_tick = ceph::coarse_mono_clock::now();
+    synchronize_last_beacon();
 }
 
 
 void NVMeofGwMon::synchronize_last_beacon(){
-    dout(4) <<  "called " << dendl;
-    last_beacon.clear();
-    last_tick = ceph::coarse_mono_clock::now();
+    dout(10) <<  "called, is leader : " << mon.is_leader()  <<" active " << is_active()  << dendl;
     // Initialize last_beacon to identify transitions of available  GWs to unavailable state
-    for (const auto& created_map_pair: pending_map.Created_gws) {
+    for (const auto& created_map_pair: map.Created_gws) {
       const auto& group_key = created_map_pair.first;
       const NvmeGwCreatedMap& gw_created_map = created_map_pair.second;
       for (const auto& gw_created_pair: gw_created_map) {
@@ -61,7 +60,6 @@ void NVMeofGwMon::on_shutdown() {
 void NVMeofGwMon::tick(){
     if (!is_active() || !mon.is_leader()){
         dout(10) << "NVMeofGwMon leader : " << mon.is_leader() << "active : " << is_active()  << dendl;
-        last_leader = false;
         return;
     }
     bool _propose_pending = false;
@@ -137,13 +135,8 @@ void NVMeofGwMon::handle_conf_change(const ConfigProxy& conf,
 void NVMeofGwMon::create_pending(){
 
     pending_map = map;// deep copy of the object
-    // TODO  since "pending_map"  can be reset  each time during paxos re-election even in the middle of the changes ...
     pending_map.epoch++;
-    dout(4) << " pending " << pending_map  << dendl;
-    if(last_leader == false){ // peon becomes leader and gets updated map , need to synchronize the last_beacon
-        synchronize_last_beacon();
-        last_leader = true;
-    }
+    dout(10) << " pending " << pending_map  << dendl;
 }
 
 void NVMeofGwMon::encode_pending(MonitorDBStore::TransactionRef t){
@@ -506,13 +499,16 @@ bool NVMeofGwMon::prepare_beacon(MonOpRequestRef op){
 
 set_propose:
     if(!propose) {
-      if(gw_created){
-          ack_map.Created_gws[group_key][gw_id] = map.Created_gws[group_key][gw_id];// respond with a map slice correspondent to the same GW
-      }
-      ack_map.epoch = map.epoch;
-      dout(20) << "ack_map " << ack_map <<dendl;
-      auto msg = make_message<MNVMeofGwMap>(ack_map);
-      mon.send_reply(op, msg.detach());
+       if(gw_created){
+           ack_map.Created_gws[group_key][gw_id] = map.Created_gws[group_key][gw_id];// respond with a map slice correspondent to the same GW
+       }
+       ack_map.epoch = map.epoch;
+       dout(20) << "ack_map " << ack_map <<dendl;
+       auto msg = make_message<MNVMeofGwMap>(ack_map);
+       mon.send_reply(op, msg.detach());
+    }
+    else {
+       mon.no_reply(op);
     }
 false_return:
     if (propose){
index 33313e805d0113c1f44278484aef319dbda3c318..38eeac429cd96ce050ad732c3961dc2a6ac5600b 100644 (file)
@@ -45,11 +45,8 @@ class NVMeofGwMon: public PaxosService,
     // election) to reset last_beacon timeouts
     ceph::coarse_mono_clock::time_point last_tick;
 
-    std::vector<MonCommand> command_descs;
-    std::vector<MonCommand> pending_command_descs;
-
 public:
-    NVMeofGwMon(Monitor &mn, Paxos &p, const std::string& service_name): PaxosService(mn, p, service_name) {map.mon = &mn; last_leader = false;}
+    NVMeofGwMon(Monitor &mn, Paxos &p, const std::string& service_name): PaxosService(mn, p, service_name) {map.mon = &mn;}
     ~NVMeofGwMon() override {}
 
 
@@ -86,7 +83,6 @@ public:
     void check_sub(Subscription *sub);
 
 private:
-    bool last_leader;
     void synchronize_last_beacon();
 
 };