merge_and_store_attrs() is no longer able to remove xattrs. change the
sal::Bucket's attrs manually and call put_info() to write them back
Fixes: https://tracker.ceph.com/issues/71083
Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit
f3cc52124c650d32be2adf3cf540167142423c42)
Conflicts:
src/rgw/driver/rados/rgw_bucket.cc
src/rgw/driver/rados/rgw_sal_rados.cc
src/rgw/rgw_lc.cc
src/rgw/rgw_lc.h
src/rgw/rgw_op.cc
mostly because squid doesn't have changes to remove metadata backends
} 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 */);
+ 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 "
<< 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(
- this, get_attrs(), merge_attrs);
+ dpp, y, this, update_attrs);
}
// remove bucket-topic mapping
return ret;
}
-int RGWLC::remove_bucket_config(rgw::sal::Bucket* bucket,
- const rgw::sal::Attrs& bucket_attrs,
- bool merge_attrs)
+int RGWLC::remove_bucket_config(const DoutPrefixProvider* dpp, optional_yield y,
+ 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(this, attrs, null_yield);
-
+ // 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(this, 0) << "RGWLC::RGWDeleteLC() failed to set attrs on bucket="
<< b.name << " returned err=" << ret << dendl;
int set_bucket_config(rgw::sal::Bucket* bucket,
const rgw::sal::Attrs& bucket_attrs,
RGWLifecycleConfiguration *config);
- int remove_bucket_config(rgw::sal::Bucket* bucket,
- const rgw::sal::Attrs& bucket_attrs,
- bool merge_attrs = true);
+ // 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, bool update_attrs);
CephContext *get_cct() const override { return cct; }
rgw::sal::Lifecycle* get_lc() const { return sal_lc.get(); }
return;
}
- op_ret = driver->get_rgwlc()->remove_bucket_config(s->bucket.get(), s->bucket_attrs);
+ // 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(),
+ update_attrs);
if (op_ret < 0) {
return;
}