summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/rgw/driver/daos/rgw_sal_daos.cc43
-rw-r--r--src/rgw/driver/daos/rgw_sal_daos.h17
-rw-r--r--src/rgw/driver/motr/rgw_sal_motr.cc34
-rw-r--r--src/rgw/driver/motr/rgw_sal_motr.h9
-rw-r--r--src/rgw/driver/posix/rgw_sal_posix.cc33
-rw-r--r--src/rgw/driver/posix/rgw_sal_posix.h15
-rw-r--r--src/rgw/driver/rados/rgw_bucket.cc36
-rw-r--r--src/rgw/driver/rados/rgw_cr_rados.h2
-rw-r--r--src/rgw/driver/rados/rgw_cr_tools.cc2
-rw-r--r--src/rgw/driver/rados/rgw_object_expirer_core.cc2
-rw-r--r--src/rgw/driver/rados/rgw_rest_bucket.cc4
-rw-r--r--src/rgw/driver/rados/rgw_rest_log.cc10
-rw-r--r--src/rgw/driver/rados/rgw_sal_rados.cc36
-rw-r--r--src/rgw/driver/rados/rgw_sal_rados.h9
-rw-r--r--src/rgw/driver/rados/rgw_tools.cc5
-rw-r--r--src/rgw/driver/rados/rgw_user.cc4
-rw-r--r--src/rgw/rgw_admin.cc8
-rw-r--r--src/rgw/rgw_flight.cc4
-rw-r--r--src/rgw/rgw_lc.cc2
-rw-r--r--src/rgw/rgw_op.cc94
-rw-r--r--src/rgw/rgw_orphan.cc11
-rw-r--r--src/rgw/rgw_quota.cc6
-rw-r--r--src/rgw/rgw_rest_pubsub.cc6
-rw-r--r--src/rgw/rgw_rest_ratelimit.cc4
-rw-r--r--src/rgw/rgw_rest_swift.cc4
-rw-r--r--src/rgw/rgw_rest_usage.cc10
-rw-r--r--src/rgw/rgw_sal.h14
-rw-r--r--src/rgw/rgw_sal_dbstore.cc36
-rw-r--r--src/rgw/rgw_sal_dbstore.h9
-rw-r--r--src/rgw/rgw_sal_filter.cc46
-rw-r--r--src/rgw/rgw_sal_filter.h15
-rw-r--r--src/rgw/rgw_swift_auth.cc2
-rw-r--r--src/rgw/rgw_user.cc2
33 files changed, 218 insertions, 316 deletions
diff --git a/src/rgw/driver/daos/rgw_sal_daos.cc b/src/rgw/driver/daos/rgw_sal_daos.cc
index c4deba7f11f..167c16d6be9 100644
--- a/src/rgw/driver/daos/rgw_sal_daos.cc
+++ b/src/rgw/driver/daos/rgw_sal_daos.cc
@@ -101,7 +101,7 @@ int DaosUser::create_bucket(
std::unique_ptr<Bucket> bucket;
// Look up the bucket. Create it if it doesn't exist.
- ret = this->store->get_bucket(dpp, this, b, &bucket, y);
+ ret = this->store->load_bucket(dpp, this, b, &bucket, y);
if (ret != 0 && ret != -ENOENT) {
return ret;
}
@@ -2249,45 +2249,30 @@ inline std::ostream& operator<<(std::ostream& out, const rgw_user* u) {
return out << s;
}
-int DaosStore::get_bucket(const DoutPrefixProvider* dpp, User* u,
- const rgw_bucket& b, std::unique_ptr<Bucket>* bucket,
- optional_yield y) {
- ldpp_dout(dpp, 20) << "DEBUG: get_bucket1: User: " << u << dendl;
- int ret;
- Bucket* bp;
-
- bp = new DaosBucket(this, b, u);
- ret = bp->load_bucket(dpp, y);
- if (ret != 0) {
- delete bp;
- return ret;
- }
-
- bucket->reset(bp);
- return 0;
+std::unique_ptr<Bucket> DaosStore::get_bucket(User* u, const RGWBucketInfo& i) {
+ /* Don't need to fetch the bucket info, use the provided one */
+ return std::make_unique<DaosBucket>(this, i, u);
}
-int DaosStore::get_bucket(User* u, const RGWBucketInfo& i,
- std::unique_ptr<Bucket>* bucket) {
- DaosBucket* bp;
-
- bp = new DaosBucket(this, i, u);
- /* Don't need to fetch the bucket info, use the provided one */
+int DaosStore::load_bucket(const DoutPrefixProvider* dpp, User* u,
+ const rgw_bucket& b, std::unique_ptr<Bucket>* bucket,
+ optional_yield y) {
+ ldpp_dout(dpp, 20) << "DEBUG: get_bucket1: User: " << u << dendl;
- bucket->reset(bp);
- return 0;
+ *bucket = std::make_unique<DaosBucket>(this, b, u);
+ return (*bucket)->load_bucket(dpp, y);
}
-int DaosStore::get_bucket(const DoutPrefixProvider* dpp, User* u,
- const std::string& tenant, const std::string& name,
- std::unique_ptr<Bucket>* bucket, optional_yield y) {
+int DaosStore::load_bucket(const DoutPrefixProvider* dpp, User* u,
+ const std::string& tenant, const std::string& name,
+ std::unique_ptr<Bucket>* bucket, optional_yield y) {
ldpp_dout(dpp, 20) << "get_bucket" << dendl;
rgw_bucket b;
b.tenant = tenant;
b.name = name;
- return get_bucket(dpp, u, b, bucket, y);
+ return load_bucket(dpp, u, b, bucket, y);
}
bool DaosStore::is_meta_master() { return true; }
diff --git a/src/rgw/driver/daos/rgw_sal_daos.h b/src/rgw/driver/daos/rgw_sal_daos.h
index 84b640b8a6e..23f723c0ce7 100644
--- a/src/rgw/driver/daos/rgw_sal_daos.h
+++ b/src/rgw/driver/daos/rgw_sal_daos.h
@@ -895,15 +895,14 @@ class DaosStore : public StoreDriver {
const std::string& user_str, optional_yield y,
std::unique_ptr<User>* user) override;
virtual std::unique_ptr<Object> get_object(const rgw_obj_key& k) override;
- virtual int get_bucket(const DoutPrefixProvider* dpp, User* u,
- const rgw_bucket& b, std::unique_ptr<Bucket>* bucket,
- optional_yield y) override;
- virtual int get_bucket(User* u, const RGWBucketInfo& i,
- std::unique_ptr<Bucket>* bucket) override;
- virtual int get_bucket(const DoutPrefixProvider* dpp, User* u,
- const std::string& tenant, const std::string& name,
- std::unique_ptr<Bucket>* bucket,
- optional_yield y) override;
+ std::unique_ptr<Bucket> get_bucket(User* u, const RGWBucketInfo& i) override;
+ int load_bucket(const DoutPrefixProvider* dpp, User* u,
+ const rgw_bucket& b, std::unique_ptr<Bucket>* bucket,
+ optional_yield y) override;
+ int load_bucket(const DoutPrefixProvider* dpp, User* u,
+ const std::string& tenant, const std::string& name,
+ std::unique_ptr<Bucket>* bucket,
+ optional_yield y) override;
virtual bool is_meta_master() override;
virtual int forward_request_to_master(const DoutPrefixProvider* dpp,
User* user, obj_version* objv,
diff --git a/src/rgw/driver/motr/rgw_sal_motr.cc b/src/rgw/driver/motr/rgw_sal_motr.cc
index 156fb6d6031..c7e4fc49bd4 100644
--- a/src/rgw/driver/motr/rgw_sal_motr.cc
+++ b/src/rgw/driver/motr/rgw_sal_motr.cc
@@ -228,7 +228,7 @@ int MotrUser::create_bucket(const DoutPrefixProvider* dpp,
std::unique_ptr<Bucket> bucket;
// Look up the bucket. Create it if it doesn't exist.
- ret = this->store->get_bucket(dpp, this, b, &bucket, y);
+ ret = this->store->load_bucket(dpp, this, b, &bucket, y);
if (ret < 0 && ret != -ENOENT)
return ret;
@@ -3242,41 +3242,27 @@ std::unique_ptr<Object> MotrStore::get_object(const rgw_obj_key& k)
}
-int MotrStore::get_bucket(const DoutPrefixProvider *dpp, User* u, const rgw_bucket& b, std::unique_ptr<Bucket>* bucket, optional_yield y)
+std::unique_ptr<Bucket> MotrStore::get_bucket(User* u, const RGWBucketInfo& i)
{
- int ret;
- Bucket* bp;
-
- bp = new MotrBucket(this, b, u);
- ret = bp->load_bucket(dpp, y);
- if (ret < 0) {
- delete bp;
- return ret;
- }
-
- bucket->reset(bp);
- return 0;
+ /* Don't need to fetch the bucket info, use the provided one */
+ return std::make_unique<MotrBucket>(this, i, u);
}
-int MotrStore::get_bucket(User* u, const RGWBucketInfo& i, std::unique_ptr<Bucket>* bucket)
+int MotrStore::load_bucket(const DoutPrefixProvider *dpp, User* u, const rgw_bucket& b,
+ std::unique_ptr<Bucket>* bucket, optional_yield y)
{
- Bucket* bp;
-
- bp = new MotrBucket(this, i, u);
- /* Don't need to fetch the bucket info, use the provided one */
-
- bucket->reset(bp);
- return 0;
+ *bucket = std::make_unique<MotrBucket>(this, b, u);
+ return (*bucket)->load_bucket(dpp, y);
}
-int MotrStore::get_bucket(const DoutPrefixProvider *dpp, User* u, const std::string& tenant, const std::string& name, std::unique_ptr<Bucket>* bucket, optional_yield y)
+int MotrStore::load_bucket(const DoutPrefixProvider *dpp, User* u, const std::string& tenant, const std::string& name, std::unique_ptr<Bucket>* bucket, optional_yield y)
{
rgw_bucket b;
b.tenant = tenant;
b.name = name;
- return get_bucket(dpp, u, b, bucket, y);
+ return load_bucket(dpp, u, b, bucket, y);
}
bool MotrStore::is_meta_master()
diff --git a/src/rgw/driver/motr/rgw_sal_motr.h b/src/rgw/driver/motr/rgw_sal_motr.h
index 23854b466de..ec5eb347cf2 100644
--- a/src/rgw/driver/motr/rgw_sal_motr.h
+++ b/src/rgw/driver/motr/rgw_sal_motr.h
@@ -992,9 +992,12 @@ class MotrStore : public StoreDriver {
virtual int get_user_by_email(const DoutPrefixProvider *dpp, const std::string& email, optional_yield y, std::unique_ptr<User>* user) override;
virtual int get_user_by_swift(const DoutPrefixProvider *dpp, const std::string& user_str, optional_yield y, std::unique_ptr<User>* user) override;
virtual std::unique_ptr<Object> get_object(const rgw_obj_key& k) override;
- virtual int get_bucket(const DoutPrefixProvider *dpp, User* u, const rgw_bucket& b, std::unique_ptr<Bucket>* bucket, optional_yield y) override;
- virtual int get_bucket(User* u, const RGWBucketInfo& i, std::unique_ptr<Bucket>* bucket) override;
- virtual int get_bucket(const DoutPrefixProvider *dpp, User* u, const std::string& tenant, const std::string&name, std::unique_ptr<Bucket>* bucket, optional_yield y) override;
+ std::unique_ptr<Bucket> get_bucket(User* u, const RGWBucketInfo& i) override;
+ int load_bucket(const DoutPrefixProvider *dpp, User* u, const rgw_bucket& b,
+ std::unique_ptr<Bucket>* bucket, optional_yield y) override;
+ int load_bucket(const DoutPrefixProvider *dpp, User* u,
+ const std::string& tenant, const std::string& name,
+ std::unique_ptr<Bucket>* bucket, optional_yield y) override;
virtual bool is_meta_master() override;
virtual int forward_request_to_master(const DoutPrefixProvider *dpp, User* user, obj_version* objv,
bufferlist& in_data, JSONParser *jp, req_info& info,
diff --git a/src/rgw/driver/posix/rgw_sal_posix.cc b/src/rgw/driver/posix/rgw_sal_posix.cc
index 0831ebd97c5..40f509b28d7 100644
--- a/src/rgw/driver/posix/rgw_sal_posix.cc
+++ b/src/rgw/driver/posix/rgw_sal_posix.cc
@@ -393,41 +393,26 @@ std::unique_ptr<Object> POSIXDriver::get_object(const rgw_obj_key& k)
return std::make_unique<POSIXObject>(this, k);
}
-int POSIXDriver::get_bucket(const DoutPrefixProvider* dpp, User* u, const rgw_bucket& b, std::unique_ptr<Bucket>* bucket, optional_yield y)
+int POSIXDriver::load_bucket(const DoutPrefixProvider* dpp, User* u, const rgw_bucket& b, std::unique_ptr<Bucket>* bucket, optional_yield y)
{
- int ret;
- Bucket* bp;
-
- bp = new POSIXBucket(this, root_fd, b, u);
- ret = bp->load_bucket(dpp, y);
- if (ret < 0) {
- delete bp;
- return ret;
- }
-
- bucket->reset(bp);
- return 0;
+ *bucket = std::make_unique<POSIXBucket>(this, root_fd, b, u);
+ return (*bucket)->load_bucket(dpp, y);
}
-int POSIXDriver::get_bucket(User* u, const RGWBucketInfo& i, std::unique_ptr<Bucket>* bucket)
+std::unique_ptr<Bucket> POSIXDriver::get_bucket(User* u, const RGWBucketInfo& i)
{
- Bucket* bp;
-
- bp = new POSIXBucket(this, root_fd, i, u);
/* Don't need to fetch the bucket info, use the provided one */
-
- bucket->reset(bp);
- return 0;
+ return std::make_unique<POSIXBucket>(this, root_fd, i, u);
}
-int POSIXDriver::get_bucket(const DoutPrefixProvider* dpp, User* u, const std::string& tenant, const std::string& name, std::unique_ptr<Bucket>* bucket, optional_yield y)
+int POSIXDriver::load_bucket(const DoutPrefixProvider* dpp, User* u, const std::string& tenant, const std::string& name, std::unique_ptr<Bucket>* bucket, optional_yield y)
{
rgw_bucket b;
b.tenant = tenant;
b.name = name;
- return get_bucket(dpp, u, b, bucket, y);
+ return load_bucket(dpp, u, b, bucket, y);
}
std::string POSIXDriver::zone_unique_trans_id(const uint64_t unique_num)
@@ -612,7 +597,7 @@ int POSIXUser::create_bucket(const DoutPrefixProvider* dpp,
{
std::unique_ptr<rgw::sal::Bucket> bucket;
- int ret = driver->get_bucket(dpp, this, b, &bucket, y);
+ int ret = driver->load_bucket(dpp, this, b, &bucket, y);
if (ret >= 0) {
*existed = true;
// Bucket exists. Check owner comparison
@@ -730,7 +715,7 @@ int POSIXDriver::mint_listing_entry(const std::string &bname,
POSIXObject *pobj;
int ret;
- ret = get_bucket(nullptr, nullptr, std::string(), bname, &b, null_yield);
+ ret = load_bucket(nullptr, nullptr, std::string(), bname, &b, null_yield);
if (ret < 0)
return ret;
diff --git a/src/rgw/driver/posix/rgw_sal_posix.h b/src/rgw/driver/posix/rgw_sal_posix.h
index f78bbadbfe9..53cd05823b6 100644
--- a/src/rgw/driver/posix/rgw_sal_posix.h
+++ b/src/rgw/driver/posix/rgw_sal_posix.h
@@ -52,14 +52,13 @@ public:
std::string& user_str, optional_yield y,
std::unique_ptr<User>* user) override;
virtual std::unique_ptr<Object> get_object(const rgw_obj_key& k) override;
- virtual int get_bucket(User* u, const RGWBucketInfo& i,
- std::unique_ptr<Bucket>* bucket) override;
- virtual int get_bucket(const DoutPrefixProvider* dpp, User* u, const
- rgw_bucket& b, std::unique_ptr<Bucket>* bucket,
- optional_yield y) override;
- virtual int get_bucket(const DoutPrefixProvider* dpp, User* u, const
- std::string& tenant, const std::string& name,
- std::unique_ptr<Bucket>* bucket, optional_yield y) override;
+ virtual std::unique_ptr<Bucket> get_bucket(User* u, const RGWBucketInfo& i) override;
+ virtual int load_bucket(const DoutPrefixProvider* dpp, User* u, const
+ rgw_bucket& b, std::unique_ptr<Bucket>* bucket,
+ optional_yield y) override;
+ virtual int load_bucket(const DoutPrefixProvider* dpp, User* u, const
+ std::string& tenant, const std::string& name,
+ std::unique_ptr<Bucket>* bucket, optional_yield y) override;
virtual std::string zone_unique_trans_id(const uint64_t unique_num) override;
virtual std::unique_ptr<Writer> get_append_writer(const DoutPrefixProvider *dpp,
diff --git a/src/rgw/driver/rados/rgw_bucket.cc b/src/rgw/driver/rados/rgw_bucket.cc
index 04fa1538139..1c4341f438f 100644
--- a/src/rgw/driver/rados/rgw_bucket.cc
+++ b/src/rgw/driver/rados/rgw_bucket.cc
@@ -109,7 +109,7 @@ void check_bad_user_bucket_mapping(rgw::sal::Driver* driver, rgw::sal::User& use
for (const auto& ent : listing.buckets) {
std::unique_ptr<rgw::sal::Bucket> bucket;
- int r = driver->get_bucket(dpp, &user, user.get_tenant(), ent.bucket.name, &bucket, y);
+ int r = driver->load_bucket(dpp, &user, user.get_tenant(), ent.bucket.name, &bucket, y);
if (r < 0) {
ldpp_dout(dpp, 0) << "could not get bucket info for bucket=" << bucket << dendl;
continue;
@@ -181,7 +181,7 @@ int RGWBucket::init(rgw::sal::Driver* _driver, RGWBucketAdminOpState& op_state,
bucket_name = bucket_name.substr(pos + 1);
}
- int r = driver->get_bucket(dpp, user.get(), tenant, bucket_name, &bucket, y);
+ int r = driver->load_bucket(dpp, user.get(), tenant, bucket_name, &bucket, y);
if (r < 0) {
set_err_msg(err_msg, "failed to fetch bucket info for bucket=" + bucket_name);
return r;
@@ -1242,8 +1242,8 @@ int RGWBucketAdminOp::remove_bucket(rgw::sal::Driver* driver, RGWBucketAdminOpSt
std::unique_ptr<rgw::sal::Bucket> bucket;
std::unique_ptr<rgw::sal::User> user = driver->get_user(op_state.get_user_id());
- int ret = driver->get_bucket(dpp, user.get(), user->get_tenant(), op_state.get_bucket_name(),
- &bucket, y);
+ int ret = driver->load_bucket(dpp, user.get(), user->get_tenant(),
+ op_state.get_bucket_name(), &bucket, y);
if (ret < 0)
return ret;
@@ -1284,7 +1284,7 @@ static int bucket_stats(rgw::sal::Driver* driver,
std::unique_ptr<rgw::sal::Bucket> bucket;
map<RGWObjCategory, RGWStorageStats> stats;
- int ret = driver->get_bucket(dpp, nullptr, tenant_name, bucket_name, &bucket, y);
+ int ret = driver->load_bucket(dpp, nullptr, tenant_name, bucket_name, &bucket, y);
if (ret < 0) {
return ret;
}
@@ -1407,7 +1407,7 @@ int RGWBucketAdminOp::limit_check(rgw::sal::Driver* driver,
uint64_t num_objects = 0;
std::unique_ptr<rgw::sal::Bucket> bucket;
- ret = driver->get_bucket(dpp, user.get(), ent.bucket, &bucket, y);
+ ret = driver->load_bucket(dpp, user.get(), ent.bucket, &bucket, y);
if (ret < 0)
continue;
@@ -1591,7 +1591,7 @@ void get_stale_instances(rgw::sal::Driver* driver, const std::string& bucket_nam
std::unique_ptr<rgw::sal::Bucket> bucket;
rgw_bucket rbucket;
rgw_bucket_parse_bucket_key(driver->ctx(), bucket_instance, &rbucket, nullptr);
- int r = driver->get_bucket(dpp, nullptr, rbucket, &bucket, y);
+ int r = driver->load_bucket(dpp, nullptr, rbucket, &bucket, y);
if (r < 0){
// this can only happen if someone deletes us right when we're processing
ldpp_dout(dpp, -1) << "Bucket instance is invalid: " << bucket_instance
@@ -1611,7 +1611,7 @@ void get_stale_instances(rgw::sal::Driver* driver, const std::string& bucket_nam
auto [tenant, bname] = split_tenant(bucket_name);
RGWBucketInfo cur_bucket_info;
std::unique_ptr<rgw::sal::Bucket> cur_bucket;
- int r = driver->get_bucket(dpp, nullptr, tenant, bname, &cur_bucket, y);
+ int r = driver->load_bucket(dpp, nullptr, tenant, bname, &cur_bucket, y);
if (r < 0) {
if (r == -ENOENT) {
// bucket doesn't exist, everything is stale then
@@ -1745,8 +1745,7 @@ int RGWBucketAdminOp::clear_stale_instances(rgw::sal::Driver* driver,
Formatter *formatter,
rgw::sal::Driver* driver){
for (const auto &binfo: lst) {
- std::unique_ptr<rgw::sal::Bucket> bucket;
- driver->get_bucket(nullptr, binfo, &bucket);
+ auto bucket = driver->get_bucket(nullptr, binfo);
int ret = bucket->purge_instance(dpp, y);
if (ret == 0){
auto md_key = "bucket.instance:" + binfo.bucket.get_key();
@@ -1768,7 +1767,7 @@ static int fix_single_bucket_lc(rgw::sal::Driver* driver,
const DoutPrefixProvider *dpp, optional_yield y)
{
std::unique_ptr<rgw::sal::Bucket> bucket;
- int ret = driver->get_bucket(dpp, nullptr, tenant_name, bucket_name, &bucket, y);
+ int ret = driver->load_bucket(dpp, nullptr, tenant_name, bucket_name, &bucket, y);
if (ret < 0) {
// TODO: Should we handle the case where the bucket could've been removed between
// listing and fetching?
@@ -1938,11 +1937,7 @@ int RGWBucketAdminOp::fix_obj_expiry(rgw::sal::Driver* driver,
ldpp_dout(dpp, -1) << "failed to initialize bucket" << dendl;
return ret;
}
- std::unique_ptr<rgw::sal::Bucket> bucket;
- ret = driver->get_bucket(nullptr, admin_bucket.get_bucket_info(), &bucket);
- if (ret < 0) {
- return ret;
- }
+ auto bucket = driver->get_bucket(nullptr, admin_bucket.get_bucket_info());
return fix_bucket_obj_expiry(dpp, driver, bucket.get(), flusher, dry_run, y);
}
@@ -2623,14 +2618,7 @@ int RGWMetadataHandlerPut_BucketInstance::put_post(const DoutPrefixProvider *dpp
/* update lifecyle policy */
{
- std::unique_ptr<rgw::sal::Bucket> bucket;
- ret = bihandler->driver->get_bucket(nullptr, bci.info, &bucket);
- if (ret < 0) {
- ldpp_dout(dpp, 0) << __func__ << " failed to get_bucket(...) for "
- << bci.info.bucket.name
- << dendl;
- return ret;
- }
+ auto bucket = bihandler->driver->get_bucket(nullptr, bci.info);
auto lc = bihandler->driver->get_rgwlc();
diff --git a/src/rgw/driver/rados/rgw_cr_rados.h b/src/rgw/driver/rados/rgw_cr_rados.h
index 3b192f19818..ff7a0efb481 100644
--- a/src/rgw/driver/rados/rgw_cr_rados.h
+++ b/src/rgw/driver/rados/rgw_cr_rados.h
@@ -1350,7 +1350,7 @@ public:
if (_zones_trace) {
zones_trace = *_zones_trace;
}
- store->get_bucket(nullptr, _bucket_info, &bucket);
+ bucket = store->get_bucket(nullptr, _bucket_info);
obj = bucket->get_object(_key);
}
};
diff --git a/src/rgw/driver/rados/rgw_cr_tools.cc b/src/rgw/driver/rados/rgw_cr_tools.cc
index 65cb6750504..10d17a49b38 100644
--- a/src/rgw/driver/rados/rgw_cr_tools.cc
+++ b/src/rgw/driver/rados/rgw_cr_tools.cc
@@ -100,7 +100,7 @@ int RGWGetUserInfoCR::Request::_send_request(const DoutPrefixProvider *dpp)
template<>
int RGWGetBucketInfoCR::Request::_send_request(const DoutPrefixProvider *dpp)
{
- return store->get_bucket(dpp, nullptr, params.tenant, params.bucket_name, &result->bucket, null_yield);
+ return store->load_bucket(dpp, nullptr, params.tenant, params.bucket_name, &result->bucket, null_yield);
}
template<>
diff --git a/src/rgw/driver/rados/rgw_object_expirer_core.cc b/src/rgw/driver/rados/rgw_object_expirer_core.cc
index 2c931cf909d..ba6580b89b0 100644
--- a/src/rgw/driver/rados/rgw_object_expirer_core.cc
+++ b/src/rgw/driver/rados/rgw_object_expirer_core.cc
@@ -201,7 +201,7 @@ int RGWObjectExpirer::garbage_single_object(const DoutPrefixProvider *dpp, objex
RGWBucketInfo bucket_info;
std::unique_ptr<rgw::sal::Bucket> bucket;
- int ret = driver->get_bucket(dpp, nullptr, rgw_bucket(hint.tenant, hint.bucket_name, hint.bucket_id), &bucket, null_yield);
+ int ret = driver->load_bucket(dpp, nullptr, rgw_bucket(hint.tenant, hint.bucket_name, hint.bucket_id), &bucket, null_yield);
if (-ENOENT == ret) {
ldpp_dout(dpp, 15) << "NOTICE: cannot find bucket = " \
<< hint.bucket_name << ". The object must be already removed" << dendl;
diff --git a/src/rgw/driver/rados/rgw_rest_bucket.cc b/src/rgw/driver/rados/rgw_rest_bucket.cc
index 9c811efa42d..66aceabee96 100644
--- a/src/rgw/driver/rados/rgw_rest_bucket.cc
+++ b/src/rgw/driver/rados/rgw_rest_bucket.cc
@@ -232,7 +232,7 @@ void RGWOp_Bucket_Remove::execute(optional_yield y)
return;
}
- op_ret = driver->get_bucket(s, nullptr, string(), bucket_name, &bucket, y);
+ op_ret = driver->load_bucket(s, nullptr, string(), bucket_name, &bucket, y);
if (op_ret < 0) {
ldpp_dout(this, 0) << "get_bucket returned ret=" << op_ret << dendl;
if (op_ret == -ENOENT) {
@@ -299,7 +299,7 @@ void RGWOp_Set_Bucket_Quota::execute(optional_yield y)
}
if (use_http_params) {
std::unique_ptr<rgw::sal::Bucket> bucket;
- op_ret = driver->get_bucket(s, nullptr, uid.tenant, bucket_name, &bucket, s->yield);
+ op_ret = driver->load_bucket(s, nullptr, uid.tenant, bucket_name, &bucket, s->yield);
if (op_ret < 0) {
return;
}
diff --git a/src/rgw/driver/rados/rgw_rest_log.cc b/src/rgw/driver/rados/rgw_rest_log.cc
index c2e9b7cfa18..d331097f10b 100644
--- a/src/rgw/driver/rados/rgw_rest_log.cc
+++ b/src/rgw/driver/rados/rgw_rest_log.cc
@@ -414,7 +414,7 @@ void RGWOp_BILog_List::execute(optional_yield y) {
b.name = bn;
b.bucket_id = bucket_instance;
}
- op_ret = driver->get_bucket(s, nullptr, b, &bucket, y);
+ op_ret = driver->load_bucket(s, nullptr, b, &bucket, y);
if (op_ret < 0) {
ldpp_dout(this, 5) << "could not get bucket info for bucket=" << bucket_name << dendl;
return;
@@ -541,7 +541,7 @@ void RGWOp_BILog_Info::execute(optional_yield y) {
b.name = bn;
b.bucket_id = bucket_instance;
}
- op_ret = driver->get_bucket(s, nullptr, b, &bucket, y);
+ op_ret = driver->load_bucket(s, nullptr, b, &bucket, y);
if (op_ret < 0) {
ldpp_dout(this, 5) << "could not get bucket info for bucket=" << bucket_name << dendl;
return;
@@ -635,7 +635,7 @@ void RGWOp_BILog_Delete::execute(optional_yield y) {
b.name = bn;
b.bucket_id = bucket_instance;
}
- op_ret = driver->get_bucket(s, nullptr, b, &bucket, y);
+ op_ret = driver->load_bucket(s, nullptr, b, &bucket, y);
if (op_ret < 0) {
ldpp_dout(this, 5) << "could not get bucket info for bucket=" << bucket_name << dendl;
return;
@@ -985,7 +985,7 @@ void RGWOp_BILog_Status::execute(optional_yield y)
// read the bucket instance info for num_shards
std::unique_ptr<rgw::sal::Bucket> bucket;
- op_ret = driver->get_bucket(s, nullptr, b, &bucket, y);
+ op_ret = driver->load_bucket(s, nullptr, b, &bucket, y);
if (op_ret < 0) {
ldpp_dout(this, 4) << "failed to read bucket info: " << cpp_strerror(op_ret) << dendl;
return;
@@ -1069,7 +1069,7 @@ void RGWOp_BILog_Status::execute(optional_yield y)
if (*pipe.dest.bucket != pinfo->bucket) {
opt_dest_info.emplace();
std::unique_ptr<rgw::sal::Bucket> dest_bucket;
- op_ret = driver->get_bucket(s, nullptr, *pipe.dest.bucket, &dest_bucket, y);
+ op_ret = driver->load_bucket(s, nullptr, *pipe.dest.bucket, &dest_bucket, y);
if (op_ret < 0) {
ldpp_dout(this, 4) << "failed to read target bucket info (bucket=: " << cpp_strerror(op_ret) << dendl;
return;
diff --git a/src/rgw/driver/rados/rgw_sal_rados.cc b/src/rgw/driver/rados/rgw_sal_rados.cc
index bc6efa46196..2c526ec940d 100644
--- a/src/rgw/driver/rados/rgw_sal_rados.cc
+++ b/src/rgw/driver/rados/rgw_sal_rados.cc
@@ -146,7 +146,7 @@ int RadosUser::create_bucket(const DoutPrefixProvider* dpp,
obj_version objv,* pobjv = NULL;
/* If it exists, look it up; otherwise create it */
- ret = store->get_bucket(dpp, this, b, &bucket, y);
+ ret = store->load_bucket(dpp, this, b, &bucket, y);
if (ret < 0 && ret != -ENOENT)
return ret;
@@ -1055,41 +1055,29 @@ std::unique_ptr<Object> RadosStore::get_object(const rgw_obj_key& k)
return std::make_unique<RadosObject>(this, k);
}
-int RadosStore::get_bucket(const DoutPrefixProvider* dpp, User* u, const rgw_bucket& b, std::unique_ptr<Bucket>* bucket, optional_yield y)
+std::unique_ptr<Bucket> RadosStore::get_bucket(User* u, const RGWBucketInfo& i)
{
- int ret;
- Bucket* bp;
-
- bp = new RadosBucket(this, b, u);
- ret = bp->load_bucket(dpp, y);
- if (ret < 0) {
- delete bp;
- return ret;
- }
-
- bucket->reset(bp);
- return 0;
+ /* Don't need to fetch the bucket info, use the provided one */
+ return std::make_unique<RadosBucket>(this, i, u);
}
-int RadosStore::get_bucket(User* u, const RGWBucketInfo& i, std::unique_ptr<Bucket>* bucket)
+int RadosStore::load_bucket(const DoutPrefixProvider* dpp, User* u, const rgw_bucket& b,
+ std::unique_ptr<Bucket>* bucket, optional_yield y)
{
- Bucket* bp;
-
- bp = new RadosBucket(this, i, u);
- /* Don't need to fetch the bucket info, use the provided one */
-
- bucket->reset(bp);
- return 0;
+ *bucket = std::make_unique<RadosBucket>(this, b, u);
+ return (*bucket)->load_bucket(dpp, y);
}
-int RadosStore::get_bucket(const DoutPrefixProvider* dpp, User* u, const std::string& tenant, const std::string& name, std::unique_ptr<Bucket>* bucket, optional_yield y)
+int RadosStore::load_bucket(const DoutPrefixProvider* dpp, User* u,
+ const std::string& tenant, const std::string& name,
+ std::unique_ptr<Bucket>* bucket, optional_yield y)
{
rgw_bucket b;
b.tenant = tenant;
b.name = name;
- return get_bucket(dpp, u, b, bucket, y);
+ return load_bucket(dpp, u, b, bucket, y);
}
bool RadosStore::is_meta_master()
diff --git a/src/rgw/driver/rados/rgw_sal_rados.h b/src/rgw/driver/rados/rgw_sal_rados.h
index f542a68d047..84a0b6bf951 100644
--- a/src/rgw/driver/rados/rgw_sal_rados.h
+++ b/src/rgw/driver/rados/rgw_sal_rados.h
@@ -137,9 +137,12 @@ class RadosStore : public StoreDriver {
virtual int get_user_by_email(const DoutPrefixProvider* dpp, const std::string& email, optional_yield y, std::unique_ptr<User>* user) override;
virtual int get_user_by_swift(const DoutPrefixProvider* dpp, const std::string& user_str, optional_yield y, std::unique_ptr<User>* user) override;
virtual std::unique_ptr<Object> get_object(const rgw_obj_key& k) override;
- virtual int get_bucket(const DoutPrefixProvider* dpp, User* u, const rgw_bucket& b, std::unique_ptr<Bucket>* bucket, optional_yield y) override;
- virtual int get_bucket(User* u, const RGWBucketInfo& i, std::unique_ptr<Bucket>* bucket) override;
- virtual int get_bucket(const DoutPrefixProvider* dpp, User* u, const std::string& tenant, const std::string&name, std::unique_ptr<Bucket>* bucket, optional_yield y) override;
+ std::unique_ptr<Bucket> get_bucket(User* u, const RGWBucketInfo& i) override;
+ int load_bucket(const DoutPrefixProvider* dpp, User* u, const rgw_bucket& b,
+ std::unique_ptr<Bucket>* bucket, optional_yield y) override;
+ int load_bucket(const DoutPrefixProvider* dpp, User* u,
+ const std::string& tenant, const std::string& name,
+ std::unique_ptr<Bucket>* bucket, optional_yield y) override;
virtual bool is_meta_master() override;
virtual int forward_request_to_master(const DoutPrefixProvider *dpp, User* user, obj_version* objv,
bufferlist& in_data, JSONParser* jp, req_info& info,
diff --git a/src/rgw/driver/rados/rgw_tools.cc b/src/rgw/driver/rados/rgw_tools.cc
index 17c72012ab6..a3877c0b467 100644
--- a/src/rgw/driver/rados/rgw_tools.cc
+++ b/src/rgw/driver/rados/rgw_tools.cc
@@ -285,7 +285,7 @@ int RGWDataAccess::Bucket::finish_init()
int RGWDataAccess::Bucket::init(const DoutPrefixProvider *dpp, optional_yield y)
{
std::unique_ptr<rgw::sal::Bucket> bucket;
- int ret = sd->driver->get_bucket(dpp, nullptr, tenant, name, &bucket, y);
+ int ret = sd->driver->load_bucket(dpp, nullptr, tenant, name, &bucket, y);
if (ret < 0) {
return ret;
}
@@ -327,8 +327,7 @@ int RGWDataAccess::Object::put(bufferlist& data,
rgw::BlockingAioThrottle aio(driver->ctx()->_conf->rgw_put_obj_min_window_size);
- std::unique_ptr<rgw::sal::Bucket> b;
- driver->get_bucket(NULL, bucket_info, &b);
+ std::unique_ptr<rgw::sal::Bucket> b = driver->get_bucket(nullptr, bucket_info);
std::unique_ptr<rgw::sal::Object> obj = b->get_object(key);
auto& owner = bucket->policy.get_owner();
diff --git a/src/rgw/driver/rados/rgw_user.cc b/src/rgw/driver/rados/rgw_user.cc
index f81254bcfb0..97776f9d5a2 100644
--- a/src/rgw/driver/rados/rgw_user.cc
+++ b/src/rgw/driver/rados/rgw_user.cc
@@ -1579,7 +1579,7 @@ int RGWUser::execute_rename(const DoutPrefixProvider *dpp, RGWUserAdminOpState&
for (const auto& ent : listing.buckets) {
std::unique_ptr<rgw::sal::Bucket> bucket;
- ret = driver->get_bucket(dpp, old_user.get(), ent.bucket, &bucket, y);
+ ret = driver->load_bucket(dpp, old_user.get(), ent.bucket, &bucket, y);
if (ret < 0) {
set_err_msg(err_msg, "failed to fetch bucket info for bucket=" + bucket->get_name());
return ret;
@@ -1785,7 +1785,7 @@ int RGWUser::execute_remove(const DoutPrefixProvider *dpp, RGWUserAdminOpState&
for (const auto& ent : listing.buckets) {
std::unique_ptr<rgw::sal::Bucket> bucket;
- ret = driver->get_bucket(dpp, user, ent.bucket, &bucket, y);
+ ret = driver->load_bucket(dpp, user, ent.bucket, &bucket, y);
if (ret < 0) {
set_err_msg(err_msg, "unable to load bucket " + ent.bucket.name);
return ret;
diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc
index ced41f87822..061464f0c2c 100644
--- a/src/rgw/rgw_admin.cc
+++ b/src/rgw/rgw_admin.cc
@@ -1192,7 +1192,7 @@ public:
static int init_bucket(rgw::sal::User* user, const rgw_bucket& b,
std::unique_ptr<rgw::sal::Bucket>* bucket)
{
- return driver->get_bucket(dpp(), user, b, bucket, null_yield);
+ return driver->load_bucket(dpp(), user, b, bucket, null_yield);
}
static int init_bucket(rgw::sal::User* user,
@@ -1407,7 +1407,7 @@ int set_bucket_quota(rgw::sal::Driver* driver, OPT opt_cmd,
bool have_max_size, bool have_max_objects)
{
std::unique_ptr<rgw::sal::Bucket> bucket;
- int r = driver->get_bucket(dpp(), nullptr, tenant_name, bucket_name, &bucket, null_yield);
+ int r = driver->load_bucket(dpp(), nullptr, tenant_name, bucket_name, &bucket, null_yield);
if (r < 0) {
cerr << "could not get bucket info for bucket=" << bucket_name << ": " << cpp_strerror(-r) << std::endl;
return -r;
@@ -1431,7 +1431,7 @@ int set_bucket_ratelimit(rgw::sal::Driver* driver, OPT opt_cmd,
bool have_max_read_bytes, bool have_max_write_bytes)
{
std::unique_ptr<rgw::sal::Bucket> bucket;
- int r = driver->get_bucket(dpp(), nullptr, tenant_name, bucket_name, &bucket, null_yield);
+ int r = driver->load_bucket(dpp(), nullptr, tenant_name, bucket_name, &bucket, null_yield);
if (r < 0) {
cerr << "could not get bucket info for bucket=" << bucket_name << ": " << cpp_strerror(-r) << std::endl;
return -r;
@@ -1534,7 +1534,7 @@ int show_bucket_ratelimit(rgw::sal::Driver* driver, const string& tenant_name,
const string& bucket_name, Formatter *formatter)
{
std::unique_ptr<rgw::sal::Bucket> bucket;
- int r = driver->get_bucket(dpp(), nullptr, tenant_name, bucket_name, &bucket, null_yield);
+ int r = driver->load_bucket(dpp(), nullptr, tenant_name, bucket_name, &bucket, null_yield);
if (r < 0) {
cerr << "could not get bucket info for bucket=" << bucket_name << ": " << cpp_strerror(-r) << std::endl;
return -r;
diff --git a/src/rgw/rgw_flight.cc b/src/rgw/rgw_flight.cc
index f37d934b333..7cc8a460dc4 100644
--- a/src/rgw/rgw_flight.cc
+++ b/src/rgw/rgw_flight.cc
@@ -688,8 +688,8 @@ arw::Status FlightServer::DoGet(const flt::ServerCallContext &context,
std::unique_ptr<rgw::sal::Bucket> bucket;
- ret = driver->get_bucket(&dp, &(*user), fd.tenant_name, fd.bucket_name,
- &bucket, null_yield);
+ ret = driver->load_bucket(&dp, &(*user), fd.tenant_name, fd.bucket_name,
+ &bucket, null_yield);
if (ret < 0) {
ERROR << "get_bucket returned " << ret << dendl;
// TODO return something
diff --git a/src/rgw/rgw_lc.cc b/src/rgw/rgw_lc.cc
index 15e70977e72..862a2d0191c 100644
--- a/src/rgw/rgw_lc.cc
+++ b/src/rgw/rgw_lc.cc
@@ -1615,7 +1615,7 @@ int RGWLC::bucket_lc_process(string& shard_id, LCWorker* worker,
return 0;
}
- int ret = driver->get_bucket(this, nullptr, bucket_tenant, bucket_name, &bucket, null_yield);
+ int ret = driver->load_bucket(this, nullptr, bucket_tenant, bucket_name, &bucket, null_yield);
if (ret < 0) {
ldpp_dout(this, 0) << "LC:get_bucket for " << bucket_name
<< " failed" << dendl;
diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc
index 6f42f03a118..607633534f1 100644
--- a/src/rgw/rgw_op.cc
+++ b/src/rgw/rgw_op.cc
@@ -490,10 +490,10 @@ int rgw_build_bucket_policies(const DoutPrefixProvider *dpp, rgw::sal::Driver* d
/* check if copy source is within the current domain */
if (!s->src_bucket_name.empty()) {
std::unique_ptr<rgw::sal::Bucket> src_bucket;
- ret = driver->get_bucket(dpp, nullptr,
- rgw_bucket_key(s->src_tenant_name,
- s->src_bucket_name),
- &src_bucket, y);
+ ret = driver->load_bucket(dpp, nullptr,
+ rgw_bucket_key(s->src_tenant_name,
+ s->src_bucket_name),
+ &src_bucket, y);
if (ret == 0) {
string& zonegroup = src_bucket->get_info().zonegroup;
s->local_source = driver->get_zone()->get_zonegroup().equals(zonegroup);
@@ -513,7 +513,10 @@ int rgw_build_bucket_policies(const DoutPrefixProvider *dpp, rgw::sal::Driver* d
/* This is the only place that s->bucket is created. It should never be
* overwritten. */
- ret = driver->get_bucket(dpp, s->user.get(), rgw_bucket(s->bucket_tenant, s->bucket_name, s->bucket_instance_id), &s->bucket, y);
+ ret = driver->load_bucket(dpp, s->user.get(),
+ rgw_bucket(s->bucket_tenant, s->bucket_name,
+ s->bucket_instance_id),
+ &s->bucket, y);
if (ret < 0) {
if (ret != -ENOENT) {
string bucket_log;
@@ -1936,7 +1939,8 @@ int RGWGetObj::handle_user_manifest(const char *prefix, optional_yield y)
if (bucket_name.compare(s->bucket->get_name()) != 0) {
map<string, bufferlist> bucket_attrs;
- r = driver->get_bucket(this, s->user.get(), s->user->get_tenant(), bucket_name, &ubucket, y);
+ r = driver->load_bucket(this, s->user.get(), s->user->get_tenant(),
+ bucket_name, &ubucket, y);
if (r < 0) {
ldpp_dout(this, 0) << "could not get bucket info for bucket="
<< bucket_name << dendl;
@@ -2066,7 +2070,8 @@ int RGWGetObj::handle_slo_manifest(bufferlist& bl, optional_yield y)
RGWAccessControlPolicy& _bucket_acl = allocated_acls.back();
std::unique_ptr<rgw::sal::Bucket> tmp_bucket;
- int r = driver->get_bucket(this, s->user.get(), s->user->get_tenant(), bucket_name, &tmp_bucket, y);
+ int r = driver->load_bucket(this, s->user.get(), s->user->get_tenant(),
+ bucket_name, &tmp_bucket, y);
if (r < 0) {
ldpp_dout(this, 0) << "could not get bucket info for bucket="
<< bucket_name << dendl;
@@ -2974,7 +2979,7 @@ void RGWStatBucket::execute(optional_yield y)
return;
}
- op_ret = driver->get_bucket(this, s->user.get(), s->bucket->get_key(), &bucket, y);
+ op_ret = driver->load_bucket(this, s->user.get(), s->bucket->get_key(), &bucket, y);
if (op_ret) {
return;
}
@@ -3368,8 +3373,8 @@ void RGWCreateBucket::execute(optional_yield y)
* specific request */
{
std::unique_ptr<rgw::sal::Bucket> tmp_bucket;
- op_ret = driver->get_bucket(this, s->user.get(), s->bucket_tenant,
- s->bucket_name, &tmp_bucket, y);
+ op_ret = driver->load_bucket(this, s->user.get(), s->bucket_tenant,
+ s->bucket_name, &tmp_bucket, y);
if (op_ret < 0 && op_ret != -ENOENT)
return;
s->bucket_exists = (op_ret != -ENOENT);
@@ -3668,8 +3673,8 @@ int RGWPutObj::init_processing(optional_yield y) {
}
}
std::unique_ptr<rgw::sal::Bucket> bucket;
- ret = driver->get_bucket(this, s->user.get(), copy_source_tenant_name, copy_source_bucket_name,
- &bucket, y);
+ ret = driver->load_bucket(this, s->user.get(), copy_source_tenant_name,
+ copy_source_bucket_name, &bucket, y);
if (ret < 0) {
ldpp_dout(this, 5) << __func__ << "(): get_bucket() returned ret=" << ret << dendl;
if (ret == -ENOENT) {
@@ -3730,20 +3735,16 @@ int RGWPutObj::verify_permission(optional_yield y)
RGWAccessControlPolicy cs_acl(s->cct);
boost::optional<Policy> policy;
map<string, bufferlist> cs_attrs;
- std::unique_ptr<rgw::sal::Bucket> cs_bucket;
- int ret = driver->get_bucket(NULL, copy_source_bucket_info, &cs_bucket);
- if (ret < 0)
- return ret;
-
- std::unique_ptr<rgw::sal::Object> cs_object =
- cs_bucket->get_object(rgw_obj_key(copy_source_object_name, copy_source_version_id));
-
+ auto cs_bucket = driver->get_bucket(nullptr, copy_source_bucket_info);
+ auto cs_object = cs_bucket->get_object(rgw_obj_key(copy_source_object_name,
+ copy_source_version_id));
cs_object->set_atomic();
cs_object->set_prefetch_data();
/* check source object permissions */
- if (ret = read_obj_policy(this, driver, s, copy_source_bucket_info, cs_attrs, &cs_acl, nullptr,
- policy, cs_bucket.get(), cs_object.get(), y, true); ret < 0) {
+ int ret = read_obj_policy(this, driver, s, copy_source_bucket_info, cs_attrs, &cs_acl, nullptr,
+ policy, cs_bucket.get(), cs_object.get(), y, true);
+ if (ret < 0) {
return ret;
}
@@ -3797,10 +3798,10 @@ int RGWPutObj::verify_permission(optional_yield y)
return -EACCES;
}
- auto op_ret = get_params(y);
- if (op_ret < 0) {
- ldpp_dout(this, 20) << "get_params() returned ret=" << op_ret << dendl;
- return op_ret;
+ int ret = get_params(y);
+ if (ret < 0) {
+ ldpp_dout(this, 20) << "get_params() returned ret=" << ret << dendl;
+ return ret;
}
if (s->iam_policy || ! s->iam_user_policies.empty() || !s->session_policies.empty()) {
@@ -3920,13 +3921,10 @@ int RGWPutObj::get_data(const off_t fst, const off_t lst, bufferlist& bl)
new_ofs = fst;
new_end = lst;
- std::unique_ptr<rgw::sal::Bucket> bucket;
- ret = driver->get_bucket(nullptr, copy_source_bucket_info, &bucket);
- if (ret < 0)
- return ret;
-
- std::unique_ptr<rgw::sal::Object> obj = bucket->get_object(rgw_obj_key(copy_source_object_name, copy_source_version_id));
- std::unique_ptr<rgw::sal::Object::ReadOp> read_op(obj->get_read_op());
+ auto bucket = driver->get_bucket(nullptr, copy_source_bucket_info);
+ auto obj = bucket->get_object(rgw_obj_key(copy_source_object_name,
+ copy_source_version_id));
+ auto read_op = obj->get_read_op();
ret = read_op->prepare(s->yield, this);
if (ret < 0)
@@ -4184,14 +4182,9 @@ void RGWPutObj::execute(optional_yield y)
return;
}
if ((! copy_source.empty()) && !copy_source_range) {
- std::unique_ptr<rgw::sal::Bucket> bucket;
- op_ret = driver->get_bucket(nullptr, copy_source_bucket_info, &bucket);
- if (op_ret < 0) {
- ldpp_dout(this, 0) << "ERROR: failed to get bucket with error" << op_ret << dendl;
- return;
- }
- std::unique_ptr<rgw::sal::Object> obj =
- bucket->get_object(rgw_obj_key(copy_source_object_name, copy_source_version_id));
+ auto bucket = driver->get_bucket(nullptr, copy_source_bucket_info);
+ auto obj = bucket->get_object(rgw_obj_key(copy_source_object_name,
+ copy_source_version_id));
RGWObjState *astate;
op_ret = obj->get_obj_state(this, &astate, s->yield);
@@ -5363,10 +5356,10 @@ int RGWCopyObj::init_processing(optional_yield y)
return op_ret;
}
- op_ret = driver->get_bucket(this, s->user.get(),
- rgw_bucket_key(s->src_tenant_name,
- s->src_bucket_name),
- &src_bucket, y);
+ op_ret = driver->load_bucket(this, s->user.get(),
+ rgw_bucket_key(s->src_tenant_name,
+ s->src_bucket_name),
+ &src_bucket, y);
if (op_ret < 0) {
if (op_ret == -ENOENT) {
op_ret = -ERR_NO_SUCH_BUCKET;
@@ -7322,12 +7315,8 @@ bool RGWBulkDelete::Deleter::delete_single(const acct_path_t& path, optional_yie
ACLOwner bowner;
RGWObjVersionTracker ot;
- int ret = driver->get_bucket(dpp, s->user.get(), s->user->get_tenant(), path.bucket_name, &bucket, y);
- if (ret < 0) {
- goto binfo_fail;
- }
-
- ret = bucket->load_bucket(dpp, s->yield);
+ int ret = driver->load_bucket(dpp, s->user.get(), s->user->get_tenant(),
+ path.bucket_name, &bucket, y);
if (ret < 0) {
goto binfo_fail;
}
@@ -7700,7 +7689,8 @@ int RGWBulkUploadOp::handle_file(const std::string_view path,
std::unique_ptr<rgw::sal::Bucket> bucket;
ACLOwner bowner;
- op_ret = driver->get_bucket(this, s->user.get(), rgw_bucket(rgw_bucket_key(s->user->get_tenant(), bucket_name)), &bucket, y);
+ op_ret = driver->load_bucket(this, s->user.get(), s->user->get_tenant(),
+ bucket_name, &bucket, y);
if (op_ret < 0) {
if (op_ret == -ENOENT) {
ldpp_dout(this, 20) << "non existent directory=" << bucket_name << dendl;
diff --git a/src/rgw/rgw_orphan.cc b/src/rgw/rgw_orphan.cc
index 75c7f9b0907..491b25dacb6 100644
--- a/src/rgw/rgw_orphan.cc
+++ b/src/rgw/rgw_orphan.cc
@@ -502,7 +502,7 @@ int RGWOrphanSearch::build_linked_oids_for_bucket(const DoutPrefixProvider *dpp,
}
std::unique_ptr<rgw::sal::Bucket> cur_bucket;
- ret = store->get_bucket(dpp, nullptr, orphan_bucket, &cur_bucket, null_yield);
+ ret = store->load_bucket(dpp, nullptr, orphan_bucket, &cur_bucket, null_yield);
if (ret < 0) {
if (ret == -ENOENT) {
/* probably raced with bucket removal */
@@ -529,7 +529,7 @@ int RGWOrphanSearch::build_linked_oids_for_bucket(const DoutPrefixProvider *dpp,
rgw_bucket b;
rgw_bucket_parse_bucket_key(store->ctx(), bucket_instance_id, &b, nullptr);
std::unique_ptr<rgw::sal::Bucket> bucket;
- ret = store->get_bucket(dpp, nullptr, b, &bucket, null_yield);
+ ret = store->load_bucket(dpp, nullptr, b, &bucket, null_yield);
if (ret < 0) {
if (ret == -ENOENT) {
/* probably raced with bucket removal */
@@ -1241,8 +1241,7 @@ int RGWRadosList::process_bucket(
continue;
}
- std::unique_ptr<rgw::sal::Bucket> bucket;
- store->get_bucket(nullptr, bucket_info, &bucket);
+ auto bucket = store->get_bucket(nullptr, bucket_info);
// we need to do this in two cases below, so use a lambda
auto do_stat_key =
[&](const rgw_obj_key& key) -> int {
@@ -1389,7 +1388,7 @@ int RGWRadosList::run(const DoutPrefixProvider *dpp,
bucket_process_map.erase(front);
std::unique_ptr<rgw::sal::Bucket> bucket;
- ret = store->get_bucket(dpp, nullptr, tenant_name, bucket_name, &bucket, null_yield);
+ ret = store->load_bucket(dpp, nullptr, tenant_name, bucket_name, &bucket, null_yield);
if (ret == -ENOENT) {
std::cerr << "WARNING: bucket " << bucket_name <<
" does not exist; could it have been deleted very recently?" <<
@@ -1460,7 +1459,7 @@ int RGWRadosList::run(const DoutPrefixProvider *dpp,
// initial bucket
std::unique_ptr<rgw::sal::Bucket> bucket;
- ret = store->get_bucket(dpp, nullptr, tenant_name, start_bucket_name, &bucket, null_yield);
+ ret = store->load_bucket(dpp, nullptr, tenant_name, start_bucket_name, &bucket, null_yield);
if (ret == -ENOENT) {
// bucket deletion race?
return 0;
diff --git a/src/rgw/rgw_quota.cc b/src/rgw/rgw_quota.cc
index 9df4c36d112..3786ccd6729 100644
--- a/src/rgw/rgw_quota.cc
+++ b/src/rgw/rgw_quota.cc
@@ -265,7 +265,7 @@ int BucketAsyncRefreshHandler::init_fetch()
std::unique_ptr<rgw::sal::Bucket> rbucket;
const DoutPrefix dp(driver->ctx(), dout_subsys, "rgw bucket async refresh handler: ");
- int r = driver->get_bucket(&dp, nullptr, bucket, &rbucket, null_yield);
+ int r = driver->load_bucket(&dp, nullptr, bucket, &rbucket, null_yield);
if (r < 0) {
ldpp_dout(&dp, 0) << "could not get bucket info for bucket=" << bucket << " r=" << r << dendl;
return r;
@@ -340,7 +340,7 @@ int RGWBucketStatsCache::fetch_stats_from_storage(const rgw_user& _u, const rgw_
std::unique_ptr<rgw::sal::User> user = driver->get_user(_u);
std::unique_ptr<rgw::sal::Bucket> bucket;
- int r = driver->get_bucket(dpp, user.get(), _b, &bucket, y);
+ int r = driver->load_bucket(dpp, user.get(), _b, &bucket, y);
if (r < 0) {
ldpp_dout(dpp, 0) << "could not get bucket info for bucket=" << _b << " r=" << r << dendl;
return r;
@@ -613,7 +613,7 @@ int RGWUserStatsCache::sync_bucket(const rgw_user& _u, rgw_bucket& _b, optional_
std::unique_ptr<rgw::sal::User> user = driver->get_user(_u);
std::unique_ptr<rgw::sal::Bucket> bucket;
- int r = driver->get_bucket(dpp, user.get(), _b, &bucket, y);
+ int r = driver->load_bucket(dpp, user.get(), _b, &bucket, y);
if (r < 0) {
ldpp_dout(dpp, 0) << "could not get bucket info for bucket=" << _b << " r=" << r << dendl;
return r;
diff --git a/src/rgw/rgw_rest_pubsub.cc b/src/rgw/rgw_rest_pubsub.cc
index da81711511c..c3214123fb8 100644
--- a/src/rgw/rgw_rest_pubsub.cc
+++ b/src/rgw/rgw_rest_pubsub.cc
@@ -962,7 +962,7 @@ void RGWPSCreateNotifOp::execute(optional_yield y) {
std::unique_ptr<rgw::sal::User> user = driver->get_user(s->owner.get_id());
std::unique_ptr<rgw::sal::Bucket> bucket;
- op_ret = driver->get_bucket(this, user.get(), s->bucket_tenant, s->bucket_name, &bucket, y);
+ op_ret = driver->load_bucket(this, user.get(), s->bucket_tenant, s->bucket_name, &bucket, y);
if (op_ret < 0) {
ldpp_dout(this, 1) << "failed to get bucket '" <<
(s->bucket_tenant.empty() ? s->bucket_name : s->bucket_tenant + ":" + s->bucket_name) <<
@@ -1110,7 +1110,7 @@ void RGWPSDeleteNotifOp::execute(optional_yield y) {
std::unique_ptr<rgw::sal::User> user = driver->get_user(s->owner.get_id());
std::unique_ptr<rgw::sal::Bucket> bucket;
- op_ret = driver->get_bucket(this, user.get(), s->bucket_tenant, s->bucket_name, &bucket, y);
+ op_ret = driver->load_bucket(this, user.get(), s->bucket_tenant, s->bucket_name, &bucket, y);
if (op_ret < 0) {
ldpp_dout(this, 1) << "failed to get bucket '" <<
(s->bucket_tenant.empty() ? s->bucket_name : s->bucket_tenant + ":" + s->bucket_name) <<
@@ -1207,7 +1207,7 @@ void RGWPSListNotifsOp::execute(optional_yield y) {
std::unique_ptr<rgw::sal::User> user = driver->get_user(s->owner.get_id());
std::unique_ptr<rgw::sal::Bucket> bucket;
- op_ret = driver->get_bucket(this, user.get(), s->bucket_tenant, s->bucket_name, &bucket, y);
+ op_ret = driver->load_bucket(this, user.get(), s->bucket_tenant, s->bucket_name, &bucket, y);
if (op_ret < 0) {
ldpp_dout(this, 1) << "failed to get bucket '" <<
(s->bucket_tenant.empty() ? s->bucket_name : s->bucket_tenant + ":" + s->bucket_name) <<
diff --git a/src/rgw/rgw_rest_ratelimit.cc b/src/rgw/rgw_rest_ratelimit.cc
index b482b4f82c4..5e37ad2c74c 100644
--- a/src/rgw/rgw_rest_ratelimit.cc
+++ b/src/rgw/rgw_rest_ratelimit.cc
@@ -36,7 +36,7 @@ void RGWOp_Ratelimit_Info::execute(optional_yield y)
if (ratelimit_scope == "bucket" && !bucket_name.empty() && !global) {
std::unique_ptr<rgw::sal::Bucket> bucket;
- int r = driver->get_bucket(s, nullptr, tenant_name, bucket_name, &bucket, y);
+ int r = driver->load_bucket(s, nullptr, tenant_name, bucket_name, &bucket, y);
if (r != 0) {
op_ret = r;
ldpp_dout(this, 0) << "Error on getting bucket info" << dendl;
@@ -273,7 +273,7 @@ void RGWOp_Ratelimit_Set::execute(optional_yield y)
if (ratelimit_scope == "bucket" && !bucket_name.empty() && !global) {
ldpp_dout(this, 0) << "getting bucket info" << dendl;
std::unique_ptr<rgw::sal::Bucket> bucket;
- op_ret = driver->get_bucket(this, nullptr, tenant_name, bucket_name, &bucket, y);
+ op_ret = driver->load_bucket(this, nullptr, tenant_name, bucket_name, &bucket, y);
if (op_ret) {
ldpp_dout(this, 0) << "Error on getting bucket info" << dendl;
return;
diff --git a/src/rgw/rgw_rest_swift.cc b/src/rgw/rgw_rest_swift.cc
index 6efc7bd8e1c..082bccf7fb2 100644
--- a/src/rgw/rgw_rest_swift.cc
+++ b/src/rgw/rgw_rest_swift.cc
@@ -857,7 +857,7 @@ int RGWPutObj_ObjStore_SWIFT::update_slo_segment_size(rgw_slo_entry& entry) {
std::unique_ptr<rgw::sal::Bucket> bucket;
if (bucket_name.compare(s->bucket->get_name()) != 0) {
- r = driver->get_bucket(s, s->user.get(), s->user->get_id().tenant, bucket_name, &bucket, s->yield);
+ r = driver->load_bucket(s, s->user.get(), s->user->get_id().tenant, bucket_name, &bucket, s->yield);
if (r < 0) {
ldpp_dout(this, 0) << "could not get bucket info for bucket="
<< bucket_name << dendl;
@@ -2120,7 +2120,7 @@ void RGWFormPost::get_owner_info(const req_state* const s,
/* Need to get user info of bucket owner. */
std::unique_ptr<rgw::sal::Bucket> bucket;
- int ret = driver->get_bucket(s, user.get(), bucket_tenant, bucket_name, &bucket, s->yield);
+ int ret = driver->load_bucket(s, user.get(), bucket_tenant, bucket_name, &bucket, s->yield);
if (ret < 0) {
throw ret;
}
diff --git a/src/rgw/rgw_rest_usage.cc b/src/rgw/rgw_rest_usage.cc
index 0ab93fd9340..5f9d5c8a529 100644
--- a/src/rgw/rgw_rest_usage.cc
+++ b/src/rgw/rgw_rest_usage.cc
@@ -40,7 +40,10 @@ void RGWOp_Usage_Get::execute(optional_yield y) {
std::unique_ptr<rgw::sal::Bucket> bucket;
if (!bucket_name.empty()) {
- driver->get_bucket(nullptr, user.get(), std::string(), bucket_name, &bucket, null_yield);
+ op_ret = driver->load_bucket(nullptr, user.get(), std::string(), bucket_name, &bucket, null_yield);
+ if (op_ret < 0) {
+ return;
+ }
}
RESTArgs::get_epoch(s, "start", 0, &start);
@@ -87,7 +90,10 @@ void RGWOp_Usage_Delete::execute(optional_yield y) {
std::unique_ptr<rgw::sal::Bucket> bucket;
if (!bucket_name.empty()) {
- driver->get_bucket(nullptr, user.get(), std::string(), bucket_name, &bucket, null_yield);
+ op_ret = driver->load_bucket(nullptr, user.get(), std::string(), bucket_name, &bucket, null_yield);
+ if (op_ret < 0) {
+ return;
+ }
}
RESTArgs::get_epoch(s, "start", 0, &start);
diff --git a/src/rgw/rgw_sal.h b/src/rgw/rgw_sal.h
index d8072ca6f6f..de5a2f7dda1 100644
--- a/src/rgw/rgw_sal.h
+++ b/src/rgw/rgw_sal.h
@@ -290,11 +290,15 @@ class Driver {
* there is a Bucket, otherwise use the get_object() in the Bucket class. */
virtual std::unique_ptr<Object> get_object(const rgw_obj_key& k) = 0;
/** Get a Bucket by info. Does not query the driver, just uses the give bucket info. */
- virtual int get_bucket(User* u, const RGWBucketInfo& i, std::unique_ptr<Bucket>* bucket) = 0;
- /** Lookup a Bucket by key. Queries driver for bucket info. */
- virtual int get_bucket(const DoutPrefixProvider* dpp, User* u, const rgw_bucket& b, std::unique_ptr<Bucket>* bucket, optional_yield y) = 0;
- /** Lookup a Bucket by name. Queries driver for bucket info. */
- virtual int get_bucket(const DoutPrefixProvider* dpp, User* u, const std::string& tenant, const std::string& name, std::unique_ptr<Bucket>* bucket, optional_yield y) = 0;
+ virtual std::unique_ptr<Bucket> get_bucket(User* u, const RGWBucketInfo& i) = 0;
+ /** Load a Bucket by key. Queries driver for bucket info. On -ENOENT, the
+ * bucket must still be allocated to support bucket->create(). */
+ virtual int load_bucket(const DoutPrefixProvider* dpp, User* u, const rgw_bucket& b,
+ std::unique_ptr<Bucket>* bucket, optional_yield y) = 0;
+ /** Load a Bucket by name. Queries driver for bucket info. */
+ virtual int load_bucket(const DoutPrefixProvider* dpp, User* u,
+ const std::string& tenant, const std::string& name,
+ std::unique_ptr<Bucket>* bucket, optional_yield y) = 0;
/** For multisite, this driver is the zone's master */
virtual bool is_meta_master() = 0;
/** For multisite, forward an OP to the zone's master */
diff --git a/src/rgw/rgw_sal_dbstore.cc b/src/rgw/rgw_sal_dbstore.cc
index 5e429ba5c4c..7f9ad515ec2 100644
--- a/src/rgw/rgw_sal_dbstore.cc
+++ b/src/rgw/rgw_sal_dbstore.cc
@@ -84,7 +84,7 @@ namespace rgw::sal {
obj_version objv, *pobjv = NULL;
/* If it exists, look it up; otherwise create it */
- ret = store->get_bucket(dpp, this, b, &bucket, y);
+ ret = store->load_bucket(dpp, this, b, &bucket, y);
if (ret < 0 && ret != -ENOENT)
return ret;
@@ -1633,41 +1633,29 @@ namespace rgw::sal {
}
- int DBStore::get_bucket(const DoutPrefixProvider *dpp, User* u, const rgw_bucket& b, std::unique_ptr<Bucket>* bucket, optional_yield y)
+ std::unique_ptr<Bucket> DBStore::get_bucket(User* u, const RGWBucketInfo& i)
{
- int ret;
- Bucket* bp;
-
- bp = new DBBucket(this, b, u);
- ret = bp->load_bucket(dpp, y);
- if (ret < 0) {
- delete bp;
- return ret;
- }
-
- bucket->reset(bp);
- return 0;
+ /* Don't need to fetch the bucket info, use the provided one */
+ return std::make_unique<DBBucket>(this, i, u);
}
- int DBStore::get_bucket(User* u, const RGWBucketInfo& i, std::unique_ptr<Bucket>* bucket)
+ int DBStore::load_bucket(const DoutPrefixProvider *dpp, User* u, const rgw_bucket& b,
+ std::unique_ptr<Bucket>* bucket, optional_yield y)
{
- Bucket* bp;
-
- bp = new DBBucket(this, i, u);
- /* Don't need to fetch the bucket info, use the provided one */
-
- bucket->reset(bp);
- return 0;
+ *bucket = std::make_unique<DBBucket>(this, b, u);
+ return (*bucket)->load_bucket(dpp, y);
}
- int DBStore::get_bucket(const DoutPrefixProvider *dpp, User* u, const std::string& tenant, const std::string& name, std::unique_ptr<Bucket>* bucket, optional_yield y)
+ int DBStore::load_bucket(const DoutPrefixProvider *dpp, User* u,
+ const std::string& tenant, const std::string& name,
+ std::unique_ptr<Bucket>* bucket, optional_yield y)
{
rgw_bucket b;
b.tenant = tenant;
b.name = name;
- return get_bucket(dpp, u, b, bucket, y);
+ return load_bucket(dpp, u, b, bucket, y);
}
bool DBStore::is_meta_master()
diff --git a/src/rgw/rgw_sal_dbstore.h b/src/rgw/rgw_sal_dbstore.h
index 375a4524517..e352af98b14 100644
--- a/src/rgw/rgw_sal_dbstore.h
+++ b/src/rgw/rgw_sal_dbstore.h
@@ -778,9 +778,12 @@ public:
virtual int get_user_by_swift(const DoutPrefixProvider *dpp, const std::string& user_str, optional_yield y, std::unique_ptr<User>* user) override;
virtual std::unique_ptr<Object> get_object(const rgw_obj_key& k) override;
virtual std::string get_cluster_id(const DoutPrefixProvider* dpp, optional_yield y);
- virtual int get_bucket(const DoutPrefixProvider *dpp, User* u, const rgw_bucket& b, std::unique_ptr<Bucket>* bucket, optional_yield y) override;
- virtual int get_bucket(User* u, const RGWBucketInfo& i, std::unique_ptr<Bucket>* bucket) override;
- virtual int get_bucket(const DoutPrefixProvider *dpp, User* u, const std::string& tenant, const std::string&name, std::unique_ptr<Bucket>* bucket, optional_yield y) override;
+ std::unique_ptr<Bucket> get_bucket(User* u, const RGWBucketInfo& i) override;
+ int load_bucket(const DoutPrefixProvider *dpp, User* u, const rgw_bucket& b,
+ std::unique_ptr<Bucket>* bucket, optional_yield y) override;
+ int load_bucket(const DoutPrefixProvider *dpp, User* u,
+ const std::string& tenant, const std::string&name,
+ std::unique_ptr<Bucket>* bucket, optional_yield y) override;
virtual bool is_meta_master() override;
virtual int forward_request_to_master(const DoutPrefixProvider *dpp, User* user, obj_version* objv,
bufferlist& in_data, JSONParser *jp, req_info& info,
diff --git a/src/rgw/rgw_sal_filter.cc b/src/rgw/rgw_sal_filter.cc
index 3f3c5102cb4..fc5eecc008f 100644
--- a/src/rgw/rgw_sal_filter.cc
+++ b/src/rgw/rgw_sal_filter.cc
@@ -161,49 +161,27 @@ std::unique_ptr<Object> FilterDriver::get_object(const rgw_obj_key& k)
return std::make_unique<FilterObject>(std::move(o));
}
-int FilterDriver::get_bucket(const DoutPrefixProvider* dpp, User* u, const rgw_bucket& b, std::unique_ptr<Bucket>* bucket, optional_yield y)
+std::unique_ptr<Bucket> FilterDriver::get_bucket(User* u, const RGWBucketInfo& i)
{
- std::unique_ptr<Bucket> nb;
- int ret;
- User* nu = nextUser(u);
-
- ret = next->get_bucket(dpp, nu, b, &nb, y);
- if (ret != 0)
- return ret;
-
- Bucket* fb = new FilterBucket(std::move(nb), u);
- bucket->reset(fb);
- return 0;
+ return std::make_unique<FilterBucket>(next->get_bucket(nextUser(u), i), u);
}
-int FilterDriver::get_bucket(User* u, const RGWBucketInfo& i, std::unique_ptr<Bucket>* bucket)
+int FilterDriver::load_bucket(const DoutPrefixProvider* dpp, User* u, const rgw_bucket& b, std::unique_ptr<Bucket>* bucket, optional_yield y)
{
std::unique_ptr<Bucket> nb;
- int ret;
- User* nu = nextUser(u);
-
- ret = next->get_bucket(nu, i, &nb);
- if (ret != 0)
- return ret;
-
- Bucket* fb = new FilterBucket(std::move(nb), u);
- bucket->reset(fb);
- return 0;
+ const int ret = next->load_bucket(dpp, nextUser(u), b, &nb, y);
+ *bucket = std::make_unique<FilterBucket>(std::move(nb), u);
+ return ret;
}
-int FilterDriver::get_bucket(const DoutPrefixProvider* dpp, User* u, const std::string& tenant, const std::string& name, std::unique_ptr<Bucket>* bucket, optional_yield y)
+int FilterDriver::load_bucket(const DoutPrefixProvider* dpp, User* u,
+ const std::string& tenant, const std::string& name,
+ std::unique_ptr<Bucket>* bucket, optional_yield y)
{
std::unique_ptr<Bucket> nb;
- int ret;
- User* nu = nextUser(u);
-
- ret = next->get_bucket(dpp, nu, tenant, name, &nb, y);
- if (ret != 0)
- return ret;
-
- Bucket* fb = new FilterBucket(std::move(nb), u);
- bucket->reset(fb);
- return 0;
+ const int ret = next->load_bucket(dpp, nextUser(u), tenant, name, &nb, y);
+ *bucket = std::make_unique<FilterBucket>(std::move(nb), u);
+ return ret;
}
bool FilterDriver::is_meta_master()
diff --git a/src/rgw/rgw_sal_filter.h b/src/rgw/rgw_sal_filter.h
index 5d81bea0e42..e33c84871a7 100644
--- a/src/rgw/rgw_sal_filter.h
+++ b/src/rgw/rgw_sal_filter.h
@@ -159,14 +159,13 @@ public:
std::string& user_str, optional_yield y,
std::unique_ptr<User>* user) override;
virtual std::unique_ptr<Object> get_object(const rgw_obj_key& k) override;
- virtual int get_bucket(User* u, const RGWBucketInfo& i,
- std::unique_ptr<Bucket>* bucket) override;
- virtual int get_bucket(const DoutPrefixProvider* dpp, User* u, const
- rgw_bucket& b, std::unique_ptr<Bucket>* bucket,
- optional_yield y) override;
- virtual int get_bucket(const DoutPrefixProvider* dpp, User* u, const
- std::string& tenant, const std::string& name,
- std::unique_ptr<Bucket>* bucket, optional_yield y) override;
+ std::unique_ptr<Bucket> get_bucket(User* u, const RGWBucketInfo& i) override;
+ int load_bucket(const DoutPrefixProvider* dpp, User* u, const
+ rgw_bucket& b, std::unique_ptr<Bucket>* bucket,
+ optional_yield y) override;
+ int load_bucket(const DoutPrefixProvider* dpp, User* u, const
+ std::string& tenant, const std::string& name,
+ std::unique_ptr<Bucket>* bucket, optional_yield y) override;
virtual bool is_meta_master() override;
virtual int forward_request_to_master(const DoutPrefixProvider *dpp, User* user,
obj_version* objv, bufferlist& in_data,
diff --git a/src/rgw/rgw_swift_auth.cc b/src/rgw/rgw_swift_auth.cc
index 05d4b28c124..852449ad20f 100644
--- a/src/rgw/rgw_swift_auth.cc
+++ b/src/rgw/rgw_swift_auth.cc
@@ -119,7 +119,7 @@ void TempURLEngine::get_owner_info(const DoutPrefixProvider* dpp, const req_stat
b.tenant = std::move(bucket_tenant);
b.name = std::move(bucket_name);
std::unique_ptr<rgw::sal::Bucket> bucket;
- int ret = driver->get_bucket(dpp, nullptr, b, &bucket, s->yield);
+ int ret = driver->load_bucket(dpp, nullptr, b, &bucket, s->yield);
if (ret < 0) {
throw ret;
}
diff --git a/src/rgw/rgw_user.cc b/src/rgw/rgw_user.cc
index 175b2e6b23f..1f88779d935 100644
--- a/src/rgw/rgw_user.cc
+++ b/src/rgw/rgw_user.cc
@@ -30,7 +30,7 @@ int rgw_user_sync_all_stats(const DoutPrefixProvider *dpp, rgw::sal::Driver* dri
for (auto& ent : listing.buckets) {
std::unique_ptr<rgw::sal::Bucket> bucket;
- ret = driver->get_bucket(dpp, user, ent.bucket, &bucket, y);
+ ret = driver->load_bucket(dpp, user, ent.bucket, &bucket, y);
if (ret < 0) {
ldpp_dout(dpp, 0) << "ERROR: could not read bucket info: bucket=" << bucket << " ret=" << ret << dendl;
continue;