From: Kalpesh Pandya Date: Wed, 14 Jul 2021 08:38:42 +0000 (+0530) Subject: rgw/notifications: Changing the Multipart Upload notification behavior X-Git-Tag: v16.2.11~404^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=24bafc6bf6e5936ecd5781dda24ac12b34d72eaa;p=ceph.git rgw/notifications: Changing the Multipart Upload notification behavior Changing the notification behavior in case of Multipart Upload, updating the related test cases and adding the documentation changes for the same. Signed-off-by: Kalpesh Pandya (cherry picked from commit 3be2b4bcc5686a5ff5e348dba2deda444d336bb8) Conflicts: src/rgw/rgw_op.cc src/test/rgw/bucket_notification/test_bn.py (pacific does not have test_bn.py) --- diff --git a/PendingReleaseNotes b/PendingReleaseNotes index 1ff5d73ba64..ca705eefc8e 100644 --- a/PendingReleaseNotes +++ b/PendingReleaseNotes @@ -35,6 +35,11 @@ >=16.2.8 -------- +* RGW: The behavior for Multipart Upload was modified so that only + CompleteMultipartUpload notification is sent at the end of the multipart upload. + The POST notification at the beginning of the upload, and PUT notifications that + were sent on each part are not sent anymore. + * MON/MGR: Pools can now be created with `--bulk` flag. Any pools created with `bulk` will use a profile of the `pg_autoscaler` that provides more performance from the start. However, any pools created without the `--bulk` flag will remain using it's old behavior diff --git a/doc/radosgw/s3-notification-compatibility.rst b/doc/radosgw/s3-notification-compatibility.rst index 008c33a59bd..09054bed392 100644 --- a/doc/radosgw/s3-notification-compatibility.rst +++ b/doc/radosgw/s3-notification-compatibility.rst @@ -109,6 +109,10 @@ Event Types The ``s3:ObjectRemoved:DeleteMarkerCreated`` event presents information on the latest version of the object +.. note:: + + In case of multipart upload, an ``ObjectCreated:CompleteMultipartUpload`` notification will be sent at the end of the process. + Topic Configuration ------------------- In the case of bucket notifications, the topics management API will be derived from `AWS Simple Notification Service API`_. diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 1b844fa5ec8..6ebc8dc8903 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -3826,9 +3826,11 @@ void RGWPutObj::execute(optional_yield y) // make reservation for notification if needed rgw::notify::reservation_t res(this, store, s, s->object.get()); const auto event_type = rgw::notify::ObjectCreatedPut; - op_ret = rgw::notify::publish_reserve(this, event_type, res, obj_tags.get()); - if (op_ret < 0) { - return; + if(!multipart) { + op_ret = rgw::notify::publish_reserve(this, event_type, res, obj_tags.get()); + if (op_ret < 0) { + return; + } } // create the object processor @@ -6024,14 +6026,6 @@ void RGWInitMultipart::execute(optional_yield y) return; } - // make reservation for notification if needed - rgw::notify::reservation_t res(this, store, s, s->object.get()); - const auto event_type = rgw::notify::ObjectCreatedPost; - op_ret = rgw::notify::publish_reserve(this, event_type, res, nullptr); - if (op_ret < 0) { - return; - } - do { char buf[33]; std::unique_ptr obj; @@ -6068,13 +6062,6 @@ void RGWInitMultipart::execute(optional_yield y) op_ret = obj_op->write_meta(this, bl.length(), 0, s->yield); } while (op_ret == -EEXIST); - - // send request to notification manager - const auto ret = rgw::notify::publish_commit(s->object.get(), s->obj_size, ceph::real_clock::now(), attrs[RGW_ATTR_ETAG].to_str(), event_type, res, this); - 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 - } } int RGWCompleteMultipart::verify_permission(optional_yield y)