]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: remove multipart entries for bucket index when aborting 3682/head
authorYehuda Sadeh <yehuda@redhat.com>
Fri, 6 Feb 2015 02:18:23 +0000 (18:18 -0800)
committerYehuda Sadeh <yehuda@redhat.com>
Tue, 10 Feb 2015 20:41:20 +0000 (12:41 -0800)
Fixes #10719

Since we now let the gc clean the aborter multipart uploads, we need to
clear the multipart entries from the bucket index when cleaning up the
meta object.

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_op.cc

index bd3e07bb66abbd4f1536b20add3fd31701092baf..97ed41b25b79534ad896705aa58e99c2e234dd41 100644 (file)
@@ -3107,6 +3107,7 @@ void RGWAbortMultipart::execute()
   meta_obj.index_hash_source = s->object.name;
 
   cls_rgw_obj_chain chain;
+  list<rgw_obj_key> remove_objs;
 
   do {
     ret = list_multipart_parts(store, s, upload_id, meta_oid, max_parts, marker, obj_parts, &marker, &truncated);
@@ -3126,6 +3127,13 @@ void RGWAbortMultipart::execute()
           return;
       } else {
         store->update_gc_chain(meta_obj, obj_part.manifest, &chain);
+        RGWObjManifest::obj_iterator oiter = obj_part.manifest.obj_begin();
+        if (oiter != obj_part.manifest.obj_end()) {
+          rgw_obj head = oiter.get_location();
+          rgw_obj_key key;
+          head.get_index_key(&key);
+          remove_objs.push_back(key);
+        }
       }
     }
   } while (truncated);
@@ -3137,8 +3145,17 @@ void RGWAbortMultipart::execute()
     return;
   }
 
+  RGWRados::Object del_target(store, s->bucket_info, *obj_ctx, meta_obj);
+  RGWRados::Object::Delete del_op(&del_target);
+
+  del_op.params.bucket_owner = s->bucket_info.owner;
+  del_op.params.versioning_status = 0;
+  if (!remove_objs.empty()) {
+    del_op.params.remove_objs = &remove_objs;
+  }
+
   // and also remove the metadata obj
-  ret = store->delete_obj(*obj_ctx, s->bucket_info, meta_obj, 0);
+  ret = del_op.delete_obj();
   if (ret == -ENOENT) {
     ret = -ERR_NO_SUCH_BUCKET;
   }