Fixes: https://tracker.ceph.com/issues/51261
Signed-off-by: Yuval Lifshitz <ylifshit@redhat.com>
(cherry picked from commit
93b9f0fb77ca5ed0b5c89d45229732850e0a0c49)
Conflicts:
src/rgw/rgw_notify.h
src/rgw/rgw_op.cc
src/rgw/rgw_sal.h
src/rgw/rgw_sal_rados.cc
src/rgw/rgw_sal_rados.h
src/test/rgw/bucket_notification/test_bn.py
Cherry-pick notes:
- differences due to renaming of rgw::sal::RGWObject to rgw::sal::Object
- differences due to use of RadosNotification in master and reservation_t in Pacific
event.bucket_name = s->bucket_name;
event.bucket_ownerIdentity = s->bucket_owner.get_id().id;
event.bucket_arn = to_string(rgw::ARN(s->bucket->get_key()));
- event.object_key = obj->get_name();
+ event.object_key = res.object_name ? *res.object_name : obj->get_name();
event.object_size = size;
event.object_etag = etag;
event.object_versionId = obj->get_instance();
return false;
}
const auto obj = res.object;
- if (!match(filter.s3_filter.key_filter, obj->get_name())) {
+ if (!match(filter.s3_filter.key_filter,
+ res.object_name ? *res.object_name : obj->get_name())) {
return false;
}
const req_state* const s;
size_t size;
rgw::sal::RGWObject* const object;
+ const std::string* const object_name;
KeyValueMap cached_metadata;
- reservation_t(const DoutPrefixProvider *_dpp, rgw::sal::RGWRadosStore* _store, const req_state* _s, rgw::sal::RGWObject* _object) :
- dpp(_dpp), store(_store), s(_s), object(_object) {}
+ reservation_t(const DoutPrefixProvider *_dpp, rgw::sal::RGWRadosStore* _store, const req_state* _s,
+ rgw::sal::RGWObject* _object, const std::string* _object_name=nullptr) :
+ dpp(_dpp), store(_store), s(_s), object(_object), object_name(_object_name) {}
// dtor doing resource leak guarding
// aborting the reservation if not already committed or aborted
mp.init(s->object->get_name(), upload_id);
- // make reservation for notification if needed
- rgw::notify::reservation_t res(this, store, s, s->object.get());
- const auto event_type = rgw::notify::ObjectCreatedCompleteMultipartUpload;
- op_ret = rgw::notify::publish_reserve(this, event_type, res, nullptr);
- if (op_ret < 0) {
- return;
- }
-
meta_oid = mp.get_meta();
int total_parts = 0;
}
attrs = meta_obj->get_attrs();
+ // make reservation for notification if needed
+ rgw::notify::reservation_t res(this, store, s, meta_obj.get(), &s->object->get_name());
+ const auto event_type = rgw::notify::ObjectCreatedCompleteMultipartUpload;
+ op_ret = rgw::notify::publish_reserve(this, event_type, res, nullptr);
+ if (op_ret < 0) {
+ return;
+ }
+
do {
op_ret = list_multipart_parts(this, store, s, upload_id, meta_oid, max_parts,
marker, obj_parts, &marker, &truncated);