]> git.apps.os.sepia.ceph.com Git - ceph-ci.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>
Fri, 3 May 2024 19:48:11 +0000 (15:48 -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>
src/rgw/rgw_op.cc
src/rgw/rgw_op.h

index 6a3fe11c7278728645ac975157ce19a4f8869251..0bc29a3707b5c38076d1c1743b073158d925e3c2 100644 (file)
@@ -6388,18 +6388,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;
@@ -6461,12 +6460,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
@@ -6474,9 +6472,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
@@ -6496,7 +6491,6 @@ void RGWCompleteMultipart::complete()
 
   res.reset();
   meta_obj.reset();
-  target_obj.reset();
 
   send_response();
 }
index c43ce02483590adf9ee7605eb6b3cb2ee0ea4b38..f826d3d139d622da643f37cfd4c70b6670ae25a2 100644 (file)
@@ -1871,7 +1871,6 @@ protected:
   std::unique_ptr<rgw::sal::MPSerializer> serializer;
   jspan_ptr 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;