From: J. Eric Ivancich Date: Thu, 3 Jun 2021 13:00:09 +0000 (-0400) Subject: rgw: completion of multipart upload leaves delete marker X-Git-Tag: v17.1.0~1706^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9ab7c18c4039f7b7283da3182807641d99b01ca7;p=ceph.git rgw: completion of multipart upload leaves delete marker The multipart upload meta object is deleted when the multipart upload is completed. When the bucket is versioned, it needs to be deleted from the bucket index rather than go through versioning delete process that adds a delete marker to the bucket index rather than simply removing it from the bucket index. Signed-off-by: J. Eric Ivancich --- diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index ccd7bedfd437..c3752eabd8b4 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -6112,8 +6112,9 @@ void RGWCompleteMultipart::execute(optional_yield y) if (op_ret < 0) return; - // remove the upload obj - int r = meta_obj->delete_object(this, s->obj_ctx, y); + // remove the upload meta object ; the meta object is not versioned + // when the bucket is, as that would add an unneeded delete marker + int r = meta_obj->delete_object(this, s->obj_ctx, y, true /* prevent versioning */); if (r >= 0) { /* serializer's exclusive lock is released */ serializer->clear_locked(); @@ -6127,7 +6128,7 @@ void RGWCompleteMultipart::execute(optional_yield y) ldpp_dout(this, 1) << "ERROR: publishing notification failed, with error: " << ret << dendl; // too late to rollback operation, hence op_ret is not set here } -} +} // RGWCompleteMultipart::execute bool RGWCompleteMultipart::check_previously_completed(const RGWMultiCompleteUpload* parts) { diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 7acff692131e..b198b4c167e4 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -5214,7 +5214,7 @@ int RGWRados::delete_obj(const DoutPrefixProvider *dpp, RGWObjectCtx& obj_ctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj, - int versioning_status, + int versioning_status, // versioning flags defined in enum RGWBucketFlags uint16_t bilog_flags, const real_time& expiration_time, rgw_zone_set *zones_trace) diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index 6b695899f56c..9862ae66a548 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -826,8 +826,8 @@ public: struct DeleteParams { rgw_user bucket_owner; - int versioning_status; - ACLOwner obj_owner; /* needed for creation of deletion marker */ + int versioning_status; // versioning flags defined in enum RGWBucketFlags + ACLOwner obj_owner; // needed for creation of deletion marker uint64_t olh_epoch; string marker_version_id; uint32_t bilog_flags; @@ -1216,7 +1216,7 @@ public: RGWObjectCtx& obj_ctx, const RGWBucketInfo& bucket_owner, const rgw_obj& src_obj, - int versioning_status, + int versioning_status, // versioning flags defined in enum RGWBucketFlags uint16_t bilog_flags = 0, const ceph::real_time& expiration_time = ceph::real_time(), rgw_zone_set *zones_trace = nullptr); diff --git a/src/rgw/rgw_sal.h b/src/rgw/rgw_sal.h index 5686ff5b337d..52b5aaecf91a 100644 --- a/src/rgw/rgw_sal.h +++ b/src/rgw/rgw_sal.h @@ -643,7 +643,10 @@ class Object { virtual ~Object() = default; - virtual int delete_object(const DoutPrefixProvider* dpp, RGWObjectCtx* obj_ctx, optional_yield y) = 0; + virtual int delete_object(const DoutPrefixProvider* dpp, + RGWObjectCtx* obj_ctx, + optional_yield y, + bool prevent_versioning = false) = 0; virtual int delete_obj_aio(const DoutPrefixProvider* dpp, RGWObjState* astate, Completions* aio, bool keep_index_consistent, optional_yield y) = 0; virtual int copy_object(RGWObjectCtx& obj_ctx, User* user, diff --git a/src/rgw/rgw_sal_rados.cc b/src/rgw/rgw_sal_rados.cc index 2c6f66121d9e..c77fee75a618 100644 --- a/src/rgw/rgw_sal_rados.cc +++ b/src/rgw/rgw_sal_rados.cc @@ -1574,13 +1574,16 @@ int RadosObject::RadosDeleteOp::delete_obj(const DoutPrefixProvider* dpp, option return ret; } -int RadosObject::delete_object(const DoutPrefixProvider* dpp, RGWObjectCtx* obj_ctx, optional_yield y) +int RadosObject::delete_object(const DoutPrefixProvider* dpp, + RGWObjectCtx* obj_ctx, + optional_yield y, + bool prevent_versioning) { RGWRados::Object del_target(store->getRados(), bucket->get_info(), *obj_ctx, get_obj()); RGWRados::Object::Delete del_op(&del_target); del_op.params.bucket_owner = bucket->get_info().owner; - del_op.params.versioning_status = bucket->get_info().versioning_status(); + del_op.params.versioning_status = prevent_versioning ? 0 : bucket->get_info().versioning_status(); return del_op.delete_obj(y, dpp); } diff --git a/src/rgw/rgw_sal_rados.h b/src/rgw/rgw_sal_rados.h index 8f8edaa1e02b..34aaefd8361d 100644 --- a/src/rgw/rgw_sal_rados.h +++ b/src/rgw/rgw_sal_rados.h @@ -151,7 +151,8 @@ class RadosObject : public Object { } RadosObject(RadosObject& _o) = default; - virtual int delete_object(const DoutPrefixProvider* dpp, RGWObjectCtx* obj_ctx, optional_yield y) override; + virtual int delete_object(const DoutPrefixProvider* dpp, RGWObjectCtx* obj_ctx, + optional_yield y, bool prevent_versioning) override; virtual int delete_obj_aio(const DoutPrefixProvider* dpp, RGWObjState* astate, Completions* aio, bool keep_index_consistent, optional_yield y) override; virtual int copy_object(RGWObjectCtx& obj_ctx, User* user,