diff options
author | Matt Benjamin <mbenjamin@redhat.com> | 2023-11-08 20:02:33 +0100 |
---|---|---|
committer | Matt Benjamin <mbenjamin@redhat.com> | 2024-01-04 21:23:27 +0100 |
commit | 9183de730967ab837a19130756e777a31e88b5ca (patch) | |
tree | 372fd217cf4401df8ae13e4a0cb92dee113f24e1 /src/rgw/rgw_lc.cc | |
parent | Merge pull request #49594 from Matan-B/wip-matanb-crimson-calc-subsets (diff) | |
download | ceph-9183de730967ab837a19130756e777a31e88b5ca.tar.xz ceph-9183de730967ab837a19130756e777a31e88b5ca.zip |
rgwlc: additional lc notify cleanups
Follow the same formula to build up obj_state and version_id
in all call sites.
Resolves: rhbz#2163667
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
Diffstat (limited to '')
-rw-r--r-- | src/rgw/rgw_lc.cc | 42 |
1 files changed, 26 insertions, 16 deletions
diff --git a/src/rgw/rgw_lc.cc b/src/rgw/rgw_lc.cc index f117aaa81f8..fec80339d0f 100644 --- a/src/rgw/rgw_lc.cc +++ b/src/rgw/rgw_lc.cc @@ -525,9 +525,6 @@ static int remove_expired_obj( auto& version_id = obj_key.instance; std::unique_ptr<rgw::sal::Notification> notify; - std::unique_ptr<rgw::sal::User> user; - user = driver->get_user(bucket_info.owner); - /* per discussion w/Daniel, Casey,and Eric, we *do need* * a new sal object handle, based on the following decision * to clear obj_key.instance--which happens in the case @@ -555,7 +552,7 @@ static int remove_expired_obj( del_op->params.unmod_since = meta.mtime; // notification supported only for RADOS driver for now - notify = driver->get_notification(dpp, oc.obj.get(), nullptr, event_type, + notify = driver->get_notification(dpp, obj.get(), nullptr, event_type, oc.bucket, lc_id, const_cast<std::string&>(oc.bucket->get_tenant()), lc_req_id, null_yield); @@ -834,18 +831,25 @@ int RGWLC::handle_multipart_expiration(rgw::sal::Bucket* target, int ret{0}; auto wt = boost::get<std::tuple<lc_op, rgw_bucket_dir_entry>>(wi); auto& [rule, obj] = wt; + if (obj_has_expired(this, cct, obj.meta.mtime, rule.mp_expiration)) { rgw_obj_key key(obj.key); - std::unique_ptr<rgw::sal::MultipartUpload> mpu = target->get_multipart_upload(key.name); - std::unique_ptr<rgw::sal::Object> sal_obj - = target->get_object(key); + auto mpu = target->get_multipart_upload(key.name); + auto sal_obj = target->get_object(key); + + RGWObjState* obj_state{nullptr}; + ret = sal_obj->get_obj_state(this, &obj_state, null_yield, true); + if (ret < 0) { + return ret; + } + std::unique_ptr<rgw::sal::Notification> notify = driver->get_notification( this, sal_obj.get(), nullptr, event_type, target, lc_id, const_cast<std::string&>(target->get_tenant()), lc_req_id, null_yield); - auto& version_id = obj.key.instance; + auto& version_id = obj.key.instance; ret = notify->publish_reserve(this, nullptr); if (ret < 0) { @@ -860,12 +864,13 @@ int RGWLC::handle_multipart_expiration(rgw::sal::Bucket* target, ret = mpu->abort(this, cct, null_yield); if (ret == 0) { int publish_ret = notify->publish_commit( - this, sal_obj->get_obj_size(), ceph::real_clock::now(), - sal_obj->get_attrs()[RGW_ATTR_ETAG].to_str(), - version_id); + this, obj_state->size, + ceph::real_clock::now(), + obj_state->attrset[RGW_ATTR_ETAG].to_str(), + version_id); if (publish_ret < 0) { ldpp_dout(wk->get_lc(), 5) - << "WARNING: notify publish_commit failed, with error: " << publish_ret + << "WARNING: notify publish_commit failed, with error: " << ret << dendl; } if (perfcounter) { @@ -1332,10 +1337,14 @@ public: /* notifications */ auto& bucket = oc.bucket; - std::string version_id; - auto& obj = oc.obj; + RGWObjState* obj_state{nullptr}; + ret = obj->get_obj_state(oc.dpp, &obj_state, null_yield, true); + if (ret < 0) { + return ret; + } + const auto event_type = (bucket->versioned() && oc.o.is_current() && !oc.o.is_delete_marker()) ? rgw::notify::ObjectTransitionCurrent : @@ -1347,6 +1356,7 @@ public: bucket, lc_id, const_cast<std::string&>(oc.bucket->get_tenant()), lc_req_id, null_yield); + auto& version_id = oc.o.key.instance; ret = notify->publish_reserve(oc.dpp, nullptr); if (ret < 0) { @@ -1365,9 +1375,9 @@ public: return ret; } else { // send request to notification manager - int publish_ret = notify->publish_commit(oc.dpp, obj->get_obj_size(), + int publish_ret = notify->publish_commit(oc.dpp, obj_state->size, ceph::real_clock::now(), - obj->get_attrs()[RGW_ATTR_ETAG].to_str(), + obj_state->attrset[RGW_ATTR_ETAG].to_str(), version_id); if (publish_ret < 0) { ldpp_dout(oc.dpp, 5) << |