From b07598b0056feb33a16d977f52e3e20634b0419c Mon Sep 17 00:00:00 2001 From: Matan Breizman Date: Wed, 31 Jan 2024 12:48:04 +0000 Subject: [PATCH] mon/OSDMonitor: osd_epochs to store only UP osds 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 (cherry picked from commit ba750f45ab06546df261ab2bb7be993ecc0b5d22) --- src/mon/OSDMonitor.cc | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 93a087b5049..fb5d567a8d8 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -901,12 +901,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); } } } @@ -2336,6 +2331,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; } } @@ -4443,9 +4439,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(); -- 2.39.5