Merge pull request #21892 from dzafman/wip-24045

osd: Don't evict even when preemption has restarted with smaller chunk

Reviewed-by: Sage Weil <sage@redhat.com>
This commit is contained in:
Sage Weil 2018-05-16 15:27:53 -05:00 committed by GitHub
commit 4c8611da87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 4 deletions

View File

@ -4566,6 +4566,8 @@ int PG::build_scrub_map_chunk(
_repair_oinfo_oid(map);
if (!is_primary()) {
ScrubMap for_meta_scrub;
// In case we restarted smaller chunk, clear old data
scrubber.cleaned_meta_map.clear_from(scrubber.start);
scrubber.cleaned_meta_map.insert(map);
scrubber.clean_meta_map(for_meta_scrub);
_scan_snaps(for_meta_scrub);
@ -4669,6 +4671,7 @@ void PG::replica_scrub(
scrubber.replica_scrub_start = msg->min_epoch;
scrubber.start = msg->start;
scrubber.end = msg->end;
scrubber.max_end = msg->end;
scrubber.deep = msg->deep;
scrubber.epoch_start = info.history.same_interval_since;
if (msg->priority) {
@ -4860,7 +4863,8 @@ void PG::chunky_scrub(ThreadPool::TPHandle &handle)
while (!done) {
dout(20) << "scrub state " << Scrubber::state_string(scrubber.state)
<< " [" << scrubber.start << "," << scrubber.end << ")" << dendl;
<< " [" << scrubber.start << "," << scrubber.end << ")"
<< " max_end " << scrubber.max_end << dendl;
switch (scrubber.state) {
case PG::Scrubber::INACTIVE:
@ -4979,6 +4983,8 @@ void PG::chunky_scrub(ThreadPool::TPHandle &handle)
break;
}
scrubber.end = candidate_end;
if (scrubber.end > scrubber.max_end)
scrubber.max_end = scrubber.end;
}
// walk the log to find the latest update that affects our chunk
@ -5188,6 +5194,7 @@ void PG::chunky_scrub(ThreadPool::TPHandle &handle)
scrubber.replica_scrubmap_pos = ScrubMapBuilder();
scrubber.start = hobject_t();
scrubber.end = hobject_t();
scrubber.max_end = hobject_t();
done = true;
break;
@ -5196,7 +5203,8 @@ void PG::chunky_scrub(ThreadPool::TPHandle &handle)
}
}
dout(20) << "scrub final state " << Scrubber::state_string(scrubber.state)
<< " [" << scrubber.start << "," << scrubber.end << ")" << dendl;
<< " [" << scrubber.start << "," << scrubber.end << ")"
<< " max_end " << scrubber.max_end << dendl;
}
bool PG::write_blocked_by_scrub(const hobject_t& soid)
@ -5218,8 +5226,8 @@ bool PG::write_blocked_by_scrub(const hobject_t& soid)
bool PG::range_intersects_scrub(const hobject_t &start, const hobject_t& end)
{
// does [start, end] intersect [scrubber.start, scrubber.end)
return (start < scrubber.end &&
// does [start, end] intersect [scrubber.start, scrubber.max_end)
return (start < scrubber.max_end &&
end >= scrubber.start);
}
@ -8153,6 +8161,7 @@ boost::statechart::result PG::RecoveryState::Active::react(const QueryState& q)
q.f->dump_string("scrubber.state", Scrubber::state_string(pg->scrubber.state));
q.f->dump_stream("scrubber.start") << pg->scrubber.start;
q.f->dump_stream("scrubber.end") << pg->scrubber.end;
q.f->dump_stream("scrubber.max_end") << pg->scrubber.max_end;
q.f->dump_stream("scrubber.subset_last_update") << pg->scrubber.subset_last_update;
q.f->dump_bool("scrubber.deep", pg->scrubber.deep);
{

View File

@ -1622,6 +1622,7 @@ public:
// chunky scrub
hobject_t start, end; // [start,end)
hobject_t max_end; // Largest end that may have been sent to replicas
eversion_t subset_last_update;
// chunky scrub state
@ -1697,6 +1698,7 @@ public:
state = PG::Scrubber::INACTIVE;
start = hobject_t();
end = hobject_t();
max_end = hobject_t();
subset_last_update = eversion_t();
shallow_errors = 0;
deep_errors = 0;

View File

@ -4967,6 +4967,9 @@ struct ScrubMap {
bool has_large_omap_object_errors:1;
void merge_incr(const ScrubMap &l);
void clear_from(const hobject_t& start) {
objects.erase(objects.lower_bound(start), objects.end());
}
void insert(const ScrubMap &r) {
objects.insert(r.objects.begin(), r.objects.end());
}