]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/notifications: Changing the Multipart Upload notification behavior 42350/head
authorKalpesh Pandya <kapandya@redhat.com>
Wed, 14 Jul 2021 08:38:42 +0000 (14:08 +0530)
committerKalpesh Pandya <kapandya@redhat.com>
Mon, 26 Jul 2021 15:52:33 +0000 (21:22 +0530)
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 <kapandya@redhat.com>
PendingReleaseNotes
doc/radosgw/s3-notification-compatibility.rst
src/rgw/rgw_op.cc
src/test/rgw/bucket_notification/test_bn.py

index 8d71887b7e436c5991886104dfaa619e090554d0..855e71283b5358b0afcbef55a2cf8e179a9fa4b3 100644 (file)
   If you want to return back the old behavior add 'ssl_options=' (empty) to
   ``rgw frontends`` configuration.
 
+* 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.
+
 >=16.0.0
 --------
 * mgr/nfs: ``nfs`` module is moved out of volumes plugin. Prior using the
index 008c33a59bd8a64490734ac6df26152d46a802e0..09054bed39245a87d20ac5eed064d1a4a05eb8ed 100644 (file)
@@ -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`_. 
index 583181152c7d7f73d766cbc9d72b363ca53a8203..d6366c8f611c467efde2de6e6f20114464beb4df 100644 (file)
@@ -3810,9 +3810,11 @@ void RGWPutObj::execute(optional_yield y)
   // make reservation for notification if needed
   std::unique_ptr<rgw::sal::Notification> res = store->get_notification(s->object.get(),
                                                s, rgw::notify::ObjectCreatedPut);
-  op_ret = res->publish_reserve(this, obj_tags.get());
-  if (op_ret < 0) {
-    return;
+  if(!multipart) {
+    op_ret = res->publish_reserve(this, obj_tags.get());
+    if (op_ret < 0) {
+      return;
+    }
   }
 
   // create the object processor
@@ -5994,14 +5996,6 @@ void RGWInitMultipart::execute(optional_yield y)
     return;
   }
 
-  // make reservation for notification if needed
-  std::unique_ptr<rgw::sal::Notification> res = store->get_notification(s->object.get(),
-                               s, rgw::notify::ObjectCreatedPost);
-  op_ret = res->publish_reserve(this);
-  if (op_ret < 0) {
-    return;
-  }
-
   do {
     char buf[33];
     std::unique_ptr<rgw::sal::Object> obj;
@@ -6039,12 +6033,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
-  int ret = res->publish_commit(this, s->obj_size, ceph::real_clock::now(), attrs[RGW_ATTR_ETAG].to_str(), "");
-  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)
index 2a5d305bc59bf137dca0df11d17e39ade67ccfa3..ac72b1c2bc16b370cc4b45af7bdd992759b8edab 100644 (file)
@@ -1406,7 +1406,7 @@ def ps_s3_creation_triggers_on_master(external_endpoint_address=None, ca_locatio
     # create s3 notification
     notification_name = bucket_name + NOTIFICATION_SUFFIX
     topic_conf_list = [{'Id': notification_name,'TopicArn': topic_arn,
-                        'Events': ['s3:ObjectCreated:Put', 's3:ObjectCreated:Copy']
+                        'Events': ['s3:ObjectCreated:Put', 's3:ObjectCreated:Copy', 's3:ObjectCreated:CompleteMultipartUpload']
                        }]
 
     s3_notification_conf = PSNotificationS3(conn, bucket_name, topic_conf_list)
@@ -1661,12 +1661,10 @@ def test_ps_s3_multipart_on_master():
 
     # check amqp receiver
     events = receiver1.get_and_reset_events()
-    assert_equal(len(events), 3)
+    assert_equal(len(events), 1)
 
     events = receiver2.get_and_reset_events()
-    assert_equal(len(events), 1)
-    assert_equal(events[0]['Records'][0]['eventName'], 'ObjectCreated:Post')
-    assert_equal(events[0]['Records'][0]['s3']['configurationId'], notification_name+'_2')
+    assert_equal(len(events), 0)
 
     events = receiver3.get_and_reset_events()
     assert_equal(len(events), 1)
@@ -1769,7 +1767,7 @@ def test_ps_s3_metadata_on_master():
     time.sleep(5)
     # check amqp receiver
     events = receiver.get_and_reset_events()
-    assert_equal(len(events), 4) # PUT, COPY, Multipart start, Multipart End
+    assert_equal(len(events), 3) # PUT, COPY, Multipart start, Multipart End
     for event in events:
         assert(event['Records'][0]['s3']['object']['key'] in expected_keys)