Skip to content

Commit

Permalink
Merge pull request ceph#12224 from yehudasa/wip-rgw-list-all
Browse files Browse the repository at this point in the history
rgw/rgw_rados: do not omap_getvals with (u64)-1 max (updated)
also approve, passed teuthology (many false positives in several classes)
  • Loading branch information
mattbenjamin committed Dec 2, 2016
2 parents fd02288 + 99e866f commit 4b8b0c0
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions src/rgw/rgw_rados.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11295,11 +11295,33 @@ int RGWRados::omap_get_vals(rgw_obj& obj, bufferlist& header, const string& mark

}

int RGWRados::omap_get_all(rgw_obj& obj, bufferlist& header, std::map<string, bufferlist>& m)
int RGWRados::omap_get_all(rgw_obj& obj, bufferlist& header,
std::map<string, bufferlist>& m)
{
rgw_rados_ref ref;
rgw_bucket bucket;
int r = get_obj_ref(obj, &ref, &bucket);
if (r < 0) {
return r;
}

#define MAX_OMAP_GET_ENTRIES 1024
const int count = MAX_OMAP_GET_ENTRIES;
string start_after;

return omap_get_vals(obj, header, start_after, (uint64_t)-1, m);
while (true) {
std::map<string, bufferlist> t;
r = ref.ioctx.omap_get_vals(ref.oid, start_after, count, &t);
if (r < 0) {
return r;
}
if (t.empty()) {
break;
}
start_after = t.rbegin()->first;
m.insert(t.begin(), t.end());
}
return 0;
}

int RGWRados::omap_set(rgw_obj& obj, std::string& key, bufferlist& bl)
Expand Down

0 comments on commit 4b8b0c0

Please sign in to comment.