From 4e5d146ad36ef0380eb72e45dca651494658aeeb Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 26 Mar 2015 13:24:11 -0700 Subject: [PATCH] osd: record digest if object is clean (vs entire scrub chunk) If an individual object is clean, record it in the missing_digest map. If not, leave it out. This lets us drop the old condition that only recorded any digests if the entire scrub chunk was clean. Signed-off-by: Sage Weil (cherry picked from commit c39e0e5f126028f552d410ab6924cac6e1f714fb) --- src/osd/PGBackend.cc | 6 +++++- src/osd/ReplicatedPG.cc | 40 +++++++++++++++++++--------------------- 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/src/osd/PGBackend.cc b/src/osd/PGBackend.cc index cb856eb806cd..535b2a6c878b 100644 --- a/src/osd/PGBackend.cc +++ b/src/osd/PGBackend.cc @@ -581,6 +581,7 @@ void PGBackend::be_compare_scrubmaps( ScrubMap::object& auth_object = auth->second->objects[*k]; set cur_missing; set cur_inconsistent; + bool clean = true; for (j = maps.begin(); j != maps.end(); ++j) { if (j == auth) continue; @@ -595,6 +596,7 @@ void PGBackend::be_compare_scrubmaps( j->second->objects[*k], ss); if (error != CLEAN) { + clean = false; cur_inconsistent.insert(j->first); if (error == SHALLOW_ERROR) ++shallow_errors; @@ -606,6 +608,7 @@ void PGBackend::be_compare_scrubmaps( auth_list.push_back(j->first); } } else { + clean = false; cur_missing.insert(j->first); ++shallow_errors; errorstream << __func__ << ": " << pgid << " shard " << j->first @@ -621,7 +624,8 @@ void PGBackend::be_compare_scrubmaps( if (!cur_inconsistent.empty() || !cur_missing.empty()) { authoritative[*k] = auth_list; } - if (okseed && + if (clean && + okseed && parent->get_pool().is_replicated() && auth_object.digest_present && auth_object.omap_digest_present && (!auth_oi.is_data_digest() || !auth_oi.is_omap_digest() || diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 66fd948b4349..4da2224233cc 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -11382,27 +11382,25 @@ void ReplicatedPG::_scrub( ++scrubber.shallow_errors; } - if (scrubber.shallow_errors == 0) { - for (map >::const_iterator p = - missing_digest.begin(); - p != missing_digest.end(); - ++p) { - if (p->first.is_snapdir()) - continue; - dout(10) << __func__ << " recording digests for " << p->first << dendl; - ObjectContextRef obc = get_object_context(p->first, false); - assert(obc); - RepGather *repop = simple_repop_create(obc); - OpContext *ctx = repop->ctx; - ctx->at_version = get_next_version(); - ctx->mtime = utime_t(); // do not update mtime - ctx->new_obs.oi.set_data_digest(p->second.first); - ctx->new_obs.oi.set_omap_digest(p->second.second); - finish_ctx(ctx, pg_log_entry_t::MODIFY, true, true); - ctx->on_finish = new C_ScrubDigestUpdated(this); - simple_repop_submit(repop); - ++scrubber.num_digest_updates_pending; - } + for (map >::const_iterator p = + missing_digest.begin(); + p != missing_digest.end(); + ++p) { + if (p->first.is_snapdir()) + continue; + dout(10) << __func__ << " recording digests for " << p->first << dendl; + ObjectContextRef obc = get_object_context(p->first, false); + assert(obc); + RepGather *repop = simple_repop_create(obc); + OpContext *ctx = repop->ctx; + ctx->at_version = get_next_version(); + ctx->mtime = utime_t(); // do not update mtime + ctx->new_obs.oi.set_data_digest(p->second.first); + ctx->new_obs.oi.set_omap_digest(p->second.second); + finish_ctx(ctx, pg_log_entry_t::MODIFY, true, true); + ctx->on_finish = new C_ScrubDigestUpdated(this); + simple_repop_submit(repop); + ++scrubber.num_digest_updates_pending; } dout(10) << "_scrub (" << mode << ") finish" << dendl; -- 2.47.3