]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw/notification: fix merge issues from zipper6
authorYuval Lifshitz <ylifshit@redhat.com>
Wed, 22 Jul 2020 09:21:20 +0000 (12:21 +0300)
committerYuval Lifshitz <ylifshit@redhat.com>
Wed, 22 Jul 2020 09:21:20 +0000 (12:21 +0300)
see commit: e51d0e092dd23967c039e26ee06f1ed62eae4d11

Signed-off-by: Yuval Lifshitz <ylifshit@redhat.com>
src/rgw/rgw_notify.cc
src/rgw/rgw_op.cc

index 05b576ad3cca3ea004cd3ce176d7f0e9f8ccfae0..0df44ef547d3ba9c1d31981ed37c19c3c77959df 100644 (file)
@@ -46,11 +46,11 @@ void populate_record_from_request(const req_state *s,
   // opaque data will be filled from topic configuration
 }
 
-bool match(const rgw_pubsub_topic_filter& filter, const req_state* s, EventType event) {
+bool match(const rgw_pubsub_topic_filter& filter, const req_state* s, const rgw::sal::RGWObject* obj, EventType event) {
   if (!::match(filter.events, event)) { 
     return false;
   }
-  if (!::match(filter.s3_filter.key_filter, s->object->get_name())) {
+  if (!::match(filter.s3_filter.key_filter, obj->get_name())) {
     return false;
   }
   if (!::match(filter.s3_filter.metadata_filter, s->info.x_meta_map)) {
@@ -83,7 +83,7 @@ int publish(const req_state* s,
     for (const auto& bucket_topic : bucket_topics.topics) {
         const rgw_pubsub_topic_filter& topic_filter = bucket_topic.second;
         const rgw_pubsub_topic& topic_cfg = topic_filter.topic;
-        if (!match(topic_filter, s, event_type)) {
+        if (!match(topic_filter, s, obj, event_type)) {
             // topic does not apply to req_state
             continue;
         }
index 94af5e077b15ed6586fb46c52c48cece6f35fb9a..9d4a7f42af7e16e6143408e0af95cb2c5952d904 100644 (file)
@@ -4872,19 +4872,19 @@ void RGWDeleteObj::execute()
       ldpp_dout(this, 5) << "WARNING: failed to populate delete request with object tags: " << err.what() << dendl;
     }
     populate_metadata_in_request(s, attrs.attrs);
-  } else {
-    op_ret = -EINVAL;
-  }
-
-  s->object->set_obj_size(s->obj_size);
-  const auto ret = rgw::notify::publish(s, s->object.get(), ceph::real_clock::now(), attrs.attrs[RGW_ATTR_ETAG].to_str(),
+    const auto obj_state = obj_ctx->get_state(s->object->get_obj());
+    s->object->set_obj_size(obj_state->size);
+    const auto ret = rgw::notify::publish(s, s->object.get(), ceph::real_clock::now(), attrs.attrs[RGW_ATTR_ETAG].to_str(),
           delete_marker && s->object->get_instance().empty() ? rgw::notify::ObjectRemovedDeleteMarkerCreated : rgw::notify::ObjectRemovedDelete,
           store);
-  if (ret < 0) {
-    ldpp_dout(this, 5) << "WARNING: publishing notification failed, with error: " << ret << dendl;
-       // TODO: we should have conf to make send a blocking coroutine and reply with error in case sending failed
-       // this should be global conf (probably returnign a different handler)
-    // so we don't need to read the configured values before we perform it
+    if (ret < 0) {
+      ldpp_dout(this, 5) << "WARNING: publishing notification failed, with error: " << ret << dendl;
+           // TODO: we should have conf to make send a blocking coroutine and reply with error in case sending failed
+           // this should be global conf (probably returnign a different handler)
+      // so we don't need to read the configured values before we perform it
+    }
+  } else {
+    op_ret = -EINVAL;
   }
 }
 
@@ -6558,7 +6558,7 @@ void RGWDeleteMultiObj::execute()
     obj.set_obj_size(obj_state->size);
 
     const auto ret = rgw::notify::publish(s, &obj, ceph::real_clock::now(), etag,
-            del_op.result.delete_marker && s->object->get_instance().empty() ? rgw::notify::ObjectRemovedDeleteMarkerCreated : rgw::notify::ObjectRemovedDelete,
+            del_op.result.delete_marker && obj.get_instance().empty() ? rgw::notify::ObjectRemovedDeleteMarkerCreated : rgw::notify::ObjectRemovedDelete,
             store);
     if (ret < 0) {
         ldpp_dout(this, 5) << "WARNING: publishing notification failed, with error: " << ret << dendl;