Skip to content

Commit 3feb86b

Browse files
authored
Merge pull request ceph#63075 from cbodley/wip-71151-tentacle
tentacle: rgw/lc: stop using merge_and_store_attrs in remove_bucket_config Reviewed-by: Daniel Gryniewicz <[email protected]>
2 parents 8d9d026 + 38971a0 commit 3feb86b

File tree

5 files changed

+16
-15
lines changed

5 files changed

+16
-15
lines changed

src/rgw/driver/rados/rgw_bucket.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2974,7 +2974,8 @@ int RGWBucketInstanceMetadataHandler::put_post(
29742974
lc_it = old_bci->attrs.find(RGW_ATTR_LC);
29752975
if (lc_it != old_bci->attrs.end()) {
29762976
ldpp_dout(dpp, 20) << "remove lc config for " << old_bci->info.bucket.name << dendl;
2977-
ret = lc->remove_bucket_config(dpp, y, bucket.get(), old_bci->attrs, false /* cannot merge attrs */);
2977+
constexpr bool update_attrs = false;
2978+
ret = lc->remove_bucket_config(dpp, y, bucket.get(), update_attrs);
29782979
if (ret < 0) {
29792980
ldpp_dout(dpp, 0) << __func__ << " failed to remove lc config for "
29802981
<< old_bci->info.bucket.name

src/rgw/driver/rados/rgw_sal_rados.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,9 +413,9 @@ int RadosBucket::remove(const DoutPrefixProvider* dpp,
413413

414414
// remove lifecycle config, if any (XXX note could be made generic)
415415
if (get_attrs().count(RGW_ATTR_LC)) {
416-
constexpr bool merge_attrs = false; // don't update xattrs, we're deleting
416+
constexpr bool update_attrs = false; // don't update xattrs, we're deleting
417417
(void) store->getRados()->get_lc()->remove_bucket_config(
418-
dpp, y, this, get_attrs(), merge_attrs);
418+
dpp, y, this, update_attrs);
419419
}
420420

421421
// remove bucket-topic mapping

src/rgw/rgw_lc.cc

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2719,18 +2719,16 @@ int RGWLC::set_bucket_config(const DoutPrefixProvider* dpp, optional_yield y,
27192719
}
27202720

27212721
int RGWLC::remove_bucket_config(const DoutPrefixProvider* dpp, optional_yield y,
2722-
rgw::sal::Bucket* bucket,
2723-
const rgw::sal::Attrs& bucket_attrs,
2724-
bool merge_attrs)
2722+
rgw::sal::Bucket* bucket, bool update_attrs)
27252723
{
2726-
rgw::sal::Attrs attrs = bucket_attrs;
27272724
rgw_bucket& b = bucket->get_key();
27282725
int ret{0};
27292726

2730-
if (merge_attrs) {
2731-
attrs.erase(RGW_ATTR_LC);
2732-
ret = bucket->merge_and_store_attrs(dpp, attrs, y);
2733-
2727+
// remove the lifecycle attr if present. if not, try to remove from
2728+
// the 'lc list' anyway
2729+
rgw::sal::Attrs& attrs = bucket->get_attrs();
2730+
if (update_attrs && attrs.erase(RGW_ATTR_LC)) {
2731+
ret = bucket->put_info(dpp, false, real_time(), y);
27342732
if (ret < 0) {
27352733
ldpp_dout(dpp, 0) << "RGWLC::RGWDeleteLC() failed to set attrs on bucket="
27362734
<< b.name << " returned err=" << ret << dendl;

src/rgw/rgw_lc.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -657,10 +657,10 @@ class RGWLC : public DoutPrefixProvider {
657657
rgw::sal::Bucket* bucket,
658658
const rgw::sal::Attrs& bucket_attrs,
659659
RGWLifecycleConfiguration *config);
660+
// remove a bucket from the lc list, and optionally update the bucket
661+
// instance metadata to remove RGW_ATTR_LC
660662
int remove_bucket_config(const DoutPrefixProvider* dpp, optional_yield y,
661-
rgw::sal::Bucket* bucket,
662-
const rgw::sal::Attrs& bucket_attrs,
663-
bool merge_attrs = true);
663+
rgw::sal::Bucket* bucket, bool update_attrs);
664664

665665
CephContext *get_cct() const override { return cct; }
666666
rgw::sal::Lifecycle* get_lc() const { return sal_lc.get(); }

src/rgw/rgw_op.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6393,8 +6393,10 @@ void RGWDeleteLC::execute(optional_yield y)
63936393
return;
63946394
}
63956395

6396+
// remove RGW_ATTR_LC and remove the bucket from the 'lc list'
6397+
constexpr bool update_attrs = true;
63966398
op_ret = driver->get_rgwlc()->remove_bucket_config(this, y, s->bucket.get(),
6397-
s->bucket_attrs);
6399+
update_attrs);
63986400
if (op_ret < 0) {
63996401
return;
64006402
}

0 commit comments

Comments
 (0)