]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: completion of multipart upload leaves delete marker 41678/head
authorJ. Eric Ivancich <ivancich@redhat.com>
Thu, 3 Jun 2021 13:00:09 +0000 (09:00 -0400)
committerJ. Eric Ivancich <ivancich@redhat.com>
Thu, 3 Jun 2021 13:24:26 +0000 (09:24 -0400)
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 <ivancich@redhat.com>
src/rgw/rgw_op.cc
src/rgw/rgw_rados.cc
src/rgw/rgw_rados.h
src/rgw/rgw_sal.h
src/rgw/rgw_sal_rados.cc
src/rgw/rgw_sal_rados.h

index ccd7bedfd437ab65538cbcc3fb0c05e3f64e53a5..c3752eabd8b4bee57e3f3da3052100e2233eceec 100644 (file)
@@ -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)
 {
index 7acff692131e24d4f15404857b30acea1a6ed71f..b198b4c167e43829d8f4cc69fe1539802a51173c 100644 (file)
@@ -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)
index 6b695899f56c9e17aee40cbd697ddfdf4ddc3134..9862ae66a5486116377a68a35db656b2fd83237c 100644 (file)
@@ -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);
index 5686ff5b337d03d038a66959f97eb310c9918030..52b5aaecf91a23c99e7175e04897ed3b1ea15d09 100644 (file)
@@ -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,
index 2c6f66121d9e5af5ee81f91c1dcb950e890cc888..c77fee75a6189e2f7586f2e4766091627234d0a0 100644 (file)
@@ -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);
 }
index 8f8edaa1e02bee55cf8d2ccb84410c4e6c6bfb75..34aaefd8361de32ae143cbd7b74ed461dbca95a1 100644 (file)
@@ -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,