]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ReplicatedPG: don't skip missing if sentries is empty on pgls
authorSamuel Just <sam.just@inktank.com>
Wed, 6 Nov 2013 22:33:03 +0000 (14:33 -0800)
committerSamuel Just <sam.just@inktank.com>
Thu, 7 Nov 2013 01:55:12 +0000 (17:55 -0800)
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 <sam.just@inktank.com>
Reviewed-by: David Zafman <david.zafman@inktank.com>
src/osd/ReplicatedPG.cc

index 48040b68a882dbaaed08e3b0906c39e9c1c16282..19592a64cea7129e0d45adf434df638275b251f5 100644 (file)
@@ -655,19 +655,38 @@ void ReplicatedPG::do_pg_op(OpRequestRef op)
        map<hobject_t, pg_missing_t::item>::const_iterator missing_iter =
          pg_log.get_missing().missing.lower_bound(current);
        vector<hobject_t>::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;