From f994925908c720f8e0b3fda2f1fc51ef6e757de3 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Thu, 12 Nov 2020 21:49:06 +0800 Subject: [PATCH] mon/OSDMonitor: remove osd_epochs if osd is marked in or out this is a cleanup. if we don't take the osd_epochs of osd marked out, there is no need to keep those osd_epochs around anymore. so, in this change, once the osd is marked in or out, we just drop its osd_epochs right away. Signed-off-by: Kefu Chai --- src/mon/OSDMonitor.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index e154ed72e0044..f83a9c2fd2a9a 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -891,9 +891,9 @@ void OSDMonitor::update_from_paxos(bool *need_bootstrap) // could be marked up *or* down, but we're too lazy to check which last_osd_report.erase(osd_state.first); } - if (osd_state.second & CEPH_OSD_EXISTS) { - // could be created *or* destroyed, but we can safely drop it - osd_epochs.erase(osd_state.first); + if (osd_state.second & CEPH_OSD_OUT) { + // could be marked in *or* out, but we can safely drop it + osd_epochs.erase(osd_state.first); } } } @@ -2281,8 +2281,7 @@ epoch_t OSDMonitor::get_min_last_epoch_clean() const // also scan osd epochs // don't trim past the oldest reported osd epoch for (auto [osd, epoch] : osd_epochs) { - if (epoch < floor && - osdmap.is_in(osd)) { + if (epoch < floor) { floor = epoch; } } -- 2.47.3