Skip to content

Commit

Permalink
radosgw-admin: use metadata mgr to list buckets
Browse files Browse the repository at this point in the history
Signed-off-by: Casey Bodley <[email protected]>
  • Loading branch information
cbodley committed Nov 29, 2018
1 parent 4898dc8 commit b532568
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/rgw/rgw_bucket.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1629,16 +1629,21 @@ int RGWBucketAdminOp::info(RGWRados *store, RGWBucketAdminOpState& op_state,
return ret;
}
} else {
RGWAccessHandle handle;
void *handle = nullptr;
bool truncated = true;

formatter->open_array_section("buckets");
if (store->list_buckets_init(&handle) >= 0) {
rgw_bucket_dir_entry obj;
while (store->list_buckets_next(obj, &handle) >= 0) {
ret = store->meta_mgr->list_keys_init("bucket", &handle);
while (ret == 0 && truncated) {
std::list<std::string> buckets;
const int max_keys = 1000;
ret = store->meta_mgr->list_keys_next(handle, max_keys, buckets,
&truncated);
for (auto& bucket_name : buckets) {
if (show_stats)
bucket_stats(store, user_id.tenant, obj.key.name, formatter);
bucket_stats(store, user_id.tenant, bucket_name, formatter);
else
formatter->dump_string("bucket", obj.key.name);
formatter->dump_string("bucket", bucket_name);
}
}

Expand Down

0 comments on commit b532568

Please sign in to comment.