From: Casey Bodley Date: Fri, 28 Feb 2020 16:06:32 +0000 (-0500) Subject: rgw: bucket_list_ordered advances past duplicate common prefixes X-Git-Tag: v15.1.1~172^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=81cfd5da3f7e6d889e6440c23227d8e78c8aa06f;p=ceph.git rgw: bucket_list_ordered advances past duplicate common prefixes we may see the same common prefix from more than one shard. when we detect a duplicate, we need to advance past it. otherwise, we may make the wrong decision about is_truncated because the shards with duplicates won't be at_end() Fixes: https://tracker.ceph.com/issues/44353 Signed-off-by: Casey Bodley --- diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 6142c9bd457a..2e0a9f77c3c2 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -8309,7 +8309,9 @@ int RGWRados::cls_bucket_list_ordered(RGWBucketInfo& bucket_info, // it's important that the values in the map refer to the index // into the results_trackers vector, which may not be the same // as the shard number (i.e., when not all shards are requested) - candidates[t.entry_name()] = tracker_idx; + if (!candidates.emplace(t.entry_name(), tracker_idx).second) { + t.advance(); // skip duplicate common prefixes + } } ++tracker_idx; } @@ -8367,7 +8369,9 @@ int RGWRados::cls_bucket_list_ordered(RGWBucketInfo& bucket_info, // refresh the candidates map candidates.erase(candidates.begin()); if (! tracker.advance().at_end()) { - candidates[tracker.entry_name()] = tracker_idx; + if (!candidates.emplace(tracker.entry_name(), tracker_idx).second) { + tracker.advance(); // skip duplicate common prefixes + } } else if (tracker.is_truncated()) { // once we exhaust one shard that is truncated, we need to stop, // as we cannot be certain that one of the next entries needs to