diff options
author | kchheda3 <kchheda3@bloomberg.net> | 2024-02-27 20:06:47 +0100 |
---|---|---|
committer | kchheda3 <kchheda3@bloomberg.net> | 2024-03-14 21:09:23 +0100 |
commit | ea6611327c9aa678c524e0d71e954bd735d60789 (patch) | |
tree | 31493c63ed2167b87d3b44b2375617bfd4b116e2 /src/rgw/driver/rados/rgw_cr_rados.cc | |
parent | Merge pull request #56077 from idryomov/wip-rbd-mirror-bash (diff) | |
download | ceph-ea6611327c9aa678c524e0d71e954bd735d60789.tar.xz ceph-ea6611327c9aa678c524e0d71e954bd735d60789.zip |
rgw/notification: Make the Lifecycle events AWS compatible
Signed-off-by: kchheda3 <kchheda3@bloomberg.net>
Diffstat (limited to 'src/rgw/driver/rados/rgw_cr_rados.cc')
-rw-r--r-- | src/rgw/driver/rados/rgw_cr_rados.cc | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/src/rgw/driver/rados/rgw_cr_rados.cc b/src/rgw/driver/rados/rgw_cr_rados.cc index fb5722528c3..a6d4719e718 100644 --- a/src/rgw/driver/rados/rgw_cr_rados.cc +++ b/src/rgw/driver/rados/rgw_cr_rados.cc @@ -787,40 +787,52 @@ int RGWAsyncFetchRemoteObj::_send_request(const DoutPrefixProvider *dpp) // send notification that object was successfully synced std::string user_id = "rgw sync"; std::string req_id = "0"; - + RGWObjTags obj_tags; auto iter = attrs.find(RGW_ATTR_TAGS); if (iter != attrs.end()) { try { auto it = iter->second.cbegin(); obj_tags.decode(it); - } catch (buffer::error &err) { - ldpp_dout(dpp, 1) << "ERROR: " << __func__ << ": caught buffer::error couldn't decode TagSet " << dendl; + } catch (buffer::error& err) { + ldpp_dout(dpp, 1) + << "ERROR: " << __func__ + << ": caught buffer::error couldn't decode TagSet " << dendl; } } - // NOTE: we create a mutable copy of bucket.get_tenant as the get_notification function expects a std::string&, not const + // NOTE: we create a mutable copy of bucket.get_tenant as the + // get_notification function expects a std::string&, not const std::string tenant(dest_bucket.get_tenant()); - std::unique_ptr<rgw::sal::Notification> notify - = store->get_notification(dpp, &dest_obj, nullptr, rgw::notify::ObjectSyncedCreate, - &dest_bucket, user_id, - tenant, - req_id, null_yield); - - auto notify_res = static_cast<rgw::sal::RadosNotification*>(notify.get())->get_reservation(); - int ret = rgw::notify::publish_reserve(dpp, *store->svc()->site, rgw::notify::ObjectSyncedCreate, notify_res, &obj_tags); + std::unique_ptr<rgw::sal::Notification> notify = + store->get_notification( + dpp, &dest_obj, nullptr, {rgw::notify::ObjectSyncedCreate}, + &dest_bucket, user_id, tenant, req_id, null_yield); + + auto notify_res = + static_cast<rgw::sal::RadosNotification*>(notify.get()) + ->get_reservation(); + int ret = rgw::notify::publish_reserve( + dpp, *store->svc()->site, {rgw::notify::ObjectSyncedCreate}, + notify_res, &obj_tags); if (ret < 0) { - ldpp_dout(dpp, 1) << "ERROR: reserving notification failed, with error: " << ret << dendl; + ldpp_dout(dpp, 1) + << "ERROR: reserving notification failed, with error: " << ret + << dendl; // no need to return, the sync already happened } else { - ret = rgw::notify::publish_commit(&dest_obj, *bytes_transferred, ceph::real_clock::now(), etag, dest_obj.get_instance(), rgw::notify::ObjectSyncedCreate, notify_res, dpp); + ret = rgw::notify::publish_commit( + &dest_obj, *bytes_transferred, ceph::real_clock::now(), etag, + dest_obj.get_instance(), notify_res, dpp); if (ret < 0) { - ldpp_dout(dpp, 1) << "ERROR: publishing notification failed, with error: " << ret << dendl; + ldpp_dout(dpp, 1) + << "ERROR: publishing notification failed, with error: " << ret + << dendl; } } } - + if (counters) { if (bytes_transferred) { counters->inc(sync_counters::l_fetch, *bytes_transferred); |