From e504003aad776eff595551e761be065838286731 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Thu, 5 Feb 2015 18:18:23 -0800 Subject: [PATCH] rgw: remove multipart entries for bucket index when aborting 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 --- src/rgw/rgw_op.cc | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index bd3e07bb66abb..97ed41b25b795 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -3107,6 +3107,7 @@ void RGWAbortMultipart::execute() meta_obj.index_hash_source = s->object.name; cls_rgw_obj_chain chain; + list 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; } -- 2.47.3