Skip to content

Commit

Permalink
Merge pull request #28086 from cbodley/wip-39411
Browse files Browse the repository at this point in the history
mimic: rgw: cls_bucket_list_unordered lists a single shard

Reviewed-by: J. Eric Ivancich <ivancich@redhat.com>
  • Loading branch information
yuriw committed May 15, 2019
2 parents 06c9c80 + de3e851 commit 944b8f8
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 16 deletions.
25 changes: 19 additions & 6 deletions src/cls/rgw/cls_rgw_client.cc
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -207,20 +207,33 @@ void cls_rgw_bucket_complete_op(ObjectWriteOperation& o, RGWModifyOp op, string&
o.exec(RGW_CLASS, RGW_BUCKET_COMPLETE_OP, in); o.exec(RGW_CLASS, RGW_BUCKET_COMPLETE_OP, in);
} }


static bool issue_bucket_list_op(librados::IoCtx& io_ctx, void cls_rgw_bucket_list_op(librados::ObjectReadOperation& op,
const string& oid, const cls_rgw_obj_key& start_obj, const string& filter_prefix, const cls_rgw_obj_key& start_obj,
uint32_t num_entries, bool list_versions, BucketIndexAioManager *manager, const std::string& filter_prefix,
struct rgw_cls_list_ret *pdata) { uint32_t num_entries,
bool list_versions,
rgw_cls_list_ret* result)
{
bufferlist in; bufferlist in;
struct rgw_cls_list_op call; rgw_cls_list_op call;
call.start_obj = start_obj; call.start_obj = start_obj;
call.filter_prefix = filter_prefix; call.filter_prefix = filter_prefix;
call.num_entries = num_entries; call.num_entries = num_entries;
call.list_versions = list_versions; call.list_versions = list_versions;
encode(call, in); encode(call, in);


op.exec(RGW_CLASS, RGW_BUCKET_LIST, in, new ClsBucketIndexOpCtx<rgw_cls_list_ret>(result, NULL));
}

static bool issue_bucket_list_op(librados::IoCtx& io_ctx, const string& oid,
const cls_rgw_obj_key& start_obj,
const string& filter_prefix,
uint32_t num_entries, bool list_versions,
BucketIndexAioManager *manager,
rgw_cls_list_ret *pdata) {
librados::ObjectReadOperation op; librados::ObjectReadOperation op;
op.exec(RGW_CLASS, RGW_BUCKET_LIST, in, new ClsBucketIndexOpCtx<struct rgw_cls_list_ret>(pdata, NULL)); cls_rgw_bucket_list_op(op, start_obj, filter_prefix,
num_entries, list_versions, pdata);
return manager->aio_operate(io_ctx, oid, &op); return manager->aio_operate(io_ctx, oid, &op);
} }


Expand Down
7 changes: 7 additions & 0 deletions src/cls/rgw/cls_rgw_client.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -419,6 +419,13 @@ class CLSRGWIssueBucketList : public CLSRGWConcurrentIO {
start_obj(_start_obj), filter_prefix(_filter_prefix), num_entries(_num_entries), list_versions(_list_versions), result(list_results) {} start_obj(_start_obj), filter_prefix(_filter_prefix), num_entries(_num_entries), list_versions(_list_versions), result(list_results) {}
}; };


void cls_rgw_bucket_list_op(librados::ObjectReadOperation& op,
const cls_rgw_obj_key& start_obj,
const std::string& filter_prefix,
uint32_t num_entries,
bool list_versions,
rgw_cls_list_ret* result);

class CLSRGWIssueBILogList : public CLSRGWConcurrentIO { class CLSRGWIssueBILogList : public CLSRGWConcurrentIO {
map<int, struct cls_rgw_bi_log_list_ret>& result; map<int, struct cls_rgw_bi_log_list_ret>& result;
BucketIndexShardsManager& marker_mgr; BucketIndexShardsManager& marker_mgr;
Expand Down
17 changes: 7 additions & 10 deletions src/rgw/rgw_rados.cc
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -13373,19 +13373,16 @@ int RGWRados::cls_bucket_list_unordered(RGWBucketInfo& bucket_info,
while (count <= num_entries && while (count <= num_entries &&
((shard_id >= 0 && current_shard == uint32_t(shard_id)) || ((shard_id >= 0 && current_shard == uint32_t(shard_id)) ||
current_shard < num_shards)) { current_shard < num_shards)) {
// key - oid (for different shards if there is any) const std::string& oid = oids[current_shard];
// value - list result for the corresponding oid (shard), it is filled by rgw_cls_list_ret result;
// the AIO callback
map<int, struct rgw_cls_list_ret> list_results; librados::ObjectReadOperation op;
r = CLSRGWIssueBucketList(index_ctx, my_start, prefix, num_entries, cls_rgw_bucket_list_op(op, my_start, prefix, num_entries,
list_versions, oids, list_results, list_versions, &result);
cct->_conf->rgw_bucket_index_max_aio)(); r = index_ctx.operate(oid, &op, nullptr);
if (r < 0) if (r < 0)
return r; return r;


const std::string& oid = oids[current_shard];
assert(list_results.find(current_shard) != list_results.end());
auto& result = list_results[current_shard];
for (auto& entry : result.dir.m) { for (auto& entry : result.dir.m) {
rgw_bucket_dir_entry& dirent = entry.second; rgw_bucket_dir_entry& dirent = entry.second;


Expand Down

0 comments on commit 944b8f8

Please sign in to comment.