lc_it = old_bci->attrs.find(RGW_ATTR_LC);
if (lc_it != old_bci->attrs.end()) {
ldpp_dout(dpp, 20) << "remove lc config for " << old_bci->info.bucket.name << dendl;
- ret = lc->remove_bucket_config(dpp, y, bucket.get(), old_bci->attrs, false /* cannot merge attrs */);
+ constexpr bool update_attrs = false;
+ ret = lc->remove_bucket_config(dpp, y, bucket.get(), update_attrs);
if (ret < 0) {
ldpp_dout(dpp, 0) << __func__ << " failed to remove lc config for "
<< old_bci->info.bucket.name
// remove lifecycle config, if any (XXX note could be made generic)
if (get_attrs().count(RGW_ATTR_LC)) {
- constexpr bool merge_attrs = false; // don't update xattrs, we're deleting
+ constexpr bool update_attrs = false; // don't update xattrs, we're deleting
(void) store->getRados()->get_lc()->remove_bucket_config(
- dpp, y, this, get_attrs(), merge_attrs);
+ dpp, y, this, update_attrs);
}
// remove bucket-topic mapping
}
int RGWLC::remove_bucket_config(const DoutPrefixProvider* dpp, optional_yield y,
- rgw::sal::Bucket* bucket,
- const rgw::sal::Attrs& bucket_attrs,
- bool merge_attrs)
+ rgw::sal::Bucket* bucket, bool update_attrs)
{
- rgw::sal::Attrs attrs = bucket_attrs;
rgw_bucket& b = bucket->get_key();
int ret{0};
- if (merge_attrs) {
- attrs.erase(RGW_ATTR_LC);
- ret = bucket->merge_and_store_attrs(dpp, attrs, y);
-
+ // remove the lifecycle attr if present. if not, try to remove from
+ // the 'lc list' anyway
+ rgw::sal::Attrs& attrs = bucket->get_attrs();
+ if (update_attrs && attrs.erase(RGW_ATTR_LC)) {
+ ret = bucket->put_info(dpp, false, real_time(), y);
if (ret < 0) {
ldpp_dout(dpp, 0) << "RGWLC::RGWDeleteLC() failed to set attrs on bucket="
<< b.name << " returned err=" << ret << dendl;
rgw::sal::Bucket* bucket,
const rgw::sal::Attrs& bucket_attrs,
RGWLifecycleConfiguration *config);
+ // remove a bucket from the lc list, and optionally update the bucket
+ // instance metadata to remove RGW_ATTR_LC
int remove_bucket_config(const DoutPrefixProvider* dpp, optional_yield y,
- rgw::sal::Bucket* bucket,
- const rgw::sal::Attrs& bucket_attrs,
- bool merge_attrs = true);
+ rgw::sal::Bucket* bucket, bool update_attrs);
CephContext *get_cct() const override { return cct; }
rgw::sal::Lifecycle* get_lc() const { return sal_lc.get(); }
return;
}
+ // remove RGW_ATTR_LC and remove the bucket from the 'lc list'
+ constexpr bool update_attrs = true;
op_ret = driver->get_rgwlc()->remove_bucket_config(this, y, s->bucket.get(),
- s->bucket_attrs);
+ update_attrs);
if (op_ret < 0) {
return;
}