summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYehuda Sadeh <yehuda@inktank.com>2013-02-05 14:59:51 -0800
committerYehuda Sadeh <yehuda@inktank.com>2013-02-05 15:52:41 -0800
commitb663c097d1e6f41aed9abeadaae80f66fc71f5ec (patch)
tree302a539c4281d46639472c79b4c71be530aa49a3
parent2d8faf8e5f15e833e6b556b0f3c4ac92e4a4151e (diff)
downloadceph-b663c097d1e6f41aed9abeadaae80f66fc71f5ec.tar.gz
rgw: unlink multipart upload parts when completing upload
Fixes: #4011 When completing the multipart upload, we also need to unlink the parts from the bucket index. Originally we used to remove the parts however, nowadays the parts live on as we just point the object manifest at them. So we don't remove the objects, however, we need to remove them from the bucket index. Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
-rw-r--r--src/rgw/rgw_op.cc15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc
index 40e496acc72..652d0fd9ccb 100644
--- a/src/rgw/rgw_op.cc
+++ b/src/rgw/rgw_op.cc
@@ -1515,6 +1515,8 @@ void RGWCompleteMultipart::execute()
rgw_obj target_obj;
RGWMPObj mp;
RGWObjManifest manifest;
+ list<string> unlink_parts;
+ int r;
ret = get_params();
if (ret < 0)
@@ -1583,12 +1585,14 @@ void RGWCompleteMultipart::execute()
attrs[RGW_ATTR_ETAG] = etag_bl;
target_obj.init(s->bucket, s->object_str);
-
+
for (obj_iter = obj_parts.begin(); obj_iter != obj_parts.end(); ++obj_iter) {
string oid = mp.get_part(obj_iter->second.num);
rgw_obj src_obj;
src_obj.init_ns(s->bucket, oid, mp_ns);
+ unlink_parts.push_back(src_obj.object);
+
RGWObjManifestPart& part = manifest.objs[ofs];
part.loc = src_obj;
@@ -1609,7 +1613,14 @@ void RGWCompleteMultipart::execute()
// remove the upload obj
meta_obj.init_ns(s->bucket, meta_oid, mp_ns);
- rgwstore->delete_obj(s->obj_ctx, meta_obj);
+ r = rgwstore->remove_objs_from_index(s->bucket, unlink_parts);
+ if (r < 0) {
+ ldout(s->cct, 0) << "WARNING: remove_objs_from_index() failed r=" << r << dendl;
+ }
+ r = rgwstore->delete_obj(s->obj_ctx, meta_obj);
+ if (r < 0) {
+ ldout(s->cct, 0) << "WARNING: failed to remove object r=" << r << dendl;
+ }
done:
send_response();