From: Yuval Lifshitz Date: Wed, 22 Jul 2020 09:21:20 +0000 (+0300) Subject: rgw/notification: fix merge issues from zipper6 X-Git-Tag: v16.1.0~1633^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d225645b846bcc243d9721dd4d31b04bff42c111;p=ceph.git rgw/notification: fix merge issues from zipper6 see commit: e51d0e092dd23967c039e26ee06f1ed62eae4d11 Signed-off-by: Yuval Lifshitz --- diff --git a/src/rgw/rgw_notify.cc b/src/rgw/rgw_notify.cc index 05b576ad3cc..0df44ef547d 100644 --- a/src/rgw/rgw_notify.cc +++ b/src/rgw/rgw_notify.cc @@ -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; } diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 94af5e077b1..9d4a7f42af7 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -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;