Skip to content

Commit

Permalink
rgw: optimize function abort_bucket_multiparts
Browse files Browse the repository at this point in the history
* 1. common_prefixes is useless, so drop it;
* 2. RGWMPObj object is enough, so change RGWMultipartUploadEntry to RGWMPObj;
* 3. adjust log format.

Signed-off-by: Bingyin Zhang <zhangbingyin@cloudin.cn>
  • Loading branch information
Bingyin Zhang committed Dec 28, 2017
1 parent 8a48b64 commit 295e5b3
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/rgw/rgw_multi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -269,31 +269,30 @@ int abort_bucket_multiparts(RGWRados *store, CephContext *cct, RGWBucketInfo& bu
int ret, max = 1000, num_deleted = 0;
vector<rgw_bucket_dir_entry> objs;
RGWObjectCtx obj_ctx(store);
string marker;
map<string, bool> common_prefixes;
bool is_truncated;
string marker;

do {
ret = list_bucket_multiparts(store, bucket_info, prefix, marker, delim,
max, &objs, &common_prefixes, &is_truncated);
max, &objs, NULL, &is_truncated);
if (ret < 0) {
return ret;
}
if (!objs.empty()) {
RGWMultipartUploadEntry entry;
RGWMPObj mp;
for (const auto& obj : objs) {
rgw_obj_key key(obj.key);
if (!entry.mp.from_meta(key.name))
if (!mp.from_meta(key.name))
continue;
entry.obj = obj;
ret = abort_multipart_upload(store, cct, &obj_ctx, bucket_info, entry.mp);
ret = abort_multipart_upload(store, cct, &obj_ctx, bucket_info, mp);
if (ret < 0) {
return ret;
}
num_deleted++;
}
if (num_deleted) {
ldout(store->ctx(),0) << "WARNING : aborted " << num_deleted << " incomplete multipart uploads" << dendl;
ldout(store->ctx(), 0) << "WARNING: aborted " << num_deleted <<
" incomplete multipart uploads" << dendl;
}
}
} while (is_truncated);
Expand Down

0 comments on commit 295e5b3

Please sign in to comment.