From: Kefu Chai Date: Thu, 12 Nov 2020 13:49:06 +0000 (+0800) Subject: mon/OSDMonitor: remove osd_epochs if osd is marked in or out X-Git-Tag: v16.1.0~589^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f994925908c720f8e0b3fda2f1fc51ef6e757de3;p=ceph.git 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 --- diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index e154ed72e00..f83a9c2fd2a 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; } }