]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/scrub: change missing_digest fix-list type 42993/head
authorRonen Friedman <rfriedma@redhat.com>
Thu, 13 Jan 2022 09:22:11 +0000 (09:22 +0000)
committerRonen Friedman <rfriedma@redhat.com>
Sat, 22 Jan 2022 10:37:06 +0000 (10:37 +0000)
...allowing for efficient creation and, more important,
direct consumption by the function performing the
actual I/O.

Signed-off-by: Ronen Friedman <rfriedma@redhat.com>
src/osd/scrubber/PrimaryLogScrub.cc
src/osd/scrubber/scrub_backend.cc
src/osd/scrubber/scrub_backend.h

index 53247cae4c5a2332e821c2dd1116ee4cfd7f3897..127f9fab56bd9a94d8103c383288fe6b537a9cb6 100644 (file)
@@ -42,12 +42,12 @@ bool PrimaryLogScrub::get_store_errors(const scrub_ls_arg_t& arg,
   return true;
 }
 
-//  forwarders used by the scrubber backend
-
 /// \todo combine the multiple transactions into a single one
 void PrimaryLogScrub::submit_digest_fixes(const digests_fixes_t& fixes)
 {
-  num_digest_updates_pending += fixes.size();
+  // note: the following line was modified from '+=' to '=', as we should not
+  // encounter previous-chunk digest updates after starting a new chunk
+  num_digest_updates_pending = fixes.size();
   dout(10) << __func__
            << ": num_digest_updates_pending: " << num_digest_updates_pending
            << dendl;
@@ -99,6 +99,7 @@ void PrimaryLogScrub::submit_digest_fixes(const digests_fixes_t& fixes)
   }
 }
 
+//  a forwarder used by the scrubber backend
 
 void PrimaryLogScrub::add_to_stats(const object_stat_sum_t& stat)
 {
index af7febf0eec5ba2db032d6029d467dbaf754a59f..49c6f725bb0af32b0a4560c4560e859a246a076b 100644 (file)
@@ -968,7 +968,8 @@ void ScrubBackend::inconsistents(const hobject_t& ho,
     if (auth_object.omap_digest_present) {
       omap_digest = auth_object.omap_digest;
     }
-    this_chunk->missing_digest[ho] = make_pair(data_digest, omap_digest);
+    this_chunk->missing_digest.push_back(
+      make_pair(ho, make_pair(data_digest, omap_digest)));
   }
 
   if (!this_chunk->cur_inconsistent.empty() ||
@@ -1017,7 +1018,8 @@ void ScrubBackend::inconsistents(const hobject_t& ho,
           dout(20) << __func__ << ": will update omap digest on " << ho
                    << dendl;
         }
-        this_chunk->missing_digest[ho] = make_pair(data_digest, omap_digest);
+        this_chunk->missing_digest.push_back(
+          make_pair(ho, make_pair(data_digest, omap_digest)));
         break;
     }
   }
@@ -1739,14 +1741,7 @@ void ScrubBackend::scrub_snapshot_metadata(ScrubMap& map)
     m_scrubber.m_store->add_snap_error(pool.id, head_error);
 
   // fix data/omap digests
-  digests_fixes_t digest_fixes{this_chunk->missing_digest.size()};
-  std::transform(
-    this_chunk->missing_digest.begin(),
-    this_chunk->missing_digest.end(),
-    digest_fixes.begin(),
-    [](const auto& p) { return std::make_pair(p.first, p.second); });
-
-  m_scrubber.submit_digest_fixes(digest_fixes);
+  m_scrubber.submit_digest_fixes(this_chunk->missing_digest);
 
   dout(10) << __func__ << " (" << m_mode_desc << ") finish" << dendl;
 }
index c866153fb55656cab0db16935dbbc6cb4004f20f..cb23ad09bff767cbd93842d32a14ce64534a6cc9 100644 (file)
@@ -171,7 +171,7 @@ struct scrub_chunk_t {
 
   utime_t started{ceph_clock_now()};
 
-  std::map<hobject_t, data_omap_digests_t> missing_digest;
+  digests_fixes_t missing_digest;
 
   /// Map from object with errors to good peers
   std::map<hobject_t, std::list<pg_shard_t>> authoritative;