diff --git a/src/osd/scrubber/PrimaryLogScrub.cc b/src/osd/scrubber/PrimaryLogScrub.cc index 53247cae4c5..127f9fab56b 100644 --- a/src/osd/scrubber/PrimaryLogScrub.cc +++ b/src/osd/scrubber/PrimaryLogScrub.cc @@ -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) { diff --git a/src/osd/scrubber/scrub_backend.cc b/src/osd/scrubber/scrub_backend.cc index af7febf0eec..49c6f725bb0 100644 --- a/src/osd/scrubber/scrub_backend.cc +++ b/src/osd/scrubber/scrub_backend.cc @@ -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; } diff --git a/src/osd/scrubber/scrub_backend.h b/src/osd/scrubber/scrub_backend.h index c866153fb55..cb23ad09bff 100644 --- a/src/osd/scrubber/scrub_backend.h +++ b/src/osd/scrubber/scrub_backend.h @@ -171,7 +171,7 @@ struct scrub_chunk_t { utime_t started{ceph_clock_now()}; - std::map missing_digest; + digests_fixes_t missing_digest; /// Map from object with errors to good peers std::map> authoritative;