From: David Zafman Date: Wed, 16 May 2018 00:32:50 +0000 (-0700) Subject: osd: Clear part of cleaned_meta_map in case of a restarted smaller chunk X-Git-Tag: v13.1.1~10^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F22041%2Fhead;p=ceph.git osd: Clear part of cleaned_meta_map in case of a restarted smaller chunk This can not happen at the primary because scrub_compare_maps() is only called once per chunk start. Preemption causes a smaller chunk from start to be processed again at replicas. We clear any of the previous chunk's information. Signed-off-by: David Zafman (cherry picked from commit 9e0ac797c602a088447679b04e14ec0cfaf9dd7b) --- diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 337a00830606..173a51902dfc 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -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); diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index 2455b94c93a3..4fe40c3c2fe7 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -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()); }