osd: Clear part of cleaned_meta_map in case of a restarted smaller chunk 22041/head
authorDavid Zafman <dzafman@redhat.com>
Wed, 16 May 2018 00:32:50 +0000 (17:32 -0700)
committerDavid Zafman <dzafman@redhat.com>
Wed, 16 May 2018 20:38:12 +0000 (13:38 -0700)
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 <dzafman@redhat.com>
(cherry picked from commit 9e0ac797c602a088447679b04e14ec0cfaf9dd7b)

src/osd/PG.cc
src/osd/osd_types.h

index 337a008306061fd2c7aeca39d3cd387df4b5a72e..173a51902dfcd4f1da28d3bc04171ea08caffe9d 100644 (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);
index 2455b94c93a3fb60092274aba0c8d9270d476698..4fe40c3c2fe7a77ccf58aaceb175549e4a78fadd 100644 (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());
   }