-
Notifications
You must be signed in to change notification settings - Fork 6.3k
RGW: pubsub publish commit with etag populated #54569
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6591,9 +6591,6 @@ void RGWCompleteMultipart::execute(optional_yield y) | |
| RGWMultiCompleteUpload *parts; | ||
| RGWMultiXMLParser parser; | ||
| std::unique_ptr<rgw::sal::MultipartUpload> upload; | ||
| off_t ofs = 0; | ||
| std::unique_ptr<rgw::sal::Object> meta_obj; | ||
| std::unique_ptr<rgw::sal::Object> target_obj; | ||
| uint64_t olh_epoch = 0; | ||
|
|
||
| op_ret = get_params(y); | ||
|
|
@@ -6682,8 +6679,8 @@ void RGWCompleteMultipart::execute(optional_yield y) | |
|
|
||
|
|
||
| // make reservation for notification if needed | ||
| std::unique_ptr<rgw::sal::Notification> res | ||
| = driver->get_notification(meta_obj.get(), nullptr, s, rgw::notify::ObjectCreatedCompleteMultipartUpload, y, &s->object->get_name()); | ||
| res = driver->get_notification(meta_obj.get(), nullptr, s, rgw::notify::ObjectCreatedCompleteMultipartUpload, y, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it seems wrong for the Notification to point at the meta_obj rather than the target_obj. that's probably why you were seeing lifetime issues around it? |
||
| &s->object->get_name()); | ||
| op_ret = res->publish_reserve(this); | ||
| if (op_ret < 0) { | ||
| return; | ||
|
|
@@ -6706,21 +6703,10 @@ void RGWCompleteMultipart::execute(optional_yield y) | |
| return; | ||
| } | ||
|
|
||
| // remove the upload meta object ; the meta object is not versioned | ||
| // when the bucket is, as that would add an unneeded delete marker | ||
| int r = meta_obj->delete_object(this, y, true /* prevent versioning */); | ||
|
Comment on lines
-6709
to
-6711
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. before this moved to |
||
| if (r >= 0) { | ||
| /* serializer's exclusive lock is released */ | ||
| serializer->clear_locked(); | ||
| } else { | ||
| ldpp_dout(this, 0) << "WARNING: failed to remove object " << meta_obj << dendl; | ||
| } | ||
|
|
||
| // send request to notification manager | ||
| int ret = res->publish_commit(this, ofs, upload->get_mtime(), etag, target_obj->get_instance()); | ||
| 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 | ||
| upload_time = upload->get_mtime(); | ||
| int r = serializer->unlock(); | ||
| if (r < 0) { | ||
|
Comment on lines
+6707
to
+6708
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this |
||
| ldpp_dout(this, 0) << "WARNING: failed to unlock " << *serializer.get() << dendl; | ||
| } | ||
| } // RGWCompleteMultipart::execute | ||
|
|
||
|
|
@@ -6773,7 +6759,42 @@ void RGWCompleteMultipart::complete() | |
| } | ||
| } | ||
|
|
||
| etag = s->object->get_attrs()[RGW_ATTR_ETAG].to_str(); | ||
| if (op_ret >= 0 && target_obj.get() != nullptr) { | ||
| s->object->set_attrs(target_obj->get_attrs()); | ||
| etag = s->object->get_attrs()[RGW_ATTR_ETAG].to_str(); | ||
| // send request to notification manager | ||
| if (res.get() != nullptr) { | ||
| int ret = res->publish_commit(this, ofs, upload_time, etag, target_obj->get_instance()); | ||
| 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 | ||
| } | ||
| } else { | ||
| ldpp_dout(this, 1) << "ERROR: reservation is null" << dendl; | ||
| } | ||
| } else { | ||
| ldpp_dout(this, 1) << "ERROR: either op_ret is negative (execute failed) or target_obj is null, op_ret: " | ||
| << op_ret << dendl; | ||
| } | ||
AliMasarweh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| // remove the upload meta object ; the meta object is not versioned | ||
| // when the bucket is, as that would add an unneeded delete marker | ||
| // moved to complete to prevent segmentation fault in publish commit | ||
| if (meta_obj.get() != nullptr) { | ||
| int ret = meta_obj->delete_object(this, null_yield, true /* prevent versioning */); | ||
| if (ret >= 0) { | ||
| /* serializer's exclusive lock is released */ | ||
| serializer->clear_locked(); | ||
| } else { | ||
| ldpp_dout(this, 0) << "WARNING: failed to remove object " << meta_obj << ", ret: " << ret << dendl; | ||
| } | ||
| } else { | ||
| ldpp_dout(this, 0) << "WARNING: meta_obj is null" << dendl; | ||
| } | ||
|
|
||
| res.reset(); | ||
| meta_obj.reset(); | ||
| target_obj.reset(); | ||
|
|
||
| send_response(); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cbodley can you please see if this change has other implication?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's hard to tell. are we mutating the attrs? if not these should be const-refs instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes we are mutating the attrs at line 2544: