]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: unlink multipart upload parts when completing upload
authorYehuda Sadeh <yehuda@inktank.com>
Tue, 5 Feb 2013 22:59:51 +0000 (14:59 -0800)
committerYehuda Sadeh <yehuda@inktank.com>
Tue, 5 Feb 2013 23:52:41 +0000 (15:52 -0800)
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>
src/rgw/rgw_op.cc

index 40e496acc723d8c23771ceb14beab5c1841e9b66..652d0fd9ccb9a1088a0837204fe0f162078ba955 100644 (file)
@@ -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();