diff options
Diffstat (limited to 'src/rgw/driver')
-rw-r--r-- | src/rgw/driver/rados/rgw_bucket.cc | 7 | ||||
-rw-r--r-- | src/rgw/driver/rados/rgw_cr_tools.cc | 2 | ||||
-rw-r--r-- | src/rgw/driver/rados/rgw_notify.cc | 4 | ||||
-rw-r--r-- | src/rgw/driver/rados/rgw_sal_rados.cc | 126 | ||||
-rw-r--r-- | src/rgw/driver/rados/rgw_sal_rados.h | 23 |
5 files changed, 108 insertions, 54 deletions
diff --git a/src/rgw/driver/rados/rgw_bucket.cc b/src/rgw/driver/rados/rgw_bucket.cc index 996de5f3c4d..94d3066e5b5 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<RGWBucketInstanceMetadataObject *>(_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 a46ba1ac6e1..f9543b55935 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_notify.cc b/src/rgw/driver/rados/rgw_notify.cc index 6c1fe53d7e3..6b1dd9651f0 100644 --- a/src/rgw/driver/rados/rgw_notify.cc +++ b/src/rgw/driver/rados/rgw_notify.cc @@ -1111,8 +1111,8 @@ int publish_reserve(const DoutPrefixProvider* dpp, // reload the topic in case it changed since the notification was added const std::string& topic_tenant = std::visit(fu2::overload( - [] (const rgw_user& u) -> const std::string& { return u.tenant; }, - [] (const rgw_account_id& a) -> const std::string& { return a; } + [] (const rgw_user& u) -> std::string { return u.tenant; }, + [] (const rgw_account_id& a) -> std::string { return a; } ), topic_cfg.owner); const RGWPubSub ps(res.store, topic_tenant, site); int ret = ps.get_topic(res.dpp, topic_cfg.dest.arn_topic, diff --git a/src/rgw/driver/rados/rgw_sal_rados.cc b/src/rgw/driver/rados/rgw_sal_rados.cc index 9a656be6029..50c738d5435 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 @@ -3612,43 +3612,56 @@ 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<LCEntry>* entry) { - cls_rgw_lc_entry cls_entry; - int ret = cls_rgw_lc_get_entry(*store->getRados()->get_lc_pool_ctx(), oid, marker, cls_entry); - if (ret) + librados::ObjectReadOperation op; + bufferlist bl; + cls_rgw_lc_get_entry(op, marker, bl); + + auto& ioctx = *store->getRados()->get_lc_pool_ctx(); + int ret = rgw_rados_operate(dpp, ioctx, oid, &op, nullptr, y); + if (ret < 0) { return ret; + } - LCEntry* e; - e = new StoreLCEntry(cls_entry.bucket, cls_entry.start_time, cls_entry.status); - if (!e) - return -ENOMEM; + cls_rgw_lc_entry cls_entry; + ret = cls_rgw_lc_get_entry_decode(bl, cls_entry); + if (ret < 0) { + return ret; + } - entry->reset(e); + *entry = std::make_unique<StoreLCEntry>(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<LCEntry>* entry) { - cls_rgw_lc_entry cls_entry; - int ret = cls_rgw_lc_get_next_entry(*store->getRados()->get_lc_pool_ctx(), oid, marker, - cls_entry); + librados::ObjectReadOperation op; + bufferlist bl; + cls_rgw_lc_get_next_entry(op, marker, bl); - if (ret) + auto& ioctx = *store->getRados()->get_lc_pool_ctx(); + int ret = rgw_rados_operate(dpp, ioctx, oid, &op, nullptr, y); + if (ret < 0) { return ret; + } - LCEntry* e; - e = new StoreLCEntry(cls_entry.bucket, cls_entry.start_time, cls_entry.status); - if (!e) - return -ENOMEM; + cls_rgw_lc_entry cls_entry; + ret = cls_rgw_lc_get_next_entry_decode(bl, cls_entry); + if (ret < 0) { + return ret; + } - entry->reset(e); + *entry = std::make_unique<StoreLCEntry>(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; @@ -3656,19 +3669,34 @@ int RadosLifecycle::set_entry(const std::string& oid, LCEntry& entry) cls_entry.start_time = entry.get_start_time(); cls_entry.status = entry.get_status(); - return cls_rgw_lc_set_entry(*store->getRados()->get_lc_pool_ctx(), oid, cls_entry); + librados::ObjectWriteOperation op; + cls_rgw_lc_set_entry(op, cls_entry); + + auto& ioctx = *store->getRados()->get_lc_pool_ctx(); + return rgw_rados_operate(dpp, ioctx, oid, &op, y); } -int RadosLifecycle::list_entries(const std::string& oid, const std::string& marker, - uint32_t max_entries, std::vector<std::unique_ptr<LCEntry>>& 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<std::unique_ptr<LCEntry>>& entries) { entries.clear(); - vector<cls_rgw_lc_entry> cls_entries; - int ret = cls_rgw_lc_list(*store->getRados()->get_lc_pool_ctx(), oid, marker, max_entries, cls_entries); + librados::ObjectReadOperation op; + bufferlist bl; + cls_rgw_lc_list(op, marker, max_entries, bl); - if (ret < 0) + auto& ioctx = *store->getRados()->get_lc_pool_ctx(); + int ret = rgw_rados_operate(dpp, ioctx, oid, &op, nullptr, y); + if (ret < 0) { return ret; + } + + vector<cls_rgw_lc_entry> cls_entries; + ret = cls_rgw_lc_list_decode(bl, cls_entries); + if (ret < 0) { + return ret; + } for (auto& entry : cls_entries) { entries.push_back(std::make_unique<StoreLCEntry>(entry.bucket, oid, @@ -3678,34 +3706,46 @@ 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; - cls_entry.bucket = entry.get_bucket(); cls_entry.start_time = entry.get_start_time(); cls_entry.status = entry.get_status(); - return cls_rgw_lc_rm_entry(*store->getRados()->get_lc_pool_ctx(), oid, cls_entry); + librados::ObjectWriteOperation op; + cls_rgw_lc_rm_entry(op, cls_entry); + + auto& ioctx = *store->getRados()->get_lc_pool_ctx(); + return rgw_rados_operate(dpp, ioctx, oid, &op, y); } -int RadosLifecycle::get_head(const std::string& oid, std::unique_ptr<LCHead>* head) +int RadosLifecycle::get_head(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, std::unique_ptr<LCHead>* 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) + librados::ObjectReadOperation op; + bufferlist bl; + cls_rgw_lc_get_head(op, bl); + + auto& ioctx = *store->getRados()->get_lc_pool_ctx(); + int ret = rgw_rados_operate(dpp, ioctx, oid, &op, nullptr, y); + if (ret < 0) { return ret; + } - LCHead* h; - h = new StoreLCHead(cls_head.start_date, cls_head.shard_rollover_date, cls_head.marker); - if (!h) - return -ENOMEM; + cls_rgw_lc_obj_head cls_head; + ret = cls_rgw_lc_get_head_decode(bl, cls_head); + if (ret < 0) { + return ret; + } - head->reset(h); + *head = std::make_unique<StoreLCHead>(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; @@ -3713,7 +3753,11 @@ int RadosLifecycle::put_head(const std::string& oid, LCHead& head) cls_head.start_date = head.get_start_date(); cls_head.shard_rollover_date = head.get_shard_rollover_date(); - return cls_rgw_lc_put_head(*store->getRados()->get_lc_pool_ctx(), oid, cls_head); + librados::ObjectWriteOperation op; + cls_rgw_lc_put_head(op, cls_head); + + auto& ioctx = *store->getRados()->get_lc_pool_ctx(); + return rgw_rados_operate(dpp, ioctx, oid, &op, y); } std::unique_ptr<LCSerializer> RadosLifecycle::get_serializer(const std::string& lock_name, diff --git a/src/rgw/driver/rados/rgw_sal_rados.h b/src/rgw/driver/rados/rgw_sal_rados.h index 6d4465093bc..98d0bc9d005 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<LCEntry>* entry) override; - virtual int get_next_entry(const std::string& oid, const std::string& marker, std::unique_ptr<LCEntry>* 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<LCEntry>* entry) override; + virtual int get_next_entry(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, const std::string& marker, + std::unique_ptr<LCEntry>* 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<std::unique_ptr<LCEntry>>& entries) override; - virtual int rm_entry(const std::string& oid, LCEntry& entry) override; - virtual int get_head(const std::string& oid, std::unique_ptr<LCHead>* 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<LCHead>* head) override; + virtual int put_head(const DoutPrefixProvider* dpp, optional_yield y, + const std::string& oid, LCHead& head) override; virtual std::unique_ptr<LCSerializer> get_serializer(const std::string& lock_name, const std::string& oid, const std::string& cookie) override; |