]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: osd_epochs to store only UP osds
authorMatan Breizman <mbreizma@redhat.com>
Wed, 31 Jan 2024 12:48:04 +0000 (12:48 +0000)
committerMykola Golub <mgolub@suse.com>
Fri, 1 Mar 2024 12:10:00 +0000 (14:10 +0200)
OUT OSDs can be the primary for a PG via pg_temp. Therfore, we should
consider OUT as valid beacons.

Signed-off-by: Matan Breizman <mbreizma@redhat.com>
(cherry picked from commit ba750f45ab06546df261ab2bb7be993ecc0b5d22)

src/mon/OSDMonitor.cc

index 6047bfef1529ad8ebc2ad33a05445a8a070ae21e..9cbe1055048adc0bd243daa707b71b2971848cd7 100644 (file)
@@ -903,12 +903,7 @@ void OSDMonitor::update_from_paxos(bool *need_bootstrap)
       if (state & CEPH_OSD_UP) {
        // could be marked up *or* down, but we're too lazy to check which
        last_osd_report.erase(osd);
-      }
-    }
-    for (auto [osd, weight] : inc.new_weight) {
-      if (weight == CEPH_OSD_OUT) {
-        // manually marked out, so drop it
-        osd_epochs.erase(osd);
+       osd_epochs.erase(osd);
       }
     }
   }
@@ -2338,6 +2333,7 @@ epoch_t OSDMonitor::get_min_last_epoch_clean() const
   // don't trim past the oldest reported osd epoch
   for (auto [osd, epoch] : osd_epochs) {
     if (epoch < floor) {
+      ceph_assert(osdmap.is_up(osd));
       floor = epoch;
     }
   }
@@ -4420,9 +4416,8 @@ bool OSDMonitor::prepare_beacon(MonOpRequestRef op)
 
   last_osd_report[from].first = ceph_clock_now();
   last_osd_report[from].second = beacon->osd_beacon_report_interval;
-  if (osdmap.is_in(from)) {
-    osd_epochs[from] = beacon->version;
-  }
+  ceph_assert(osdmap.is_up(from));
+  osd_epochs[from] = beacon->version;
   for (const auto& pg : beacon->pgs) {
     if (auto* pool = osdmap.get_pg_pool(pg.pool()); pool != nullptr) {
       unsigned pg_num = pool->get_pg_num();