From eb71924ea27e78d97bd45674ef5e6a7fce30932f Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 27 Mar 2014 15:12:25 -0700 Subject: [PATCH] osd/ReplicatedPG: tolerate missing clones in cache pools A few cases: - As we are working through the list, if we see a clone that is lower than the next one we were expecting, we should be able to skip them. - If we see a head, we can skip all of the rest of the clones. - If we get to the end and next_clone was set, we can ignore it. Signed-off-by: Sage Weil --- src/osd/ReplicatedPG.cc | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 53c877a29299..0d0db5f572a6 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -11123,6 +11123,26 @@ void ReplicatedPG::_scrub(ScrubMap& scrubmap) //assert(data.length() == p->size); // + if (!next_clone.is_min() && next_clone != soid && + pool.info.cache_mode == pg_pool_t::CACHEMODE_NONE) { + // it is okay to be missing one or more clones in a cache tier. + // skip higher-numbered clones in the list. + while (curclone != snapset.clones.rend() && + soid.snap < *curclone) + ++curclone; + if (curclone != snapset.clones.rend() && + soid.snap == *curclone) { + dout(20) << __func__ << " skipped some clones in cache tier" << dendl; + next_clone.snap = *curclone; + } + if (curclone == snapset.clones.rend() || + soid.snap == CEPH_NOSNAP) { + dout(20) << __func__ << " skipped remaining clones in cache tier" + << dendl; + next_clone = hobject_t(); + head = hobject_t(); + } + } if (!next_clone.is_min() && next_clone != soid) { osd->clog.error() << mode << " " << info.pgid << " " << soid << " expected clone " << next_clone; @@ -11187,7 +11207,8 @@ void ReplicatedPG::_scrub(ScrubMap& scrubmap) scrub_cstat.add(stat, cat); } - if (!next_clone.is_min()) { + if (!next_clone.is_min() && + pool.info.cache_mode == pg_pool_t::CACHEMODE_NONE) { osd->clog.error() << mode << " " << info.pgid << " expected clone " << next_clone; ++scrubber.shallow_errors; -- 2.47.3