Merge pull request #36238 from yuvalif/fix_zippet_notif_merge

rgw/notification: fix merge issues from zipper6
This commit is contained in:
Yuval Lifshitz 2020-07-24 14:46:55 +03:00 committed by GitHub
commit 4f6745cb24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 15 deletions

View 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;
}

View File

@ -4871,19 +4871,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;
}
}
@ -6557,7 +6557,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;