Skip to content

Commit 3f11eb9

Browse files
committed
rgw/sal: add dpp and optional_yield to lifecycle ops
Signed-off-by: Casey Bodley <[email protected]>
1 parent a23254d commit 3f11eb9

File tree

12 files changed

+168
-131
lines changed

12 files changed

+168
-131
lines changed

src/rgw/driver/rados/rgw_bucket.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2781,6 +2781,7 @@ class RGWBucketInstanceMetadataHandler : public RGWBucketInstanceMetadataHandler
27812781
class RGWMetadataHandlerPut_BucketInstance : public RGWMetadataHandlerPut_SObj
27822782
{
27832783
CephContext *cct;
2784+
optional_yield y;
27842785
RGWBucketInstanceMetadataHandler *bihandler;
27852786
RGWBucketInstanceMetadataObject *obj;
27862787
public:
@@ -2790,7 +2791,7 @@ class RGWMetadataHandlerPut_BucketInstance : public RGWMetadataHandlerPut_SObj
27902791
RGWMetadataObject *_obj, RGWObjVersionTracker& objv_tracker,
27912792
optional_yield y,
27922793
RGWMDLogSyncType type, bool from_remote_zone) : RGWMetadataHandlerPut_SObj(_handler, _op, entry, _obj, objv_tracker, y, type, from_remote_zone),
2793-
cct(_cct), bihandler(_handler) {
2794+
cct(_cct), y(y), bihandler(_handler) {
27942795
obj = static_cast<RGWBucketInstanceMetadataObject *>(_obj);
27952796

27962797
auto& bci = obj->get_bci();
@@ -2947,7 +2948,7 @@ int RGWMetadataHandlerPut_BucketInstance::put_post(const DoutPrefixProvider *dpp
29472948
auto lc_it = bci.attrs.find(RGW_ATTR_LC);
29482949
if (lc_it != bci.attrs.end()) {
29492950
ldpp_dout(dpp, 20) << "set lc config for " << bci.info.bucket.name << dendl;
2950-
ret = lc->set_bucket_config(bucket.get(), bci.attrs, nullptr);
2951+
ret = lc->set_bucket_config(dpp, y, bucket.get(), bci.attrs, nullptr);
29512952
if (ret < 0) {
29522953
ldpp_dout(dpp, 0) << __func__ << " failed to set lc config for "
29532954
<< bci.info.bucket.name
@@ -2957,7 +2958,7 @@ int RGWMetadataHandlerPut_BucketInstance::put_post(const DoutPrefixProvider *dpp
29572958

29582959
} else {
29592960
ldpp_dout(dpp, 20) << "remove lc config for " << bci.info.bucket.name << dendl;
2960-
ret = lc->remove_bucket_config(bucket.get(), bci.attrs, false /* cannot merge attrs */);
2961+
ret = lc->remove_bucket_config(dpp, y, bucket.get(), bci.attrs, false /* cannot merge attrs */);
29612962
if (ret < 0) {
29622963
ldpp_dout(dpp, 0) << __func__ << " failed to remove lc config for "
29632964
<< bci.info.bucket.name

src/rgw/driver/rados/rgw_cr_tools.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ int RGWBucketLifecycleConfigCR::Request::_send_request(const DoutPrefixProvider
115115
return -EIO;
116116
}
117117

118-
int ret = lc->set_bucket_config(params.bucket,
118+
int ret = lc->set_bucket_config(dpp, null_yield, params.bucket,
119119
params.bucket_attrs,
120120
&params.config);
121121
if (ret < 0) {

src/rgw/driver/rados/rgw_sal_rados.cc

Lines changed: 19 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ int RadosBucket::remove(const DoutPrefixProvider* dpp,
370370
if (get_attrs().count(RGW_ATTR_LC)) {
371371
constexpr bool merge_attrs = false; // don't update xattrs, we're deleting
372372
(void) store->getRados()->get_lc()->remove_bucket_config(
373-
this, get_attrs(), merge_attrs);
373+
dpp, y, this, get_attrs(), merge_attrs);
374374
}
375375

376376
// remove bucket-topic mapping
@@ -3604,24 +3604,21 @@ int LCRadosSerializer::try_lock(const DoutPrefixProvider *dpp, utime_t dur, opti
36043604
return lock.lock_exclusive(ioctx, oid);
36053605
}
36063606

3607-
int RadosLifecycle::get_entry(const std::string& oid, const std::string& marker,
3607+
int RadosLifecycle::get_entry(const DoutPrefixProvider* dpp, optional_yield y,
3608+
const std::string& oid, const std::string& marker,
36083609
std::unique_ptr<LCEntry>* entry)
36093610
{
36103611
cls_rgw_lc_entry cls_entry;
36113612
int ret = cls_rgw_lc_get_entry(*store->getRados()->get_lc_pool_ctx(), oid, marker, cls_entry);
36123613
if (ret)
36133614
return ret;
36143615

3615-
LCEntry* e;
3616-
e = new StoreLCEntry(cls_entry.bucket, cls_entry.start_time, cls_entry.status);
3617-
if (!e)
3618-
return -ENOMEM;
3619-
3620-
entry->reset(e);
3616+
*entry = std::make_unique<StoreLCEntry>(cls_entry.bucket, cls_entry.start_time, cls_entry.status);
36213617
return 0;
36223618
}
36233619

3624-
int RadosLifecycle::get_next_entry(const std::string& oid, const std::string& marker,
3620+
int RadosLifecycle::get_next_entry(const DoutPrefixProvider* dpp, optional_yield y,
3621+
const std::string& oid, const std::string& marker,
36253622
std::unique_ptr<LCEntry>* entry)
36263623
{
36273624
cls_rgw_lc_entry cls_entry;
@@ -3631,16 +3628,12 @@ int RadosLifecycle::get_next_entry(const std::string& oid, const std::string& ma
36313628
if (ret)
36323629
return ret;
36333630

3634-
LCEntry* e;
3635-
e = new StoreLCEntry(cls_entry.bucket, cls_entry.start_time, cls_entry.status);
3636-
if (!e)
3637-
return -ENOMEM;
3638-
3639-
entry->reset(e);
3631+
*entry = std::make_unique<StoreLCEntry>(cls_entry.bucket, cls_entry.start_time, cls_entry.status);
36403632
return 0;
36413633
}
36423634

3643-
int RadosLifecycle::set_entry(const std::string& oid, LCEntry& entry)
3635+
int RadosLifecycle::set_entry(const DoutPrefixProvider* dpp, optional_yield y,
3636+
const std::string& oid, LCEntry& entry)
36443637
{
36453638
cls_rgw_lc_entry cls_entry;
36463639

@@ -3651,8 +3644,9 @@ int RadosLifecycle::set_entry(const std::string& oid, LCEntry& entry)
36513644
return cls_rgw_lc_set_entry(*store->getRados()->get_lc_pool_ctx(), oid, cls_entry);
36523645
}
36533646

3654-
int RadosLifecycle::list_entries(const std::string& oid, const std::string& marker,
3655-
uint32_t max_entries, std::vector<std::unique_ptr<LCEntry>>& entries)
3647+
int RadosLifecycle::list_entries(const DoutPrefixProvider* dpp, optional_yield y,
3648+
const std::string& oid, const std::string& marker,
3649+
uint32_t max_entries, std::vector<std::unique_ptr<LCEntry>>& entries)
36563650
{
36573651
entries.clear();
36583652

@@ -3670,7 +3664,8 @@ int RadosLifecycle::list_entries(const std::string& oid, const std::string& mark
36703664
return ret;
36713665
}
36723666

3673-
int RadosLifecycle::rm_entry(const std::string& oid, LCEntry& entry)
3667+
int RadosLifecycle::rm_entry(const DoutPrefixProvider* dpp, optional_yield y,
3668+
const std::string& oid, LCEntry& entry)
36743669
{
36753670
cls_rgw_lc_entry cls_entry;
36763671

@@ -3681,23 +3676,20 @@ int RadosLifecycle::rm_entry(const std::string& oid, LCEntry& entry)
36813676
return cls_rgw_lc_rm_entry(*store->getRados()->get_lc_pool_ctx(), oid, cls_entry);
36823677
}
36833678

3684-
int RadosLifecycle::get_head(const std::string& oid, std::unique_ptr<LCHead>* head)
3679+
int RadosLifecycle::get_head(const DoutPrefixProvider* dpp, optional_yield y,
3680+
const std::string& oid, std::unique_ptr<LCHead>* head)
36853681
{
36863682
cls_rgw_lc_obj_head cls_head;
36873683
int ret = cls_rgw_lc_get_head(*store->getRados()->get_lc_pool_ctx(), oid, cls_head);
36883684
if (ret)
36893685
return ret;
36903686

3691-
LCHead* h;
3692-
h = new StoreLCHead(cls_head.start_date, cls_head.shard_rollover_date, cls_head.marker);
3693-
if (!h)
3694-
return -ENOMEM;
3695-
3696-
head->reset(h);
3687+
*head = std::make_unique<StoreLCHead>(cls_head.start_date, cls_head.shard_rollover_date, cls_head.marker);
36973688
return 0;
36983689
}
36993690

3700-
int RadosLifecycle::put_head(const std::string& oid, LCHead& head)
3691+
int RadosLifecycle::put_head(const DoutPrefixProvider* dpp, optional_yield y,
3692+
const std::string& oid, LCHead& head)
37013693
{
37023694
cls_rgw_lc_obj_head cls_head;
37033695

src/rgw/driver/rados/rgw_sal_rados.h

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -875,15 +875,24 @@ class RadosLifecycle : public StoreLifecycle {
875875
RadosLifecycle(RadosStore* _st) : store(_st) {}
876876

877877
using StoreLifecycle::get_entry;
878-
virtual int get_entry(const std::string& oid, const std::string& marker, std::unique_ptr<LCEntry>* entry) override;
879-
virtual int get_next_entry(const std::string& oid, const std::string& marker, std::unique_ptr<LCEntry>* entry) override;
880-
virtual int set_entry(const std::string& oid, LCEntry& entry) override;
881-
virtual int list_entries(const std::string& oid, const std::string& marker,
878+
virtual int get_entry(const DoutPrefixProvider* dpp, optional_yield y,
879+
const std::string& oid, const std::string& marker,
880+
std::unique_ptr<LCEntry>* entry) override;
881+
virtual int get_next_entry(const DoutPrefixProvider* dpp, optional_yield y,
882+
const std::string& oid, const std::string& marker,
883+
std::unique_ptr<LCEntry>* entry) override;
884+
virtual int set_entry(const DoutPrefixProvider* dpp, optional_yield y,
885+
const std::string& oid, LCEntry& entry) override;
886+
virtual int list_entries(const DoutPrefixProvider* dpp, optional_yield y,
887+
const std::string& oid, const std::string& marker,
882888
uint32_t max_entries,
883889
std::vector<std::unique_ptr<LCEntry>>& entries) override;
884-
virtual int rm_entry(const std::string& oid, LCEntry& entry) override;
885-
virtual int get_head(const std::string& oid, std::unique_ptr<LCHead>* head) override;
886-
virtual int put_head(const std::string& oid, LCHead& head) override;
890+
virtual int rm_entry(const DoutPrefixProvider* dpp, optional_yield y,
891+
const std::string& oid, LCEntry& entry) override;
892+
virtual int get_head(const DoutPrefixProvider* dpp, optional_yield y,
893+
const std::string& oid, std::unique_ptr<LCHead>* head) override;
894+
virtual int put_head(const DoutPrefixProvider* dpp, optional_yield y,
895+
const std::string& oid, LCHead& head) override;
887896
virtual std::unique_ptr<LCSerializer> get_serializer(const std::string& lock_name,
888897
const std::string& oid,
889898
const std::string& cookie) override;

0 commit comments

Comments
 (0)