From: Casey Bodley Date: Fri, 5 Jul 2024 18:37:55 +0000 (-0400) Subject: rgw/sal: add dpp and optional_yield to lifecycle ops X-Git-Tag: v20.0.0~1268^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3f11eb905f9201f0a3daf6f15deb1166c877ee12;p=ceph.git rgw/sal: add dpp and optional_yield to lifecycle ops Signed-off-by: Casey Bodley --- diff --git a/src/rgw/driver/rados/rgw_bucket.cc b/src/rgw/driver/rados/rgw_bucket.cc index 996de5f3c4d8..94d3066e5b5a 100644 --- a/src/rgw/driver/rados/rgw_bucket.cc +++ b/src/rgw/driver/rados/rgw_bucket.cc @@ -2781,6 +2781,7 @@ public: class RGWMetadataHandlerPut_BucketInstance : public RGWMetadataHandlerPut_SObj { CephContext *cct; + optional_yield y; RGWBucketInstanceMetadataHandler *bihandler; RGWBucketInstanceMetadataObject *obj; public: @@ -2790,7 +2791,7 @@ public: RGWMetadataObject *_obj, RGWObjVersionTracker& objv_tracker, optional_yield y, RGWMDLogSyncType type, bool from_remote_zone) : RGWMetadataHandlerPut_SObj(_handler, _op, entry, _obj, objv_tracker, y, type, from_remote_zone), - cct(_cct), bihandler(_handler) { + cct(_cct), y(y), bihandler(_handler) { obj = static_cast(_obj); auto& bci = obj->get_bci(); @@ -2947,7 +2948,7 @@ int RGWMetadataHandlerPut_BucketInstance::put_post(const DoutPrefixProvider *dpp auto lc_it = bci.attrs.find(RGW_ATTR_LC); if (lc_it != bci.attrs.end()) { ldpp_dout(dpp, 20) << "set lc config for " << bci.info.bucket.name << dendl; - ret = lc->set_bucket_config(bucket.get(), bci.attrs, nullptr); + ret = lc->set_bucket_config(dpp, y, bucket.get(), bci.attrs, nullptr); if (ret < 0) { ldpp_dout(dpp, 0) << __func__ << " failed to set lc config for " << bci.info.bucket.name @@ -2957,7 +2958,7 @@ int RGWMetadataHandlerPut_BucketInstance::put_post(const DoutPrefixProvider *dpp } else { ldpp_dout(dpp, 20) << "remove lc config for " << bci.info.bucket.name << dendl; - ret = lc->remove_bucket_config(bucket.get(), bci.attrs, false /* cannot merge attrs */); + ret = lc->remove_bucket_config(dpp, y, bucket.get(), bci.attrs, false /* cannot merge attrs */); if (ret < 0) { ldpp_dout(dpp, 0) << __func__ << " failed to remove lc config for " << bci.info.bucket.name diff --git a/src/rgw/driver/rados/rgw_cr_tools.cc b/src/rgw/driver/rados/rgw_cr_tools.cc index a46ba1ac6e12..f9543b559354 100644 --- a/src/rgw/driver/rados/rgw_cr_tools.cc +++ b/src/rgw/driver/rados/rgw_cr_tools.cc @@ -115,7 +115,7 @@ int RGWBucketLifecycleConfigCR::Request::_send_request(const DoutPrefixProvider return -EIO; } - int ret = lc->set_bucket_config(params.bucket, + int ret = lc->set_bucket_config(dpp, null_yield, params.bucket, params.bucket_attrs, ¶ms.config); if (ret < 0) { diff --git a/src/rgw/driver/rados/rgw_sal_rados.cc b/src/rgw/driver/rados/rgw_sal_rados.cc index aa63743a2493..33e667ba974d 100644 --- a/src/rgw/driver/rados/rgw_sal_rados.cc +++ b/src/rgw/driver/rados/rgw_sal_rados.cc @@ -370,7 +370,7 @@ int RadosBucket::remove(const DoutPrefixProvider* dpp, if (get_attrs().count(RGW_ATTR_LC)) { constexpr bool merge_attrs = false; // don't update xattrs, we're deleting (void) store->getRados()->get_lc()->remove_bucket_config( - this, get_attrs(), merge_attrs); + dpp, y, this, get_attrs(), merge_attrs); } // remove bucket-topic mapping @@ -3604,7 +3604,8 @@ int LCRadosSerializer::try_lock(const DoutPrefixProvider *dpp, utime_t dur, opti return lock.lock_exclusive(ioctx, oid); } -int RadosLifecycle::get_entry(const std::string& oid, const std::string& marker, +int RadosLifecycle::get_entry(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, const std::string& marker, std::unique_ptr* entry) { cls_rgw_lc_entry cls_entry; @@ -3612,16 +3613,12 @@ int RadosLifecycle::get_entry(const std::string& oid, const std::string& marker, if (ret) return ret; - LCEntry* e; - e = new StoreLCEntry(cls_entry.bucket, cls_entry.start_time, cls_entry.status); - if (!e) - return -ENOMEM; - - entry->reset(e); + *entry = std::make_unique(cls_entry.bucket, cls_entry.start_time, cls_entry.status); return 0; } -int RadosLifecycle::get_next_entry(const std::string& oid, const std::string& marker, +int RadosLifecycle::get_next_entry(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, const std::string& marker, std::unique_ptr* entry) { cls_rgw_lc_entry cls_entry; @@ -3631,16 +3628,12 @@ int RadosLifecycle::get_next_entry(const std::string& oid, const std::string& ma if (ret) return ret; - LCEntry* e; - e = new StoreLCEntry(cls_entry.bucket, cls_entry.start_time, cls_entry.status); - if (!e) - return -ENOMEM; - - entry->reset(e); + *entry = std::make_unique(cls_entry.bucket, cls_entry.start_time, cls_entry.status); return 0; } -int RadosLifecycle::set_entry(const std::string& oid, LCEntry& entry) +int RadosLifecycle::set_entry(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, LCEntry& entry) { cls_rgw_lc_entry cls_entry; @@ -3651,8 +3644,9 @@ int RadosLifecycle::set_entry(const std::string& oid, LCEntry& entry) return cls_rgw_lc_set_entry(*store->getRados()->get_lc_pool_ctx(), oid, cls_entry); } -int RadosLifecycle::list_entries(const std::string& oid, const std::string& marker, - uint32_t max_entries, std::vector>& entries) +int RadosLifecycle::list_entries(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, const std::string& marker, + uint32_t max_entries, std::vector>& entries) { entries.clear(); @@ -3670,7 +3664,8 @@ int RadosLifecycle::list_entries(const std::string& oid, const std::string& mark return ret; } -int RadosLifecycle::rm_entry(const std::string& oid, LCEntry& entry) +int RadosLifecycle::rm_entry(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, LCEntry& entry) { cls_rgw_lc_entry cls_entry; @@ -3681,23 +3676,20 @@ int RadosLifecycle::rm_entry(const std::string& oid, LCEntry& entry) return cls_rgw_lc_rm_entry(*store->getRados()->get_lc_pool_ctx(), oid, cls_entry); } -int RadosLifecycle::get_head(const std::string& oid, std::unique_ptr* head) +int RadosLifecycle::get_head(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, std::unique_ptr* head) { cls_rgw_lc_obj_head cls_head; int ret = cls_rgw_lc_get_head(*store->getRados()->get_lc_pool_ctx(), oid, cls_head); if (ret) return ret; - LCHead* h; - h = new StoreLCHead(cls_head.start_date, cls_head.shard_rollover_date, cls_head.marker); - if (!h) - return -ENOMEM; - - head->reset(h); + *head = std::make_unique(cls_head.start_date, cls_head.shard_rollover_date, cls_head.marker); return 0; } -int RadosLifecycle::put_head(const std::string& oid, LCHead& head) +int RadosLifecycle::put_head(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, LCHead& head) { cls_rgw_lc_obj_head cls_head; diff --git a/src/rgw/driver/rados/rgw_sal_rados.h b/src/rgw/driver/rados/rgw_sal_rados.h index 6d4465093bcf..98d0bc9d0058 100644 --- a/src/rgw/driver/rados/rgw_sal_rados.h +++ b/src/rgw/driver/rados/rgw_sal_rados.h @@ -875,15 +875,24 @@ public: RadosLifecycle(RadosStore* _st) : store(_st) {} using StoreLifecycle::get_entry; - virtual int get_entry(const std::string& oid, const std::string& marker, std::unique_ptr* entry) override; - virtual int get_next_entry(const std::string& oid, const std::string& marker, std::unique_ptr* entry) override; - virtual int set_entry(const std::string& oid, LCEntry& entry) override; - virtual int list_entries(const std::string& oid, const std::string& marker, + virtual int get_entry(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, const std::string& marker, + std::unique_ptr* entry) override; + virtual int get_next_entry(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, const std::string& marker, + std::unique_ptr* entry) override; + virtual int set_entry(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, LCEntry& entry) override; + virtual int list_entries(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, const std::string& marker, uint32_t max_entries, std::vector>& entries) override; - virtual int rm_entry(const std::string& oid, LCEntry& entry) override; - virtual int get_head(const std::string& oid, std::unique_ptr* head) override; - virtual int put_head(const std::string& oid, LCHead& head) override; + virtual int rm_entry(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, LCEntry& entry) override; + virtual int get_head(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, std::unique_ptr* head) override; + virtual int put_head(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, LCHead& head) override; virtual std::unique_ptr get_serializer(const std::string& lock_name, const std::string& oid, const std::string& cookie) override; diff --git a/src/rgw/rgw_lc.cc b/src/rgw/rgw_lc.cc index 0d510d6642d7..fb3002b0a388 100644 --- a/src/rgw/rgw_lc.cc +++ b/src/rgw/rgw_lc.cc @@ -1865,7 +1865,7 @@ int RGWLC::bucket_lc_post(int index, int max_lock_sec, /* XXXX are we SURE the only way result could == ENOENT is when * there is no such bucket? It is currently the value returned * from bucket_lc_process(...) */ - ret = sal_lc->rm_entry(obj_names[index], entry); + ret = sal_lc->rm_entry(this, null_yield, obj_names[index], entry); if (ret < 0) { ldpp_dout(this, 0) << "RGWLC::bucket_lc_post() failed to remove entry " << obj_names[index] << dendl; @@ -1877,7 +1877,7 @@ int RGWLC::bucket_lc_post(int index, int max_lock_sec, entry.set_status(lc_complete); } - ret = sal_lc->set_entry(obj_names[index], entry); + ret = sal_lc->set_entry(this, null_yield, obj_names[index], entry); if (ret < 0) { ldpp_dout(this, 0) << "RGWLC::bucket_lc_post() failed to set entry on " << obj_names[index] << dendl; @@ -1897,7 +1897,8 @@ int RGWLC::list_lc_progress(string& marker, uint32_t max_entries, progress_map.clear(); for(; index < max_objs; index++, marker="") { vector> entries; - int ret = sal_lc->list_entries(obj_names[index], marker, max_entries, entries); + int ret = sal_lc->list_entries(this, null_yield, obj_names[index], + marker, max_entries, entries); if (ret < 0) { if (ret == -ENOENT) { ldpp_dout(this, 10) << __func__ << "() ignoring unfound lc object=" @@ -2052,7 +2053,8 @@ int RGWLC::process_bucket(int index, int max_lock_secs, LCWorker* worker, std::unique_lock lock( *(serializer.get()), std::adopt_lock); - ret = sal_lc->get_entry(obj_names[index], bucket_entry_marker, &entry); + ret = sal_lc->get_entry(this, null_yield, obj_names[index], + bucket_entry_marker, &entry); if (ret >= 0) { if (entry->get_status() == lc_processing) { if (expired_session(entry->get_start_time())) { @@ -2081,7 +2083,7 @@ int RGWLC::process_bucket(int index, int max_lock_secs, LCWorker* worker, << dendl; entry->set_status(lc_processing); - ret = sal_lc->set_entry(obj_names[index], *entry); + ret = sal_lc->set_entry(this, null_yield, obj_names[index], *entry); if (ret < 0) { ldpp_dout(this, 0) << "RGWLC::process_bucket() failed to set obj entry " << obj_names[index] << entry->get_bucket() << entry->get_status() @@ -2149,7 +2151,8 @@ inline int RGWLC::advance_head(const std::string& lc_shard, int ret{0}; std::unique_ptr next_entry; - ret = sal_lc->get_next_entry(lc_shard, entry.get_bucket(), &next_entry); + ret = sal_lc->get_next_entry(this, null_yield, lc_shard, + entry.get_bucket(), &next_entry); if (ret < 0) { ldpp_dout(this, 0) << "RGWLC::process() failed to get obj entry " << lc_shard << dendl; @@ -2160,7 +2163,7 @@ inline int RGWLC::advance_head(const std::string& lc_shard, head.set_marker(next_entry->get_bucket()); head.set_start_date(start_date); - ret = sal_lc->put_head(lc_shard, head); + ret = sal_lc->put_head(this, null_yield, lc_shard, head); if (ret < 0) { ldpp_dout(this, 0) << "RGWLC::process() failed to put head " << lc_shard @@ -2183,7 +2186,7 @@ inline int RGWLC::check_if_shard_done(const std::string& lc_shard, << lc_shard << " worker=" << worker_ix << dendl; head.set_shard_rollover_date(ceph_clock_now()); - ret = sal_lc->put_head(lc_shard, head); + ret = sal_lc->put_head(this, null_yield, lc_shard, head); if (ret < 0) { ldpp_dout(this, 0) << "RGWLC::process() failed to put head " << lc_shard @@ -2261,7 +2264,7 @@ int RGWLC::process(int index, int max_lock_secs, LCWorker* worker, utime_t now = ceph_clock_now(); /* preamble: find an inital bucket/marker */ - ret = sal_lc->get_head(lc_shard, &head); + ret = sal_lc->get_head(this, null_yield, lc_shard, &head); if (ret < 0) { ldpp_dout(this, 0) << "RGWLC::process() failed to get obj head " << lc_shard << ", ret=" << ret << dendl; @@ -2280,7 +2283,8 @@ int RGWLC::process(int index, int max_lock_secs, LCWorker* worker, << dendl; vector> entries; - int ret = sal_lc->list_entries(lc_shard, head->get_marker(), 1, entries); + int ret = sal_lc->list_entries(this, null_yield, lc_shard, + head->get_marker(), 1, entries); if (ret < 0) { ldpp_dout(this, 0) << "RGWLC::process() sal_lc->list_entries(lc_shard, head.marker, 1, " << "entries) returned error ret==" << ret << dendl; @@ -2299,7 +2303,8 @@ int RGWLC::process(int index, int max_lock_secs, LCWorker* worker, << dendl; /* fetches the entry pointed to by head.bucket */ - ret = sal_lc->get_entry(lc_shard, head->get_marker(), &entry); + ret = sal_lc->get_entry(this, null_yield, lc_shard, + head->get_marker(), &entry); if (ret == -ENOENT) { /* skip to next entry */ std::unique_ptr tmp_entry = sal_lc->get_entry(); @@ -2366,7 +2371,7 @@ int RGWLC::process(int index, int max_lock_secs, LCWorker* worker, entry->set_status(lc_processing); entry->set_start_time(now); - ret = sal_lc->set_entry(lc_shard, *entry); + ret = sal_lc->set_entry(this, null_yield, lc_shard, *entry); if (ret < 0) { ldpp_dout(this, 0) << "RGWLC::process() failed to set obj entry " << lc_shard << entry->get_bucket() << entry->get_status() << dendl; @@ -2402,7 +2407,7 @@ int RGWLC::process(int index, int max_lock_secs, LCWorker* worker, /* XXXX are we SURE the only way result could == ENOENT is when * there is no such bucket? It is currently the value returned * from bucket_lc_process(...) */ - ret = sal_lc->rm_entry(lc_shard, *entry); + ret = sal_lc->rm_entry(this, null_yield, lc_shard, *entry); if (ret < 0) { ldpp_dout(this, 0) << "RGWLC::process() failed to remove entry " << lc_shard << " (nonfatal)" @@ -2415,7 +2420,7 @@ int RGWLC::process(int index, int max_lock_secs, LCWorker* worker, } else { entry->set_status(lc_complete); } - ret = sal_lc->set_entry(lc_shard, *entry); + ret = sal_lc->set_entry(this, null_yield, lc_shard, *entry); if (ret < 0) { ldpp_dout(this, 0) << "RGWLC::process() failed to set entry on lc_shard=" << lc_shard << " entry=" << entry @@ -2604,9 +2609,10 @@ static int guard_lc_modify(const DoutPrefixProvider *dpp, return ret; } -int RGWLC::set_bucket_config(rgw::sal::Bucket* bucket, - const rgw::sal::Attrs& bucket_attrs, - RGWLifecycleConfiguration *config) +int RGWLC::set_bucket_config(const DoutPrefixProvider* dpp, optional_yield y, + rgw::sal::Bucket* bucket, + const rgw::sal::Attrs& bucket_attrs, + RGWLifecycleConfiguration *config) { int ret{0}; rgw::sal::Attrs attrs = bucket_attrs; @@ -2617,8 +2623,7 @@ int RGWLC::set_bucket_config(rgw::sal::Bucket* bucket, config->encode(lc_bl); attrs[RGW_ATTR_LC] = std::move(lc_bl); - ret = - bucket->merge_and_store_attrs(this, attrs, null_yield); + ret = bucket->merge_and_store_attrs(dpp, attrs, y); if (ret < 0) { return ret; } @@ -2627,16 +2632,17 @@ int RGWLC::set_bucket_config(rgw::sal::Bucket* bucket, rgw_bucket& b = bucket->get_key(); - ret = guard_lc_modify(this, driver, sal_lc.get(), b, cookie, + ret = guard_lc_modify(dpp, driver, sal_lc.get(), b, cookie, [&](rgw::sal::Lifecycle* sal_lc, const string& oid, rgw::sal::Lifecycle::LCEntry& entry) { - return sal_lc->set_entry(oid, entry); + return sal_lc->set_entry(dpp, y, oid, entry); }); return ret; } -int RGWLC::remove_bucket_config(rgw::sal::Bucket* bucket, +int RGWLC::remove_bucket_config(const DoutPrefixProvider* dpp, optional_yield y, + rgw::sal::Bucket* bucket, const rgw::sal::Attrs& bucket_attrs, bool merge_attrs) { @@ -2646,19 +2652,19 @@ int RGWLC::remove_bucket_config(rgw::sal::Bucket* bucket, if (merge_attrs) { attrs.erase(RGW_ATTR_LC); - ret = bucket->merge_and_store_attrs(this, attrs, null_yield); + ret = bucket->merge_and_store_attrs(dpp, attrs, y); if (ret < 0) { - ldpp_dout(this, 0) << "RGWLC::RGWDeleteLC() failed to set attrs on bucket=" + ldpp_dout(dpp, 0) << "RGWLC::RGWDeleteLC() failed to set attrs on bucket=" << b.name << " returned err=" << ret << dendl; return ret; } } - ret = guard_lc_modify(this, driver, sal_lc.get(), b, cookie, + ret = guard_lc_modify(dpp, driver, sal_lc.get(), b, cookie, [&](rgw::sal::Lifecycle* sal_lc, const string& oid, rgw::sal::Lifecycle::LCEntry& entry) { - return sal_lc->rm_entry(oid, entry); + return sal_lc->rm_entry(dpp, y, oid, entry); }); return ret; @@ -2692,7 +2698,7 @@ int fix_lc_shard_entry(const DoutPrefixProvider *dpp, // 2. entry doesn't exist, which usually happens when reshard has happened prior to update and next LC process has already dropped the update // 3. entry exists matching the current bucket id which was after a reshard (needs to be updated to the marker) // We are not dropping the old marker here as that would be caught by the next LC process update - int ret = sal_lc->get_entry(lc_oid, bucket_lc_key, &entry); + int ret = sal_lc->get_entry(dpp, null_yield, lc_oid, bucket_lc_key, &entry); if (ret == 0) { ldpp_dout(dpp, 5) << "Entry already exists, nothing to do" << dendl; return ret; // entry is already existing correctly set to marker @@ -2708,10 +2714,10 @@ int fix_lc_shard_entry(const DoutPrefixProvider *dpp, ret = guard_lc_modify(dpp, driver, sal_lc, bucket->get_key(), cookie, - [&lc_oid](rgw::sal::Lifecycle* slc, + [dpp, &lc_oid](rgw::sal::Lifecycle* slc, const string& oid, rgw::sal::Lifecycle::LCEntry& entry) { - return slc->set_entry(lc_oid, entry); + return slc->set_entry(dpp, null_yield, lc_oid, entry); }); } diff --git a/src/rgw/rgw_lc.h b/src/rgw/rgw_lc.h index 162b839efea7..d53e14cee653 100644 --- a/src/rgw/rgw_lc.h +++ b/src/rgw/rgw_lc.h @@ -653,10 +653,12 @@ public: bool going_down(); void start_processor(); void stop_processor(); - int set_bucket_config(rgw::sal::Bucket* bucket, + int set_bucket_config(const DoutPrefixProvider* dpp, optional_yield y, + rgw::sal::Bucket* bucket, const rgw::sal::Attrs& bucket_attrs, RGWLifecycleConfiguration *config); - int remove_bucket_config(rgw::sal::Bucket* bucket, + int remove_bucket_config(const DoutPrefixProvider* dpp, optional_yield y, + rgw::sal::Bucket* bucket, const rgw::sal::Attrs& bucket_attrs, bool merge_attrs = true); diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 31a74e183e63..422fdc06f5e7 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -6090,7 +6090,8 @@ void RGWPutLC::execute(optional_yield y) return; } - op_ret = driver->get_rgwlc()->set_bucket_config(s->bucket.get(), s->bucket_attrs, &new_config); + op_ret = driver->get_rgwlc()->set_bucket_config(this, y, s->bucket.get(), + s->bucket_attrs, &new_config); if (op_ret < 0) { return; } @@ -6106,7 +6107,8 @@ void RGWDeleteLC::execute(optional_yield y) return; } - op_ret = driver->get_rgwlc()->remove_bucket_config(s->bucket.get(), s->bucket_attrs); + op_ret = driver->get_rgwlc()->remove_bucket_config(this, y, s->bucket.get(), + s->bucket_attrs); if (op_ret < 0) { return; } diff --git a/src/rgw/rgw_sal.h b/src/rgw/rgw_sal.h index 9bc23f2d0aed..8ddfb7f7c7dc 100644 --- a/src/rgw/rgw_sal.h +++ b/src/rgw/rgw_sal.h @@ -1554,21 +1554,30 @@ public: /** Get an empty entry */ virtual std::unique_ptr get_entry() = 0; /** Get an entry matching the given marker */ - virtual int get_entry(const std::string& oid, const std::string& marker, std::unique_ptr* entry) = 0; + virtual int get_entry(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, const std::string& marker, + std::unique_ptr* entry) = 0; /** Get the entry following the given marker */ - virtual int get_next_entry(const std::string& oid, const std::string& marker, std::unique_ptr* entry) = 0; + virtual int get_next_entry(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, const std::string& marker, + std::unique_ptr* entry) = 0; /** Store a modified entry in then backing store */ - virtual int set_entry(const std::string& oid, LCEntry& entry) = 0; + virtual int set_entry(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, LCEntry& entry) = 0; /** List all known entries */ - virtual int list_entries(const std::string& oid, const std::string& marker, + virtual int list_entries(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, const std::string& marker, uint32_t max_entries, std::vector>& entries) = 0; /** Remove an entry from the backing store */ - virtual int rm_entry(const std::string& oid, LCEntry& entry) = 0; + virtual int rm_entry(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, LCEntry& entry) = 0; /** Get a head */ - virtual int get_head(const std::string& oid, std::unique_ptr* head) = 0; + virtual int get_head(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, std::unique_ptr* head) = 0; /** Store a modified head to the backing store */ - virtual int put_head(const std::string& oid, LCHead& head) = 0; + virtual int put_head(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, LCHead& head) = 0; /** Get a serializer for lifecycle */ virtual std::unique_ptr get_serializer(const std::string& lock_name, diff --git a/src/rgw/rgw_sal_dbstore.cc b/src/rgw/rgw_sal_dbstore.cc index cb62ebecceed..51627914db26 100644 --- a/src/rgw/rgw_sal_dbstore.cc +++ b/src/rgw/rgw_sal_dbstore.cc @@ -1838,40 +1838,47 @@ namespace rgw::sal { return std::make_unique(this); } - int DBLifecycle::get_entry(const std::string& oid, const std::string& marker, - std::unique_ptr* entry) + int DBLifecycle::get_entry(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, const std::string& marker, + std::unique_ptr* entry) { return store->getDB()->get_entry(oid, marker, entry); } - int DBLifecycle::get_next_entry(const std::string& oid, const std::string& marker, + int DBLifecycle::get_next_entry(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, const std::string& marker, std::unique_ptr* entry) { return store->getDB()->get_next_entry(oid, marker, entry); } - int DBLifecycle::set_entry(const std::string& oid, LCEntry& entry) + int DBLifecycle::set_entry(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, LCEntry& entry) { return store->getDB()->set_entry(oid, entry); } - int DBLifecycle::list_entries(const std::string& oid, const std::string& marker, + int DBLifecycle::list_entries(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, const std::string& marker, uint32_t max_entries, vector>& entries) { return store->getDB()->list_entries(oid, marker, max_entries, entries); } - int DBLifecycle::rm_entry(const std::string& oid, LCEntry& entry) + int DBLifecycle::rm_entry(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, LCEntry& entry) { return store->getDB()->rm_entry(oid, entry); } - int DBLifecycle::get_head(const std::string& oid, std::unique_ptr* head) + int DBLifecycle::get_head(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, std::unique_ptr* head) { return store->getDB()->get_head(oid, head); } - int DBLifecycle::put_head(const std::string& oid, LCHead& head) + int DBLifecycle::put_head(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, LCHead& head) { return store->getDB()->put_head(oid, head); } diff --git a/src/rgw/rgw_sal_dbstore.h b/src/rgw/rgw_sal_dbstore.h index 2dfc340315de..f163b874eb04 100644 --- a/src/rgw/rgw_sal_dbstore.h +++ b/src/rgw/rgw_sal_dbstore.h @@ -45,15 +45,24 @@ public: DBLifecycle(DBStore* _st) : store(_st) {} using StoreLifecycle::get_entry; - virtual int get_entry(const std::string& oid, const std::string& marker, std::unique_ptr* entry) override; - virtual int get_next_entry(const std::string& oid, const std::string& marker, std::unique_ptr* entry) override; - virtual int set_entry(const std::string& oid, LCEntry& entry) override; - virtual int list_entries(const std::string& oid, const std::string& marker, + virtual int get_entry(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, const std::string& marker, + std::unique_ptr* entry) override; + virtual int get_next_entry(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, const std::string& marker, + std::unique_ptr* entry) override; + virtual int set_entry(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, LCEntry& entry) override; + virtual int list_entries(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, const std::string& marker, uint32_t max_entries, std::vector>& entries) override; - virtual int rm_entry(const std::string& oid, LCEntry& entry) override; - virtual int get_head(const std::string& oid, std::unique_ptr* head) override; - virtual int put_head(const std::string& oid, LCHead& head) override; + virtual int rm_entry(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, LCEntry& entry) override; + virtual int get_head(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, std::unique_ptr* head) override; + virtual int put_head(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, LCHead& head) override; virtual std::unique_ptr get_serializer(const std::string& lock_name, const std::string& oid, const std::string& cookie) override; diff --git a/src/rgw/rgw_sal_filter.cc b/src/rgw/rgw_sal_filter.cc index 8408620ba5c9..5afefa3d2582 100644 --- a/src/rgw/rgw_sal_filter.cc +++ b/src/rgw/rgw_sal_filter.cc @@ -1330,51 +1330,45 @@ std::unique_ptr FilterLifecycle::get_entry() return std::make_unique(std::move(e)); } -int FilterLifecycle::get_entry(const std::string& oid, const std::string& marker, +int FilterLifecycle::get_entry(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, const std::string& marker, std::unique_ptr* entry) { std::unique_ptr ne; - int ret; - - ret = next->get_entry(oid, marker, &ne); + int ret = next->get_entry(dpp, y, oid, marker, &ne); if (ret < 0) return ret; - LCEntry* e = new FilterLCEntry(std::move(ne)); - entry->reset(e); - + *entry = std::make_unique(std::move(ne)); return 0; } -int FilterLifecycle::get_next_entry(const std::string& oid, const std::string& marker, +int FilterLifecycle::get_next_entry(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, const std::string& marker, std::unique_ptr* entry) { std::unique_ptr ne; - int ret; - - ret = next->get_next_entry(oid, marker, &ne); + int ret = next->get_next_entry(dpp, y, oid, marker, &ne); if (ret < 0) return ret; - LCEntry* e = new FilterLCEntry(std::move(ne)); - entry->reset(e); - + *entry = std::make_unique(std::move(ne)); return 0; } -int FilterLifecycle::set_entry(const std::string& oid, LCEntry& entry) +int FilterLifecycle::set_entry(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, LCEntry& entry) { - return next->set_entry(oid, entry); + return next->set_entry(dpp, y, oid, entry); } -int FilterLifecycle::list_entries(const std::string& oid, const std::string& marker, +int FilterLifecycle::list_entries(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, const std::string& marker, uint32_t max_entries, std::vector>& entries) { std::vector> ne; - int ret; - - ret = next->list_entries(oid, marker, max_entries, ne); + int ret = next->list_entries(dpp, y, oid, marker, max_entries, ne); if (ret < 0) return ret; @@ -1385,29 +1379,28 @@ int FilterLifecycle::list_entries(const std::string& oid, const std::string& mar return 0; } -int FilterLifecycle::rm_entry(const std::string& oid, LCEntry& entry) +int FilterLifecycle::rm_entry(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, LCEntry& entry) { - return next->rm_entry(oid, entry); + return next->rm_entry(dpp, y, oid, entry); } -int FilterLifecycle::get_head(const std::string& oid, std::unique_ptr* head) +int FilterLifecycle::get_head(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, std::unique_ptr* head) { std::unique_ptr nh; - int ret; - - ret = next->get_head(oid, &nh); + int ret = next->get_head(dpp, y, oid, &nh); if (ret < 0) return ret; - LCHead* h = new FilterLCHead(std::move(nh)); - head->reset(h); - + *head = std::make_unique(std::move(nh)); return 0; } -int FilterLifecycle::put_head(const std::string& oid, LCHead& head) +int FilterLifecycle::put_head(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, LCHead& head) { - return next->put_head(oid, *(dynamic_cast(head).next.get())); + return next->put_head(dpp, y, oid, *(dynamic_cast(head).next.get())); } std::unique_ptr FilterLifecycle::get_serializer( diff --git a/src/rgw/rgw_sal_filter.h b/src/rgw/rgw_sal_filter.h index 664b37fa6a9d..fc2e3aeffa37 100644 --- a/src/rgw/rgw_sal_filter.h +++ b/src/rgw/rgw_sal_filter.h @@ -1004,17 +1004,24 @@ public: virtual ~FilterLifecycle() = default; virtual std::unique_ptr get_entry() override; - virtual int get_entry(const std::string& oid, const std::string& marker, + virtual int get_entry(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, const std::string& marker, std::unique_ptr* entry) override; - virtual int get_next_entry(const std::string& oid, const std::string& marker, + virtual int get_next_entry(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, const std::string& marker, std::unique_ptr* entry) override; - virtual int set_entry(const std::string& oid, LCEntry& entry) override; - virtual int list_entries(const std::string& oid, const std::string& marker, + virtual int set_entry(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, LCEntry& entry) override; + virtual int list_entries(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, const std::string& marker, uint32_t max_entries, std::vector>& entries) override; - virtual int rm_entry(const std::string& oid, LCEntry& entry) override; - virtual int get_head(const std::string& oid, std::unique_ptr* head) override; - virtual int put_head(const std::string& oid, LCHead& head) override; + virtual int rm_entry(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, LCEntry& entry) override; + virtual int get_head(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, std::unique_ptr* head) override; + virtual int put_head(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, LCHead& head) override; virtual std::unique_ptr get_serializer(const std::string& lock_name, const std::string& oid, const std::string& cookie) override;