]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: CompleteMultipart uses s->object instead of target_obj
authorCasey Bodley <cbodley@redhat.com>
Fri, 3 May 2024 19:17:48 +0000 (15:17 -0400)
committerCasey Bodley <cbodley@redhat.com>
Thu, 8 Aug 2024 20:46:17 +0000 (16:46 -0400)
most requests operate directly on s->object. there's no reason to
allocate a separate target_obj for the same purpose

Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit d09b8ab2e077ceb6a0c6dfb99ce1b45d63a28be4)

src/rgw/rgw_op.cc
src/rgw/rgw_op.h

index 033d4c8bb63f69686cfecd8c831b5c25fd13c9d0..94ce681f5e0041dbb3b3ddca92f95ba25043938a 100644 (file)
@@ -6554,18 +6554,17 @@ void RGWCompleteMultipart::execute(optional_yield y)
     return;
   }
 
-  target_obj = s->bucket->get_object(rgw_obj_key(s->object->get_name()));
   if (s->bucket->versioning_enabled()) {
     if (!version_id.empty()) {
-      target_obj->set_instance(version_id);
+      s->object->set_instance(version_id);
     } else {
-      target_obj->gen_rand_obj_instance_name();
-      version_id = target_obj->get_instance();
+      s->object->gen_rand_obj_instance_name();
+      version_id = s->object->get_instance();
     }
   }
-  target_obj->set_attrs(meta_obj->get_attrs());
+  s->object->set_attrs(meta_obj->get_attrs());
 
-  op_ret = upload->complete(this, y, s->cct, parts->parts, remove_objs, accounted_size, compressed, cs_info, ofs, s->req_id, s->owner, olh_epoch, target_obj.get());
+  op_ret = upload->complete(this, y, s->cct, parts->parts, remove_objs, accounted_size, compressed, cs_info, ofs, s->req_id, s->owner, olh_epoch, s->object.get());
   if (op_ret < 0) {
     ldpp_dout(this, 0) << "ERROR: upload complete failed ret=" << op_ret << dendl;
     return;
@@ -6627,12 +6626,11 @@ void RGWCompleteMultipart::complete()
     }
   }
 
-  if (op_ret >= 0 && target_obj.get() != nullptr) {
-    s->object->set_attrs(target_obj->get_attrs());
+  if (op_ret >= 0) {
     etag = s->object->get_attrs()[RGW_ATTR_ETAG].to_str();
     // send request to notification manager
     if (res.get() != nullptr) {
-      int ret = res->publish_commit(this, ofs, upload_time, etag, target_obj->get_instance());
+      int ret = res->publish_commit(this, ofs, upload_time, etag, s->object->get_instance());
       if (ret < 0) {
         ldpp_dout(this, 1) << "ERROR: publishing notification failed, with error: " << ret << dendl;
         // too late to rollback operation, hence op_ret is not set here
@@ -6640,9 +6638,6 @@ void RGWCompleteMultipart::complete()
     } else {
       ldpp_dout(this, 1) << "ERROR: reservation is null" << dendl;
     }
-  } else {
-    ldpp_dout(this, 1) << "ERROR: either op_ret is negative (execute failed) or target_obj is null, op_ret: "
-                       << op_ret << dendl;
   }
 
   // remove the upload meta object ; the meta object is not versioned
@@ -6662,7 +6657,6 @@ void RGWCompleteMultipart::complete()
 
   res.reset();
   meta_obj.reset();
-  target_obj.reset();
 
   send_response();
 }
index 2bffcddcc8c462eb10b02462dddb0fd9c699a78d..d2135d68bea903642de2ecb9dcc391d3210aa64e 100644 (file)
@@ -1877,7 +1877,6 @@ protected:
   std::unique_ptr<rgw::sal::MPSerializer> serializer;
   jspan multipart_trace;
   ceph::real_time upload_time;
-  std::unique_ptr<rgw::sal::Object> target_obj;
   std::unique_ptr<rgw::sal::Notification> res;
   std::unique_ptr<rgw::sal::Object> meta_obj;
   off_t ofs = 0;