The calls to remove a bucket had parameters to specify a prefix and
delimiter, which does not make sense. This was precipitated due to some
existing Swift protocol logic, but buckets are removed irrespective of
prefix and delimiter. So the functions and calls are adjusted to
remove those parameters. Additionally, those same parameters were
removed for aborting incomplete multipart uploads.
Additionally a bug is fixed in which during bucket removal, multipart
uploads were only removed if the prefix was non-empty.
Signed-off-by: J. Eric Ivancich <ivancich@redhat.com>
(cherry-picked from
5156e4e7ce307f8ac6ee6dc36f7e546c93d17d55)
Conflicts:
src/rgw/rgw_sal_rados.cc
src/rgw/rgw_sal.h
src/rgw/rgw_sal_rados.h
- Alterations due to Zipper 7 code refactoring
src/rgw/rgw_sal_dbstore.cc
src/rgw/rgw_sal_dbstore.h
- Did not exist before Zipper 7 code refactoring
if (ret < 0)
return ret;
- string prefix, delimiter;
-
- ret = abort_bucket_multiparts(dpp, store, cct, info, prefix, delimiter);
+ ret = abort_bucket_multiparts(dpp, store, cct, info);
if (ret < 0) {
return ret;
}
if (bypass_gc)
ret = rgw_remove_bucket_bypass_gc(store, bucket->get_key(), op_state.get_max_aio(), keep_index_consistent, y, dpp);
else
- ret = bucket->remove_bucket(dpp, op_state.will_delete_children(), string(), string(),
+ ret = bucket->remove_bucket(dpp, op_state.will_delete_children(),
false, nullptr, y);
return ret;
int abort_bucket_multiparts(const DoutPrefixProvider* dpp,
rgw::sal::RGWRadosStore* store,
CephContext* cct,
- RGWBucketInfo& bucket_info,
- const std::string& prefix,
- const std::string& delim)
+ RGWBucketInfo& bucket_info)
{
constexpr int max = 1000;
int ret, num_deleted = 0;
string marker;
bool is_truncated;
+ const std::string empty_delim;
+ const std::string empty_prefix;
+
do {
- ret = list_bucket_multiparts(dpp, store, bucket_info, prefix, marker, delim,
+ ret = list_bucket_multiparts(dpp, store, bucket_info, empty_prefix, marker, empty_delim,
max, &objs, nullptr, &is_truncated);
if (ret < 0) {
ldpp_dout(dpp, 0) << __func__ <<
" ERROR : calling list_bucket_multiparts; ret=" << ret <<
- "; bucket=\"" << bucket_info.bucket << "\"; prefix=\"" <<
- prefix << "\"; delim=\"" << delim << "\"" << dendl;
+ "; bucket=\"" << bucket_info.bucket << "\"" << dendl;
return ret;
}
ldpp_dout(dpp, 20) << __func__ <<
extern int abort_bucket_multiparts(const DoutPrefixProvider* dpp,
rgw::sal::RGWRadosStore* store,
CephContext* cct,
- RGWBucketInfo& bucket_info,
- const std::string& prefix,
- const std::string& delim);
+ RGWBucketInfo& bucket_info);
#endif
return;
}
- string prefix, delimiter;
-
- if (s->prot_flags & RGW_REST_SWIFT) {
- string path_args;
- path_args = s->info.args.get("path");
- if (!path_args.empty()) {
- if (!delimiter.empty() || !prefix.empty()) {
- op_ret = -EINVAL;
- return;
- }
- prefix = path_args;
- delimiter="/";
- }
- }
-
- op_ret = s->bucket->remove_bucket(this, false, prefix, delimiter, false, nullptr, y);
+ op_ret = s->bucket->remove_bucket(this, false, false, nullptr, y);
if (op_ret < 0 && op_ret == -ECANCELED) {
// lost a race, either with mdlog sync or another delete bucket operation.
// in either case, we've already called ctl.bucket->unlink_bucket()
goto delop_fail;
}
} else {
- ret = bucket->remove_bucket(dpp, false, string(), string(), true, &s->info, s->yield);
+ ret = bucket->remove_bucket(dpp, false, true, &s->info, s->yield);
if (ret < 0) {
goto delop_fail;
}
return;
}
- op_ret = bucket->remove_bucket(s, delete_children, string(), string(), true, &s->info, s->yield);
+ op_ret = bucket->remove_bucket(s, delete_children, true, &s->info, s->yield);
}
class RGWOp_Set_Bucket_Quota : public RGWRESTOp {
virtual RGWObject* create_object(const rgw_obj_key& key /* Attributes */) = 0;
virtual RGWAttrs& get_attrs(void) { return attrs; }
virtual int set_attrs(RGWAttrs a) { attrs = a; return 0; }
- virtual int remove_bucket(const DoutPrefixProvider *dpp, bool delete_children, std::string prefix, std::string delimiter, bool forward_to_master, req_info* req_info, optional_yield y) = 0;
+ virtual int remove_bucket(const DoutPrefixProvider *dpp, bool delete_children, bool forward_to_master, req_info* req_info, optional_yield y) = 0;
virtual RGWAccessControlPolicy& get_acl(void) = 0;
virtual int set_acl(const DoutPrefixProvider *dpp, RGWAccessControlPolicy& acl, optional_yield y) = 0;
virtual int get_bucket_info(const DoutPrefixProvider *dpp, optional_yield y) = 0;
int RGWRadosBucket::remove_bucket(const DoutPrefixProvider *dpp,
bool delete_children,
- std::string prefix,
- std::string delimiter,
bool forward_to_master,
req_info* req_info, optional_yield y)
{
}
} while(results.is_truncated);
- /* If there's a prefix, then we are aborting multiparts as well */
- if (!prefix.empty()) {
- ret = abort_bucket_multiparts(dpp, store, store->ctx(), info, prefix, delimiter);
- if (ret < 0) {
- return ret;
- }
+ ret = abort_bucket_multiparts(dpp, store, store->ctx(), info);
+ if (ret < 0) {
+ return ret;
}
ret = store->ctl()->bucket->sync_user_stats(dpp, info.owner, info, y);
RGWBucketList* list(void) { return new RGWBucketList(); }
virtual int list(const DoutPrefixProvider *dpp, ListParams&, int, ListResults&, optional_yield y) override;
RGWObject* create_object(const rgw_obj_key& key /* Attributes */) override;
- virtual int remove_bucket(const DoutPrefixProvider *dpp, bool delete_children, std::string prefix, std::string delimiter, bool forward_to_master, req_info* req_info, optional_yield y) override;
+ virtual int remove_bucket(const DoutPrefixProvider *dpp, bool delete_children, bool forward_to_master, req_info* req_info, optional_yield y) override;
RGWAccessControlPolicy& get_acl(void) { return acls; }
virtual int set_acl(const DoutPrefixProvider *dpp, RGWAccessControlPolicy& acl, optional_yield y) override;
virtual int get_bucket_info(const DoutPrefixProvider *dpp, optional_yield y) override;
return -EEXIST; // change to code that maps to 409: conflict
}
- std::string prefix, delimiter;
for (auto it = m.begin(); it != m.end(); ++it) {
- ret = it->second->remove_bucket(dpp, true, prefix, delimiter, false, nullptr, y);
+ ret = it->second->remove_bucket(dpp, true, false, nullptr, y);
if (ret < 0) {
set_err_msg(err_msg, "unable to delete user data");
return ret;