From: Samuel Just Date: Wed, 6 Nov 2013 22:33:03 +0000 (-0800) Subject: ReplicatedPG: don't skip missing if sentries is empty on pgls X-Git-Tag: v0.67.8~35 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=77e46d0d7984f2d3ee0e15f27d2961a637c20b45;p=ceph.git ReplicatedPG: don't skip missing if sentries is empty on pgls Formerly, if sentries is empty, we skip missing. In general, we need to continue adding items from missing until we get to next (returned from collection_list_partial) to avoid missing any objects. Fixes: #6633 Signed-off-by: Samuel Just Reviewed-by: David Zafman (cherry picked from commit c7a30b881151e08b37339bb025789921e7115288) --- diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 3e0a75dc780..233bc2cd514 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -487,19 +487,38 @@ void ReplicatedPG::do_pg_op(OpRequestRef op) map::const_iterator missing_iter = pg_log.get_missing().missing.lower_bound(current); vector::iterator ls_iter = sentries.begin(); + hobject_t _max = hobject_t::get_max(); while (1) { - if (ls_iter == sentries.end()) { - break; - } + const hobject_t &mcand = + missing_iter == pg_log.get_missing().missing.end() ? + _max : + missing_iter->first; + const hobject_t &lcand = + ls_iter == sentries.end() ? + _max : + *ls_iter; hobject_t candidate; - if (missing_iter == pg_log.get_missing().missing.end() || - *ls_iter < missing_iter->first) { - candidate = *(ls_iter++); + if (mcand == lcand) { + candidate = mcand; + if (!mcand.is_max()) { + ls_iter++; + missing_iter++; + } + } else if (mcand < lcand) { + candidate = mcand; + assert(!mcand.is_max()); + ++missing_iter; } else { - candidate = (missing_iter++)->first; + candidate = lcand; + assert(!lcand.is_max()); + ++ls_iter; } + if (candidate >= next) { + break; + } + if (response.entries.size() == list_size) { next = candidate; break;