diff options
Diffstat (limited to 'src/mon/OSDMonitor.cc')
-rw-r--r-- | src/mon/OSDMonitor.cc | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 360bd036b..6543da85c 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -395,7 +395,7 @@ void LastEpochClean::report(unsigned pg_num, const pg_t& pg, return lec.report(pg_num, pg.ps(), last_epoch_clean); } -epoch_t LastEpochClean::get_lower_bound(const OSDMap& latest) const +epoch_t LastEpochClean::get_lower_bound_by_pool(const OSDMap& latest) const { auto floor = latest.get_epoch(); for (auto& pool : latest.get_pools()) { @@ -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); } } } @@ -2329,13 +2324,21 @@ version_t OSDMonitor::get_trim_to() const return 0; } +/* There are two constraints on trimming: + * 1. we must not trim past the last_epoch_clean for any pg + * 2. we must not trim past the last reported epoch for any up + * osds. + * + * LastEpochClean::get_lower_bound_by_pool gives a value <= constraint 1. + * For constraint 2, we take the min over osd_epochs, which is populated with + * MOSDBeacon::version, see OSDMonitor::prepare_beacon + */ epoch_t OSDMonitor::get_min_last_epoch_clean() const { - auto floor = last_epoch_clean.get_lower_bound(osdmap); - // also scan osd epochs - // don't trim past the oldest reported osd epoch + auto floor = last_epoch_clean.get_lower_bound_by_pool(osdmap); for (auto [osd, epoch] : osd_epochs) { if (epoch < floor) { + ceph_assert(osdmap.is_up(osd)); floor = epoch; } } @@ -4443,8 +4446,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; + 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(); @@ -11302,6 +11305,8 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op, err = 0; goto reply_no_propose; } + bool force_no_fake = false; + cmd_getval(cmdmap, "yes_i_really_mean_it", force_no_fake); if (!force) { err = -EPERM; ss << "will not override erasure code profile " << name @@ -11310,6 +11315,11 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op, << " is different from the proposed profile " << profile_map; goto reply_no_propose; + } else if (!force_no_fake) { + err = -EPERM; + ss << "overriding erasure code profile can be DANGEROUS" + << "; add --yes-i-really-mean-it to do it anyway"; + goto reply_no_propose; } } |