From: Casey Bodley Date: Wed, 13 Jul 2022 14:22:09 +0000 (-0400) Subject: rgw: remove RGWSysObjectCtx entirely X-Git-Tag: v18.0.0~432^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3aee2a07975d425332f0746907e87d5f550ccb6b;p=ceph.git rgw: remove RGWSysObjectCtx entirely Signed-off-by: Casey Bodley --- diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 19cf667ecf4a..b7b1608eb70a 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -69,6 +69,7 @@ extern "C" { #include "services/svc_bilog_rados.h" #include "services/svc_mdlog.h" #include "services/svc_meta_be_otp.h" +#include "services/svc_user.h" #include "services/svc_zone.h" #define dout_context g_ceph_context @@ -8397,7 +8398,7 @@ next: "so at most one of the two should be specified" << std::endl; return EINVAL; } - ret = static_cast(store)->ctl()->user->reset_stats(dpp(), user->get_id(), null_yield); + ret = static_cast(store)->svc()->user->reset_bucket_stats(dpp(), user->get_id(), null_yield); if (ret < 0) { cerr << "ERROR: could not reset user stats: " << cpp_strerror(-ret) << std::endl; diff --git a/src/rgw/rgw_bucket.cc b/src/rgw/rgw_bucket.cc index 68fa4064adfd..3eff237aaaa5 100644 --- a/src/rgw/rgw_bucket.cc +++ b/src/rgw/rgw_bucket.cc @@ -2387,12 +2387,15 @@ public: RGWBucketCtl::RGWBucketCtl(RGWSI_Zone *zone_svc, RGWSI_Bucket *bucket_svc, RGWSI_Bucket_Sync *bucket_sync_svc, - RGWSI_BucketIndex *bi_svc) : cct(zone_svc->ctx()) + RGWSI_BucketIndex *bi_svc, + RGWSI_User* user_svc) + : cct(zone_svc->ctx()) { svc.zone = zone_svc; svc.bucket = bucket_svc; svc.bucket_sync = bucket_sync_svc; svc.bi = bi_svc; + svc.user = user_svc; } void RGWBucketCtl::init(RGWUserCtl *user_ctl, @@ -2777,7 +2780,7 @@ int RGWBucketCtl::do_link_bucket(RGWSI_Bucket_EP_Ctx& ctx, } } - ret = ctl.user->add_bucket(dpp, user_id, bucket, creation_time, y); + ret = svc.user->add_bucket(dpp, user_id, bucket, creation_time, y); if (ret < 0) { ldpp_dout(dpp, 0) << "ERROR: error adding bucket to user directory:" << " user=" << user_id @@ -2823,7 +2826,7 @@ int RGWBucketCtl::do_unlink_bucket(RGWSI_Bucket_EP_Ctx& ctx, optional_yield y, const DoutPrefixProvider *dpp) { - int ret = ctl.user->remove_bucket(dpp, user_id, bucket, y); + int ret = svc.user->remove_bucket(dpp, user_id, bucket, y); if (ret < 0) { ldpp_dout(dpp, 0) << "ERROR: error removing bucket from directory: " << cpp_strerror(-ret)<< dendl; @@ -2979,7 +2982,7 @@ int RGWBucketCtl::sync_user_stats(const DoutPrefixProvider *dpp, return r; } - return ctl.user->flush_bucket_stats(dpp, user_id, *pent, y); + return svc.user->flush_bucket_stats(dpp, user_id, *pent, y); } int RGWBucketCtl::get_sync_policy_handler(std::optional zone, diff --git a/src/rgw/rgw_bucket.h b/src/rgw/rgw_bucket.h index 28c315e6ab2e..12eb9836e2d1 100644 --- a/src/rgw/rgw_bucket.h +++ b/src/rgw/rgw_bucket.h @@ -419,6 +419,7 @@ class RGWBucketCtl { RGWSI_Bucket *bucket{nullptr}; RGWSI_Bucket_Sync *bucket_sync{nullptr}; RGWSI_BucketIndex *bi{nullptr}; + RGWSI_User* user = nullptr; } svc; struct Ctl { @@ -437,7 +438,8 @@ public: RGWBucketCtl(RGWSI_Zone *zone_svc, RGWSI_Bucket *bucket_svc, RGWSI_Bucket_Sync *bucket_sync_svc, - RGWSI_BucketIndex *bi_svc); + RGWSI_BucketIndex *bi_svc, + RGWSI_User* user_svc); void init(RGWUserCtl *user_ctl, RGWBucketMetadataHandler *_bm_handler, diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h index c9a831df53eb..4bc18b241363 100644 --- a/src/rgw/rgw_common.h +++ b/src/rgw/rgw_common.h @@ -1545,7 +1545,6 @@ struct req_init_state { #include "rgw_auth.h" class RGWObjectCtx; -class RGWSysObjectCtx; /** Store all the state necessary to complete and respond to an HTTP request*/ struct req_state : DoutPrefixProvider { diff --git a/src/rgw/rgw_cr_rados.cc b/src/rgw/rgw_cr_rados.cc index 6847be5304fb..10e1345f3938 100644 --- a/src/rgw/rgw_cr_rados.cc +++ b/src/rgw/rgw_cr_rados.cc @@ -110,7 +110,7 @@ int RGWAsyncGetSystemObj::_send_request(const DoutPrefixProvider *dpp) { map *pattrs = want_attrs ? &attrs : nullptr; - auto sysobj = obj_ctx.get_obj(obj); + auto sysobj = svc_sysobj->get_obj(obj); return sysobj.rop() .set_objv_tracker(&objv_tracker) .set_attrs(pattrs) @@ -121,7 +121,7 @@ int RGWAsyncGetSystemObj::_send_request(const DoutPrefixProvider *dpp) RGWAsyncGetSystemObj::RGWAsyncGetSystemObj(const DoutPrefixProvider *_dpp, RGWCoroutine *caller, RGWAioCompletionNotifier *cn, RGWSI_SysObj *_svc, RGWObjVersionTracker *_objv_tracker, const rgw_raw_obj& _obj, bool want_attrs, bool raw_attrs) - : RGWAsyncRadosRequest(caller, cn), dpp(_dpp), obj_ctx(_svc), + : RGWAsyncRadosRequest(caller, cn), dpp(_dpp), svc_sysobj(_svc), obj(_obj), want_attrs(want_attrs), raw_attrs(raw_attrs) { if (_objv_tracker) { @@ -150,8 +150,7 @@ int RGWSimpleRadosReadAttrsCR::request_complete() int RGWAsyncPutSystemObj::_send_request(const DoutPrefixProvider *dpp) { - auto obj_ctx = svc->init_obj_ctx(); - auto sysobj = obj_ctx.get_obj(obj); + auto sysobj = svc->get_obj(obj); return sysobj.wop() .set_objv_tracker(&objv_tracker) .set_exclusive(exclusive) @@ -174,8 +173,7 @@ RGWAsyncPutSystemObj::RGWAsyncPutSystemObj(const DoutPrefixProvider *_dpp, int RGWAsyncPutSystemObjAttrs::_send_request(const DoutPrefixProvider *dpp) { - auto obj_ctx = svc->init_obj_ctx(); - auto sysobj = obj_ctx.get_obj(obj); + auto sysobj = svc->get_obj(obj); return sysobj.wop() .set_objv_tracker(&objv_tracker) .set_exclusive(exclusive) @@ -642,8 +640,7 @@ int RGWAsyncGetBucketInstanceInfo::_send_request(const DoutPrefixProvider *dpp) { int r; if (!bucket.bucket_id.empty()) { - RGWSysObjectCtx obj_ctx = store->svc()->sysobj->init_obj_ctx(); - r = store->getRados()->get_bucket_instance_info(obj_ctx, bucket, bucket_info, nullptr, &attrs, null_yield, dpp); + r = store->getRados()->get_bucket_instance_info(bucket, bucket_info, nullptr, &attrs, null_yield, dpp); } else { r = store->ctl()->bucket->read_bucket_info(bucket, &bucket_info, null_yield, dpp, RGWBucketCtl::BucketInstance::GetParams().set_attrs(&attrs)); diff --git a/src/rgw/rgw_cr_rados.h b/src/rgw/rgw_cr_rados.h index bac572223d84..9e380e78ad31 100644 --- a/src/rgw/rgw_cr_rados.h +++ b/src/rgw/rgw_cr_rados.h @@ -320,7 +320,7 @@ private: class RGWAsyncGetSystemObj : public RGWAsyncRadosRequest { const DoutPrefixProvider *dpp; - RGWSysObjectCtx obj_ctx; + RGWSI_SysObj* svc_sysobj; rgw_raw_obj obj; const bool want_attrs; const bool raw_attrs; diff --git a/src/rgw/rgw_data_sync.cc b/src/rgw/rgw_data_sync.cc index ecc7a9596ae8..184f2f85093d 100644 --- a/src/rgw/rgw_data_sync.cc +++ b/src/rgw/rgw_data_sync.cc @@ -5886,8 +5886,7 @@ int rgw_read_bucket_full_sync_status(const DoutPrefixProvider *dpp, get_oid(*pipe.source.zone, *pipe.source.bucket, *pipe.dest.bucket)}; auto svc = store->svc()->sysobj; - auto obj_ctx = svc->init_obj_ctx(); - auto sysobj = svc->get_obj(obj_ctx, obj); + auto sysobj = svc->get_obj(obj); bufferlist bl; int ret = sysobj.rop().read(dpp, &bl, y); if (ret < 0) diff --git a/src/rgw/rgw_lc_tier.cc b/src/rgw/rgw_lc_tier.cc index ba84ef836eb5..41ef42b358ac 100644 --- a/src/rgw/rgw_lc_tier.cc +++ b/src/rgw/rgw_lc_tier.cc @@ -112,10 +112,10 @@ static int read_upload_status(const DoutPrefixProvider *dpp, rgw::sal::Store *st auto& pool = status_obj->pool; const auto oid = status_obj->oid; - auto obj_ctx = rados->svc()->sysobj->init_obj_ctx(); + auto sysobj = rados->svc()->sysobj; bufferlist bl; - ret = rgw_get_system_obj(obj_ctx, pool, oid, bl, nullptr, nullptr, + ret = rgw_get_system_obj(sysobj, pool, oid, bl, nullptr, nullptr, null_yield, dpp); if (ret < 0) { @@ -151,11 +151,11 @@ static int put_upload_status(const DoutPrefixProvider *dpp, rgw::sal::Store *sto auto& pool = status_obj->pool; const auto oid = status_obj->oid; - auto obj_ctx = rados->svc()->sysobj->init_obj_ctx(); + auto sysobj = rados->svc()->sysobj; bufferlist bl; status->encode(bl); - ret = rgw_put_system_obj(dpp, obj_ctx, pool, oid, bl, true, nullptr, + ret = rgw_put_system_obj(dpp, sysobj, pool, oid, bl, true, nullptr, real_time{}, null_yield); return ret; diff --git a/src/rgw/rgw_orphan.cc b/src/rgw/rgw_orphan.cc index 6454189bb688..7322492f1e7f 100644 --- a/src/rgw/rgw_orphan.cc +++ b/src/rgw/rgw_orphan.cc @@ -16,7 +16,6 @@ #include "rgw_sal_rados.h" #include "services/svc_zone.h" -#include "services/svc_sys_obj.h" #define dout_subsys ceph_subsys_rgw @@ -1171,9 +1170,7 @@ int RGWRadosList::process_bucket( ", entries_filter.size=" << entries_filter.size() << dendl; RGWBucketInfo bucket_info; - RGWSysObjectCtx sys_obj_ctx = store->svc()->sysobj->init_obj_ctx(); - int ret = store->getRados()->get_bucket_instance_info(sys_obj_ctx, - bucket_instance_id, + int ret = store->getRados()->get_bucket_instance_info(bucket_instance_id, bucket_info, nullptr, nullptr, diff --git a/src/rgw/rgw_pubsub.cc b/src/rgw/rgw_pubsub.cc index 50073eeaff5b..012648ac3274 100644 --- a/src/rgw/rgw_pubsub.cc +++ b/src/rgw/rgw_pubsub.cc @@ -435,11 +435,10 @@ void rgw_pubsub_sub_config::dump(Formatter *f) const encode_json("s3_id", s3_id, f); } -RGWPubSub::RGWPubSub(rgw::sal::RadosStore* _store, const std::string& _tenant) : - store(_store), - tenant(_tenant), - obj_ctx(store->svc()->sysobj->init_obj_ctx()) { - get_meta_obj(&meta_obj); +RGWPubSub::RGWPubSub(rgw::sal::RadosStore* _store, const std::string& _tenant) + : store(_store), tenant(_tenant), svc_sysobj(store->svc()->sysobj) +{ + get_meta_obj(&meta_obj); } int RGWPubSub::remove(const DoutPrefixProvider *dpp, diff --git a/src/rgw/rgw_pubsub.h b/src/rgw/rgw_pubsub.h index f11b40b14b9f..6335a5cb67ae 100644 --- a/src/rgw/rgw_pubsub.h +++ b/src/rgw/rgw_pubsub.h @@ -601,7 +601,7 @@ class RGWPubSub rgw::sal::RadosStore* store; const std::string tenant; - RGWSysObjectCtx obj_ctx; + RGWSI_SysObj* svc_sysobj; rgw_raw_obj meta_obj; @@ -785,7 +785,7 @@ template int RGWPubSub::read(const rgw_raw_obj& obj, T* result, RGWObjVersionTracker* objv_tracker) { bufferlist bl; - int ret = rgw_get_system_obj(obj_ctx, + int ret = rgw_get_system_obj(svc_sysobj, obj.pool, obj.oid, bl, objv_tracker, @@ -811,15 +811,8 @@ int RGWPubSub::write(const DoutPrefixProvider *dpp, const rgw_raw_obj& obj, cons bufferlist bl; encode(info, bl); - int ret = rgw_put_system_obj(dpp, obj_ctx, obj.pool, obj.oid, - bl, false, objv_tracker, - real_time(), y); - if (ret < 0) { - return ret; - } - - obj_ctx.invalidate(obj); - return 0; + return rgw_put_system_obj(dpp, svc_sysobj, obj.pool, obj.oid, + bl, false, objv_tracker, real_time(), y); } #endif diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 2bbec2b1fbdf..89ac84fb360f 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -1738,10 +1738,8 @@ int RGWRados::Bucket::update_bucket_id(const string& new_bucket_id, const DoutPr rgw_bucket bucket = bucket_info.bucket; bucket.update_bucket_id(new_bucket_id); - auto obj_ctx = store->svc.sysobj->init_obj_ctx(); - bucket_info.objv_tracker.clear(); - int ret = store->get_bucket_instance_info(obj_ctx, bucket, bucket_info, nullptr, nullptr, null_yield, dpp); + int ret = store->get_bucket_instance_info(bucket, bucket_info, nullptr, nullptr, null_yield, dpp); if (ret < 0) { return ret; } @@ -2734,13 +2732,11 @@ int RGWRados::BucketShard::init(const rgw_bucket& _bucket, { bucket = _bucket; - auto obj_ctx = store->svc.sysobj->init_obj_ctx(); - RGWBucketInfo bucket_info; RGWBucketInfo* bucket_info_p = bucket_info_out ? bucket_info_out : &bucket_info; - int ret = store->get_bucket_instance_info(obj_ctx, bucket, *bucket_info_p, NULL, NULL, null_yield, dpp); + int ret = store->get_bucket_instance_info(bucket, *bucket_info_p, NULL, NULL, null_yield, dpp); if (ret < 0) { return ret; } @@ -4818,12 +4814,11 @@ int RGWRados::set_bucket_owner(rgw_bucket& bucket, ACLOwner& owner, const DoutPr RGWBucketInfo info; map attrs; int r; - auto obj_ctx = svc.sysobj->init_obj_ctx(); if (bucket.bucket_id.empty()) { r = get_bucket_info(&svc, bucket.tenant, bucket.name, info, NULL, null_yield, dpp, &attrs); } else { - r = get_bucket_instance_info(obj_ctx, bucket, info, nullptr, &attrs, null_yield, dpp); + r = get_bucket_instance_info(bucket, info, nullptr, &attrs, null_yield, dpp); } if (r < 0) { ldpp_dout(dpp, 0) << "NOTICE: get_bucket_info on bucket=" << bucket.name << " returned err=" << r << dendl; @@ -5374,10 +5369,8 @@ int RGWRados::delete_obj_index(const rgw_obj& obj, ceph::real_time mtime, const std::string oid, key; get_obj_bucket_and_oid_loc(obj, oid, key); - auto obj_ctx = svc.sysobj->init_obj_ctx(); - RGWBucketInfo bucket_info; - int ret = get_bucket_instance_info(obj_ctx, obj.bucket, bucket_info, NULL, NULL, null_yield, dpp); + int ret = get_bucket_instance_info(obj.bucket, bucket_info, NULL, NULL, null_yield, dpp); if (ret < 0) { ldpp_dout(dpp, 0) << "ERROR: " << __func__ << "() get_bucket_instance_info(bucket=" << obj.bucket << ") returned ret=" << ret << dendl; return ret; @@ -7852,8 +7845,7 @@ int RGWRados::get_bucket_stats_async(const DoutPrefixProvider *dpp, RGWBucketInf return r; } -int RGWRados::get_bucket_instance_info(RGWSysObjectCtx& obj_ctx, - const string& meta_key, +int RGWRados::get_bucket_instance_info(const string& meta_key, RGWBucketInfo& info, real_time *pmtime, map *pattrs, @@ -7863,21 +7855,19 @@ int RGWRados::get_bucket_instance_info(RGWSysObjectCtx& obj_ctx, rgw_bucket bucket; rgw_bucket_parse_bucket_key(cct, meta_key, &bucket, nullptr); - return get_bucket_instance_info(obj_ctx, bucket, info, pmtime, pattrs, y, dpp); + return get_bucket_instance_info(bucket, info, pmtime, pattrs, y, dpp); } -int RGWRados::get_bucket_instance_info(RGWSysObjectCtx& obj_ctx, const rgw_bucket& bucket, RGWBucketInfo& info, +int RGWRados::get_bucket_instance_info(const rgw_bucket& bucket, RGWBucketInfo& info, real_time *pmtime, map *pattrs, optional_yield y, const DoutPrefixProvider *dpp) { - RGWSI_MetaBackend_CtxParams bectx_params = RGWSI_MetaBackend_CtxParams_SObj(&obj_ctx); return ctl.bucket->read_bucket_instance_info(bucket, &info, y, dpp, RGWBucketCtl::BucketInstance::GetParams() .set_mtime(pmtime) - .set_attrs(pattrs) - .set_bectx_params(bectx_params)); + .set_attrs(pattrs)); } int RGWRados::get_bucket_info(RGWServices *svc, @@ -7887,16 +7877,13 @@ int RGWRados::get_bucket_info(RGWServices *svc, optional_yield y, const DoutPrefixProvider *dpp, map *pattrs) { - auto obj_ctx = svc->sysobj->init_obj_ctx(); - RGWSI_MetaBackend_CtxParams bectx_params = RGWSI_MetaBackend_CtxParams_SObj(&obj_ctx); rgw_bucket bucket; bucket.tenant = tenant; bucket.name = bucket_name; return ctl.bucket->read_bucket_info(bucket, &info, y, dpp, RGWBucketCtl::BucketInstance::GetParams() .set_mtime(pmtime) - .set_attrs(pattrs) - .set_bectx_params(bectx_params)); + .set_attrs(pattrs)); } int RGWRados::try_refresh_bucket_info(RGWBucketInfo& info, @@ -7967,8 +7954,6 @@ int RGWRados::put_linked_bucket_info(RGWBucketInfo& info, bool exclusive, real_t int RGWRados::update_containers_stats(map& m, const DoutPrefixProvider *dpp) { - auto obj_ctx = svc.sysobj->init_obj_ctx(); - map::iterator iter; for (iter = m.begin(); iter != m.end(); ++iter) { RGWBucketEnt& ent = iter->second; @@ -7980,7 +7965,7 @@ int RGWRados::update_containers_stats(map& m, const DoutPr vector headers; RGWBucketInfo bucket_info; - int ret = get_bucket_instance_info(obj_ctx, bucket, bucket_info, NULL, NULL, null_yield, dpp); + int ret = get_bucket_instance_info(bucket, bucket_info, NULL, NULL, null_yield, dpp); if (ret < 0) { return ret; } diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index 6354dae81417..933c3e4a3dd8 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -58,7 +58,6 @@ struct RGWZoneParams; class RGWReshard; class RGWReshardWait; -class RGWSysObjectCtx; struct get_obj_data; /* flags for put_obj_meta() */ @@ -1359,8 +1358,8 @@ public: int put_bucket_instance_info(RGWBucketInfo& info, bool exclusive, ceph::real_time mtime, std::map *pattrs, const DoutPrefixProvider *dpp); /* xxx dang obj_ctx -> svc */ - int get_bucket_instance_info(RGWSysObjectCtx& obj_ctx, const std::string& meta_key, RGWBucketInfo& info, ceph::real_time *pmtime, std::map *pattrs, optional_yield y, const DoutPrefixProvider *dpp); - int get_bucket_instance_info(RGWSysObjectCtx& obj_ctx, const rgw_bucket& bucket, RGWBucketInfo& info, ceph::real_time *pmtime, std::map *pattrs, optional_yield y, const DoutPrefixProvider *dpp); + int get_bucket_instance_info(const std::string& meta_key, RGWBucketInfo& info, ceph::real_time *pmtime, std::map *pattrs, optional_yield y, const DoutPrefixProvider *dpp); + int get_bucket_instance_info(const rgw_bucket& bucket, RGWBucketInfo& info, ceph::real_time *pmtime, std::map *pattrs, optional_yield y, const DoutPrefixProvider *dpp); static void make_bucket_entry_name(const std::string& tenant_name, const std::string& bucket_name, std::string& bucket_entry); diff --git a/src/rgw/rgw_reshard.cc b/src/rgw/rgw_reshard.cc index 4af9ac8b8bcd..fdef4dbe7127 100644 --- a/src/rgw/rgw_reshard.cc +++ b/src/rgw/rgw_reshard.cc @@ -278,9 +278,8 @@ static int remove_old_reshard_instance(rgw::sal::RadosStore* store, const DoutPrefixProvider* dpp) { RGWBucketInfo info; - auto obj_ctx = store->svc()->sysobj->init_obj_ctx(); - int r = store->getRados()->get_bucket_instance_info(obj_ctx, bucket, info, - nullptr, nullptr, null_yield, dpp); + int r = store->getRados()->get_bucket_instance_info(bucket, info, nullptr, + nullptr, null_yield, dpp); if (r < 0) { return r; } @@ -387,9 +386,8 @@ static int init_target_layout(rgw::sal::RadosStore* store, if (ret == -ECANCELED) { // racing write detected, read the latest bucket info and try again - auto obj_ctx = store->svc()->sysobj->init_obj_ctx(); int ret2 = store->getRados()->get_bucket_instance_info( - obj_ctx, bucket_info.bucket, bucket_info, + bucket_info.bucket, bucket_info, nullptr, &bucket_attrs, null_yield, dpp); if (ret2 < 0) { ldpp_dout(dpp, 0) << "ERROR: " << __func__ << " failed to read " @@ -461,9 +459,8 @@ static int revert_target_layout(rgw::sal::RadosStore* store, if (ret == -ECANCELED) { // racing write detected, read the latest bucket info and try again - auto obj_ctx = store->svc()->sysobj->init_obj_ctx(); int ret2 = store->getRados()->get_bucket_instance_info( - obj_ctx, bucket_info.bucket, bucket_info, + bucket_info.bucket, bucket_info, nullptr, &bucket_attrs, null_yield, dpp); if (ret2 < 0) { ldpp_dout(dpp, 0) << "ERROR: " << __func__ << " failed to read " @@ -599,9 +596,8 @@ static int commit_reshard(rgw::sal::RadosStore* store, ret = commit_target_layout(store, bucket_info, bucket_attrs, fault, dpp); if (ret == -ECANCELED) { // racing write detected, read the latest bucket info and try again - auto obj_ctx = store->svc()->sysobj->init_obj_ctx(); int ret2 = store->getRados()->get_bucket_instance_info( - obj_ctx, bucket_info.bucket, bucket_info, + bucket_info.bucket, bucket_info, nullptr, &bucket_attrs, null_yield, dpp); if (ret2 < 0) { ldpp_dout(dpp, 0) << "ERROR: " << __func__ << " failed to read " diff --git a/src/rgw/rgw_sal_rados.cc b/src/rgw/rgw_sal_rados.cc index c09d5de458b4..b395cfae597a 100644 --- a/src/rgw/rgw_sal_rados.cc +++ b/src/rgw/rgw_sal_rados.cc @@ -46,6 +46,7 @@ #include "services/svc_config_key.h" #include "services/svc_zone_utils.h" #include "services/svc_role_rados.h" +#include "services/svc_user.h" #include "cls/rgw/cls_rgw_client.h" #include "rgw_pubsub.h" @@ -307,12 +308,12 @@ int RadosUser::read_stats(const DoutPrefixProvider *dpp, int RadosUser::read_stats_async(const DoutPrefixProvider *dpp, RGWGetUserStats_CB* cb) { - return store->ctl()->user->read_stats_async(dpp, get_id(), cb); + return store->svc()->user->read_stats_async(dpp, get_id(), cb); } int RadosUser::complete_flush_stats(const DoutPrefixProvider *dpp, optional_yield y) { - return store->ctl()->user->complete_flush_stats(dpp, get_id(), y); + return store->svc()->user->complete_flush_stats(dpp, get_id(), y); } int RadosUser::read_usage(const DoutPrefixProvider *dpp, uint64_t start_epoch, uint64_t end_epoch, @@ -591,10 +592,9 @@ int RadosBucket::remove_bucket_bypass_gc(int concurrent_max, bool int RadosBucket::load_bucket(const DoutPrefixProvider* dpp, optional_yield y, bool get_stats) { - auto obj_ctx = store->svc()->sysobj->init_obj_ctx(); int ret; - RGWSI_MetaBackend_CtxParams bectx_params = RGWSI_MetaBackend_CtxParams_SObj(&obj_ctx); + RGWSI_MetaBackend_CtxParams bectx_params = RGWSI_MetaBackend_CtxParams_SObj(); RGWObjVersionTracker ep_ot; if (info.bucket.bucket_id.empty()) { ret = store->ctl()->bucket->read_bucket_info(info.bucket, &info, y, dpp, @@ -1459,7 +1459,6 @@ int RadosStore::get_oidc_providers(const DoutPrefixProvider *dpp, { std::string prefix = tenant + RGWOIDCProvider::oidc_url_oid_prefix; auto pool = svc()->zone->get_zone_params().oidc_pool; - auto obj_ctx = svc()->sysobj->init_obj_ctx(); //Get the filtered objects list result; @@ -1477,7 +1476,7 @@ int RadosStore::get_oidc_providers(const DoutPrefixProvider *dpp, std::unique_ptr provider = get_oidc_provider(); bufferlist bl; - r = rgw_get_system_obj(obj_ctx, pool, iter, bl, nullptr, nullptr, null_yield, dpp); + r = rgw_get_system_obj(svc()->sysobj, pool, iter, bl, nullptr, nullptr, null_yield, dpp); if (r < 0) { return r; } @@ -1674,10 +1673,9 @@ int RadosObject::omap_get_vals(const DoutPrefixProvider *dpp, const std::string& std::map *m, bool* pmore, optional_yield y) { - auto obj_ctx = store->svc()->sysobj->init_obj_ctx(); rgw_raw_obj raw_obj; get_raw_obj(&raw_obj); - auto sysobj = obj_ctx.get_obj(raw_obj); + auto sysobj = store->svc()->sysobj->get_obj(raw_obj); return sysobj.omap().get_vals(dpp, marker, count, m, pmore, y); } @@ -1685,10 +1683,9 @@ int RadosObject::omap_get_vals(const DoutPrefixProvider *dpp, const std::string& int RadosObject::omap_get_all(const DoutPrefixProvider *dpp, std::map *m, optional_yield y) { - auto obj_ctx = store->svc()->sysobj->init_obj_ctx(); rgw_raw_obj raw_obj; get_raw_obj(&raw_obj); - auto sysobj = obj_ctx.get_obj(raw_obj); + auto sysobj = store->svc()->sysobj->get_obj(raw_obj); return sysobj.omap().get_all(dpp, m, y); } @@ -1719,8 +1716,7 @@ int RadosObject::omap_set_val_by_key(const DoutPrefixProvider *dpp, const std::s store->getRados()->obj_to_raw(bucket->get_placement_rule(), obj, &raw_meta_obj); - auto obj_ctx = store->svc()->sysobj->init_obj_ctx(); - auto sysobj = obj_ctx.get_obj(raw_meta_obj); + auto sysobj = store->svc()->sysobj->get_obj(raw_meta_obj); return sysobj.omap().set_must_exist(must_exist).set(dpp, key, val, y); } @@ -3015,10 +3011,9 @@ RadosLuaScriptManager::RadosLuaScriptManager(RadosStore* _s) : store(_s) int RadosLuaScriptManager::get(const DoutPrefixProvider* dpp, optional_yield y, const std::string& key, std::string& script) { - auto obj_ctx = store->svc()->sysobj->init_obj_ctx(); bufferlist bl; - int r = rgw_get_system_obj(obj_ctx, pool, key, bl, nullptr, nullptr, y, dpp); + int r = rgw_get_system_obj(store->svc()->sysobj, pool, key, bl, nullptr, nullptr, y, dpp); if (r < 0) { return r; } @@ -3035,11 +3030,10 @@ int RadosLuaScriptManager::get(const DoutPrefixProvider* dpp, optional_yield y, int RadosLuaScriptManager::put(const DoutPrefixProvider* dpp, optional_yield y, const std::string& key, const std::string& script) { - auto obj_ctx = store->svc()->sysobj->init_obj_ctx(); bufferlist bl; ceph::encode(script, bl); - int r = rgw_put_system_obj(dpp, obj_ctx, pool, key, bl, false, nullptr, real_time(), y); + int r = rgw_put_system_obj(dpp, store->svc()->sysobj, pool, key, bl, false, nullptr, real_time(), y); if (r < 0) { return r; } @@ -3059,23 +3053,23 @@ int RadosLuaScriptManager::del(const DoutPrefixProvider* dpp, optional_yield y, int RadosOIDCProvider::store_url(const DoutPrefixProvider *dpp, const std::string& url, bool exclusive, optional_yield y) { - auto obj_ctx = store->svc()->sysobj->init_obj_ctx(); + auto sysobj = store->svc()->sysobj; std::string oid = tenant + get_url_oid_prefix() + url; bufferlist bl; using ceph::encode; encode(*this, bl); - return rgw_put_system_obj(dpp, obj_ctx, store->svc()->zone->get_zone_params().oidc_pool, oid, bl, exclusive, nullptr, real_time(), y); + return rgw_put_system_obj(dpp, sysobj, store->svc()->zone->get_zone_params().oidc_pool, oid, bl, exclusive, nullptr, real_time(), y); } int RadosOIDCProvider::read_url(const DoutPrefixProvider *dpp, const std::string& url, const std::string& tenant) { - auto obj_ctx = store->svc()->sysobj->init_obj_ctx(); + auto sysobj = store->svc()->sysobj; auto& pool = store->svc()->zone->get_zone_params().oidc_pool; std::string oid = tenant + get_url_oid_prefix() + url; bufferlist bl; - int ret = rgw_get_system_obj(obj_ctx, pool, oid, bl, nullptr, nullptr, null_yield, dpp); + int ret = rgw_get_system_obj(sysobj, pool, oid, bl, nullptr, nullptr, null_yield, dpp); if (ret < 0) { return ret; } @@ -3151,7 +3145,7 @@ int RadosRole::store_info(const DoutPrefixProvider *dpp, bool exclusive, optiona int RadosRole::store_name(const DoutPrefixProvider *dpp, bool exclusive, optional_yield y) { - auto obj_ctx = store->svc()->sysobj->init_obj_ctx(); + auto sysobj = store->svc()->sysobj; RGWNameToId nameToId; nameToId.obj_id = info.id; @@ -3161,26 +3155,26 @@ int RadosRole::store_name(const DoutPrefixProvider *dpp, bool exclusive, optiona using ceph::encode; encode(nameToId, bl); - return rgw_put_system_obj(dpp, obj_ctx, store->svc()->zone->get_zone_params().roles_pool, oid, bl, exclusive, &info.objv_tracker, real_time(), y); + return rgw_put_system_obj(dpp, sysobj, store->svc()->zone->get_zone_params().roles_pool, oid, bl, exclusive, &info.objv_tracker, real_time(), y); } int RadosRole::store_path(const DoutPrefixProvider *dpp, bool exclusive, optional_yield y) { - auto obj_ctx = store->svc()->sysobj->init_obj_ctx(); + auto sysobj = store->svc()->sysobj; std::string oid = info.tenant + get_path_oid_prefix() + info.path + get_info_oid_prefix() + info.id; bufferlist bl; - return rgw_put_system_obj(dpp, obj_ctx, store->svc()->zone->get_zone_params().roles_pool, oid, bl, exclusive, &info.objv_tracker, real_time(), y); + return rgw_put_system_obj(dpp, sysobj, store->svc()->zone->get_zone_params().roles_pool, oid, bl, exclusive, &info.objv_tracker, real_time(), y); } int RadosRole::read_id(const DoutPrefixProvider *dpp, const std::string& role_name, const std::string& tenant, std::string& role_id, optional_yield y) { - auto obj_ctx = store->svc()->sysobj->init_obj_ctx(); + auto sysobj = store->svc()->sysobj; std::string oid = info.tenant + get_names_oid_prefix() + role_name; bufferlist bl; - int ret = rgw_get_system_obj(obj_ctx, store->svc()->zone->get_zone_params().roles_pool, oid, bl, nullptr, nullptr, null_yield, dpp); + int ret = rgw_get_system_obj(sysobj, store->svc()->zone->get_zone_params().roles_pool, oid, bl, nullptr, nullptr, null_yield, dpp); if (ret < 0) { return ret; } @@ -3200,11 +3194,11 @@ int RadosRole::read_id(const DoutPrefixProvider *dpp, const std::string& role_na int RadosRole::read_name(const DoutPrefixProvider *dpp, optional_yield y) { - auto obj_ctx = store->svc()->sysobj->init_obj_ctx(); + auto sysobj = store->svc()->sysobj; std::string oid = info.tenant + get_names_oid_prefix() + info.name; bufferlist bl; - int ret = rgw_get_system_obj(obj_ctx, store->svc()->zone->get_zone_params().roles_pool, oid, bl, nullptr, nullptr, null_yield, dpp); + int ret = rgw_get_system_obj(sysobj, store->svc()->zone->get_zone_params().roles_pool, oid, bl, nullptr, nullptr, null_yield, dpp); if (ret < 0) { ldpp_dout(dpp, 0) << "ERROR: failed reading role name from Role pool: " << info.name << ": " << cpp_strerror(-ret) << dendl; @@ -3226,7 +3220,6 @@ int RadosRole::read_name(const DoutPrefixProvider *dpp, optional_yield y) int RadosRole::read_info(const DoutPrefixProvider *dpp, optional_yield y) { - auto obj_ctx = store->svc()->sysobj->init_obj_ctx(); std::string oid; oid = info.id; diff --git a/src/rgw/rgw_service.cc b/src/rgw/rgw_service.cc index 7df25a2dba5d..309aa4870141 100644 --- a/src/rgw/rgw_service.cc +++ b/src/rgw/rgw_service.cc @@ -378,7 +378,7 @@ int RGWCtlDef::init(RGWServices& svc, rgw::sal::Store* store, const DoutPrefixPr bucket.reset(new RGWBucketCtl(svc.zone, svc.bucket, svc.bucket_sync, - svc.bi)); + svc.bi, svc.user)); otp.reset(new RGWOTPCtl(svc.zone, svc.otp)); RGWBucketMetadataHandlerBase *bucket_meta_handler = static_cast(meta.bucket.get()); diff --git a/src/rgw/rgw_sync_checkpoint.cc b/src/rgw/rgw_sync_checkpoint.cc index 99bdddb6183f..5e05b0e1271c 100644 --- a/src/rgw/rgw_sync_checkpoint.cc +++ b/src/rgw/rgw_sync_checkpoint.cc @@ -240,9 +240,8 @@ int rgw_bucket_sync_checkpoint(const DoutPrefixProvider* dpp, // fetch source bucket info spawn::spawn(ioctx, [&] (yield_context yield) { auto y = optional_yield{ioctx, yield}; - auto obj_ctx = store->svc()->sysobj->init_obj_ctx(); int r = store->getRados()->get_bucket_instance_info( - obj_ctx, *entry.pipe.source.bucket, entry.source_bucket_info, + *entry.pipe.source.bucket, entry.source_bucket_info, nullptr, nullptr, y, dpp); if (r < 0) { ldpp_dout(dpp, 0) << "failed to read source bucket info: " diff --git a/src/rgw/rgw_tools.cc b/src/rgw/rgw_tools.cc index 3d9d709c4f31..85565ec8501b 100644 --- a/src/rgw/rgw_tools.cc +++ b/src/rgw/rgw_tools.cc @@ -106,8 +106,8 @@ map* no_change_attrs() { return &no_change; } -int rgw_put_system_obj(const DoutPrefixProvider *dpp, - RGWSysObjectCtx& obj_ctx, const rgw_pool& pool, const string& oid, bufferlist& data, bool exclusive, +int rgw_put_system_obj(const DoutPrefixProvider *dpp, RGWSI_SysObj* svc_sysobj, + const rgw_pool& pool, const string& oid, bufferlist& data, bool exclusive, RGWObjVersionTracker *objv_tracker, real_time set_mtime, optional_yield y, map *pattrs) { map no_attrs; @@ -117,7 +117,7 @@ int rgw_put_system_obj(const DoutPrefixProvider *dpp, rgw_raw_obj obj(pool, oid); - auto sysobj = obj_ctx.get_obj(obj); + auto sysobj = svc_sysobj->get_obj(obj); int ret; if (pattrs != no_change_attrs()) { @@ -138,14 +138,14 @@ int rgw_put_system_obj(const DoutPrefixProvider *dpp, return ret; } -int rgw_stat_system_obj(const DoutPrefixProvider *dpp, - RGWSysObjectCtx& obj_ctx, const rgw_pool& pool, - const std::string& key, RGWObjVersionTracker *objv_tracker, +int rgw_stat_system_obj(const DoutPrefixProvider *dpp, RGWSI_SysObj* svc_sysobj, + const rgw_pool& pool, const std::string& key, + RGWObjVersionTracker *objv_tracker, real_time *pmtime, optional_yield y, std::map *pattrs) { rgw_raw_obj obj(pool, key); - auto sysobj = obj_ctx.get_obj(obj); + auto sysobj = svc_sysobj->get_obj(obj); return sysobj.rop() .set_attrs(pattrs) .set_last_mod(pmtime) @@ -153,7 +153,7 @@ int rgw_stat_system_obj(const DoutPrefixProvider *dpp, } -int rgw_get_system_obj(RGWSysObjectCtx& obj_ctx, const rgw_pool& pool, const string& key, bufferlist& bl, +int rgw_get_system_obj(RGWSI_SysObj* svc_sysobj, const rgw_pool& pool, const string& key, bufferlist& bl, RGWObjVersionTracker *objv_tracker, real_time *pmtime, optional_yield y, const DoutPrefixProvider *dpp, map *pattrs, rgw_cache_entry_info *cache_info, boost::optional refresh_version, bool raw_attrs) @@ -168,7 +168,7 @@ int rgw_get_system_obj(RGWSysObjectCtx& obj_ctx, const rgw_pool& pool, const str } do { - auto sysobj = obj_ctx.get_obj(obj); + auto sysobj = svc_sysobj->get_obj(obj); auto rop = sysobj.rop(); int ret = rop.set_attrs(pattrs) @@ -191,7 +191,6 @@ int rgw_get_system_obj(RGWSysObjectCtx& obj_ctx, const rgw_pool& pool, const str if (objv_tracker) { objv_tracker->read_version.clear(); } - sysobj.invalidate(); continue; } if (ret < 0) @@ -210,8 +209,7 @@ int rgw_delete_system_obj(const DoutPrefixProvider *dpp, RGWSI_SysObj *sysobj_svc, const rgw_pool& pool, const string& oid, RGWObjVersionTracker *objv_tracker, optional_yield y) { - auto obj_ctx = sysobj_svc->init_obj_ctx(); - auto sysobj = obj_ctx.get_obj(rgw_raw_obj{pool, oid}); + auto sysobj = sysobj_svc->get_obj(rgw_raw_obj{pool, oid}); rgw_raw_obj obj(pool, oid); return sysobj.wop() .set_objv_tracker(objv_tracker) diff --git a/src/rgw/rgw_tools.h b/src/rgw/rgw_tools.h index 3e14805e1100..7ce74f6209bb 100644 --- a/src/rgw/rgw_tools.h +++ b/src/rgw/rgw_tools.h @@ -17,7 +17,6 @@ class RGWSI_SysObj; class RGWRados; -class RGWSysObjectCtx; struct RGWObjVersionTracker; class optional_yield; @@ -62,18 +61,26 @@ void rgw_shard_name(const std::string& prefix, unsigned max_shards, const std::s void rgw_shard_name(const std::string& prefix, unsigned max_shards, const std::string& section, const std::string& key, std::string& name); void rgw_shard_name(const std::string& prefix, unsigned shard_id, std::string& name); -int rgw_put_system_obj(const DoutPrefixProvider *dpp, RGWSysObjectCtx& obj_ctx, const rgw_pool& pool, const std::string& oid, bufferlist& data, bool exclusive, - RGWObjVersionTracker *objv_tracker, real_time set_mtime, optional_yield y, std::map *pattrs = NULL); -int rgw_get_system_obj(RGWSysObjectCtx& obj_ctx, const rgw_pool& pool, const std::string& key, bufferlist& bl, - RGWObjVersionTracker *objv_tracker, real_time *pmtime, optional_yield y, const DoutPrefixProvider *dpp, std::map *pattrs = NULL, - rgw_cache_entry_info *cache_info = NULL, - boost::optional refresh_version = boost::none, bool raw_attrs=false); +int rgw_put_system_obj(const DoutPrefixProvider *dpp, RGWSI_SysObj* svc_sysobj, + const rgw_pool& pool, const std::string& oid, + bufferlist& data, bool exclusive, + RGWObjVersionTracker *objv_tracker, + real_time set_mtime, optional_yield y, + std::map *pattrs = nullptr); +int rgw_get_system_obj(RGWSI_SysObj* svc_sysobj, const rgw_pool& pool, + const std::string& key, bufferlist& bl, + RGWObjVersionTracker *objv_tracker, real_time *pmtime, + optional_yield y, const DoutPrefixProvider *dpp, + std::map *pattrs = nullptr, + rgw_cache_entry_info *cache_info = nullptr, + boost::optional refresh_version = boost::none, + bool raw_attrs=false); int rgw_delete_system_obj(const DoutPrefixProvider *dpp, RGWSI_SysObj *sysobj_svc, const rgw_pool& pool, const std::string& oid, RGWObjVersionTracker *objv_tracker, optional_yield y); -int rgw_stat_system_obj(const DoutPrefixProvider *dpp, - RGWSysObjectCtx& obj_Ctx, const rgw_pool& pool, - const std::string& key, RGWObjVersionTracker *objv_tracker, +int rgw_stat_system_obj(const DoutPrefixProvider *dpp, RGWSI_SysObj* svc_sysobj, + const rgw_pool& pool, const std::string& key, + RGWObjVersionTracker *objv_tracker, real_time *pmtime, optional_yield y, std::map *pattrs = nullptr); diff --git a/src/rgw/rgw_user.cc b/src/rgw/rgw_user.cc index c13dc280cc31..69b785c6ba79 100644 --- a/src/rgw/rgw_user.cc +++ b/src/rgw/rgw_user.cc @@ -2844,29 +2844,6 @@ int RGWUserCtl::remove_info(const DoutPrefixProvider *dpp, }); } -int RGWUserCtl::add_bucket(const DoutPrefixProvider *dpp, - const rgw_user& user, - const rgw_bucket& bucket, - ceph::real_time creation_time, - optional_yield y) - -{ - return be_handler->call([&](RGWSI_MetaBackend_Handler::Op *op) { - return svc.user->add_bucket(dpp, op->ctx(), user, bucket, creation_time, y); - }); -} - -int RGWUserCtl::remove_bucket(const DoutPrefixProvider *dpp, - const rgw_user& user, - const rgw_bucket& bucket, - optional_yield y) - -{ - return be_handler->call([&](RGWSI_MetaBackend_Handler::Op *op) { - return svc.user->remove_bucket(dpp, op->ctx(), user, bucket, y); - }); -} - int RGWUserCtl::list_buckets(const DoutPrefixProvider *dpp, const rgw_user& user, const string& marker, @@ -2882,46 +2859,20 @@ int RGWUserCtl::list_buckets(const DoutPrefixProvider *dpp, max = default_max; } - return be_handler->call([&](RGWSI_MetaBackend_Handler::Op *op) { - int ret = svc.user->list_buckets(dpp, op->ctx(), user, marker, end_marker, - max, buckets, is_truncated, y); - if (ret < 0) { + int ret = svc.user->list_buckets(dpp, user, marker, end_marker, + max, buckets, is_truncated, y); + if (ret < 0) { + return ret; + } + if (need_stats) { + map& m = buckets->get_buckets(); + ret = ctl.bucket->read_buckets_stats(m, y, dpp); + if (ret < 0 && ret != -ENOENT) { + ldpp_dout(dpp, 0) << "ERROR: could not get stats for buckets" << dendl; return ret; } - if (need_stats) { - map& m = buckets->get_buckets(); - ret = ctl.bucket->read_buckets_stats(m, y, dpp); - if (ret < 0 && ret != -ENOENT) { - ldpp_dout(dpp, 0) << "ERROR: could not get stats for buckets" << dendl; - return ret; - } - } - return 0; - }); -} - -int RGWUserCtl::flush_bucket_stats(const DoutPrefixProvider *dpp, - const rgw_user& user, - const RGWBucketEnt& ent, - optional_yield y) -{ - return be_handler->call([&](RGWSI_MetaBackend_Handler::Op *op) { - return svc.user->flush_bucket_stats(dpp, op->ctx(), user, ent, y); - }); -} - -int RGWUserCtl::complete_flush_stats(const DoutPrefixProvider *dpp, const rgw_user& user, optional_yield y) -{ - return be_handler->call([&](RGWSI_MetaBackend_Handler::Op *op) { - return svc.user->complete_flush_stats(dpp, op->ctx(), user, y); - }); -} - -int RGWUserCtl::reset_stats(const DoutPrefixProvider *dpp, const rgw_user& user, optional_yield y) -{ - return be_handler->call([&](RGWSI_MetaBackend_Handler::Op *op) { - return svc.user->reset_bucket_stats(dpp, op->ctx(), user, y); - }); + } + return 0; } int RGWUserCtl::read_stats(const DoutPrefixProvider *dpp, @@ -2936,13 +2887,6 @@ int RGWUserCtl::read_stats(const DoutPrefixProvider *dpp, }); } -int RGWUserCtl::read_stats_async(const DoutPrefixProvider *dpp, const rgw_user& user, RGWGetUserStats_CB *cb) -{ - return be_handler->call([&](RGWSI_MetaBackend_Handler::Op *op) { - return svc.user->read_stats_async(dpp, op->ctx(), user, cb); - }); -} - RGWMetadataHandler *RGWUserMetaHandlerAllocator::alloc(RGWSI_User *user_svc) { return new RGWUserMetadataHandler(user_svc); } diff --git a/src/rgw/rgw_user.h b/src/rgw/rgw_user.h index 710c61c30622..3f43209b26e1 100644 --- a/src/rgw/rgw_user.h +++ b/src/rgw/rgw_user.h @@ -860,14 +860,6 @@ public: const RGWUserInfo& info, optional_yield y, const RemoveParams& params = {}); - int add_bucket(const DoutPrefixProvider *dpp, - const rgw_user& user, - const rgw_bucket& bucket, - ceph::real_time creation_time, - optional_yield y); - int remove_bucket(const DoutPrefixProvider *dpp, - const rgw_user& user, - const rgw_bucket& bucket, optional_yield y); int list_buckets(const DoutPrefixProvider *dpp, const rgw_user& user, const std::string& marker, @@ -879,18 +871,11 @@ public: optional_yield y, uint64_t default_max = 1000); - int flush_bucket_stats(const DoutPrefixProvider *dpp, - const rgw_user& user, - const RGWBucketEnt& ent, - optional_yield y); - int complete_flush_stats(const DoutPrefixProvider *dpp, const rgw_user& user, optional_yield y); - int reset_stats(const DoutPrefixProvider *dpp, const rgw_user& user, optional_yield y); int read_stats(const DoutPrefixProvider *dpp, const rgw_user& user, RGWStorageStats *stats, optional_yield y, ceph::real_time *last_stats_sync = nullptr, /* last time a full stats sync completed */ ceph::real_time *last_stats_update = nullptr); /* last time a stats update was done */ - int read_stats_async(const DoutPrefixProvider *dpp, const rgw_user& user, RGWGetUserStats_CB *ctx); }; class RGWUserMetaHandlerAllocator { diff --git a/src/rgw/rgw_zone.cc b/src/rgw/rgw_zone.cc index 517c6ec39ada..9554349e81e2 100644 --- a/src/rgw/rgw_zone.cc +++ b/src/rgw/rgw_zone.cc @@ -460,8 +460,7 @@ int RGWSystemMetaObj::read_default(const DoutPrefixProvider *dpp, auto pool = get_pool(cct); bufferlist bl; - auto obj_ctx = sysobj_svc->init_obj_ctx(); - auto sysobj = sysobj_svc->get_obj(obj_ctx, rgw_raw_obj(pool, oid)); + auto sysobj = sysobj_svc->get_obj(rgw_raw_obj(pool, oid)); int ret = sysobj.rop().read(dpp, &bl, y); if (ret < 0) return ret; @@ -510,8 +509,7 @@ int RGWSystemMetaObj::set_as_default(const DoutPrefixProvider *dpp, optional_yie encode(default_info, bl); - auto obj_ctx = sysobj_svc->init_obj_ctx(); - auto sysobj = sysobj_svc->get_obj(obj_ctx, rgw_raw_obj(pool, oid)); + auto sysobj = sysobj_svc->get_obj(rgw_raw_obj(pool, oid)); int ret = sysobj.wop() .set_exclusive(exclusive) .write(dpp, bl, y); @@ -530,8 +528,7 @@ int RGWSystemMetaObj::read_id(const DoutPrefixProvider *dpp, const string& obj_n string oid = get_names_oid_prefix() + obj_name; - auto obj_ctx = sysobj_svc->init_obj_ctx(); - auto sysobj = sysobj_svc->get_obj(obj_ctx, rgw_raw_obj(pool, oid)); + auto sysobj = sysobj_svc->get_obj(rgw_raw_obj(pool, oid)); int ret = sysobj.rop().read(dpp, &bl, y); if (ret < 0) { return ret; @@ -553,8 +550,6 @@ int RGWSystemMetaObj::delete_obj(const DoutPrefixProvider *dpp, optional_yield y { rgw_pool pool(get_pool(cct)); - auto obj_ctx = sysobj_svc->init_obj_ctx(); - /* check to see if obj is the default */ RGWDefaultSystemMetaObjInfo default_info; int ret = read_default(dpp, default_info, get_default_oid(old_format), y); @@ -563,7 +558,7 @@ int RGWSystemMetaObj::delete_obj(const DoutPrefixProvider *dpp, optional_yield y if (default_info.default_id == id || (old_format && default_info.default_id == name)) { string oid = get_default_oid(old_format); rgw_raw_obj default_named_obj(pool, oid); - auto sysobj = sysobj_svc->get_obj(obj_ctx, default_named_obj); + auto sysobj = sysobj_svc->get_obj(default_named_obj); ret = sysobj.wop().remove(dpp, y); if (ret < 0) { ldpp_dout(dpp, 0) << "Error delete default obj name " << name << ": " << cpp_strerror(-ret) << dendl; @@ -573,7 +568,7 @@ int RGWSystemMetaObj::delete_obj(const DoutPrefixProvider *dpp, optional_yield y if (!old_format) { string oid = get_names_oid_prefix() + name; rgw_raw_obj object_name(pool, oid); - auto sysobj = sysobj_svc->get_obj(obj_ctx, object_name); + auto sysobj = sysobj_svc->get_obj(object_name); ret = sysobj.wop().remove(dpp, y); if (ret < 0) { ldpp_dout(dpp, 0) << "Error delete obj name " << name << ": " << cpp_strerror(-ret) << dendl; @@ -589,7 +584,7 @@ int RGWSystemMetaObj::delete_obj(const DoutPrefixProvider *dpp, optional_yield y } rgw_raw_obj object_id(pool, oid); - auto sysobj = sysobj_svc->get_obj(obj_ctx, object_id); + auto sysobj = sysobj_svc->get_obj(object_id); ret = sysobj.wop().remove(dpp, y); if (ret < 0) { ldpp_dout(dpp, 0) << "Error delete object id " << id << ": " << cpp_strerror(-ret) << dendl; @@ -609,8 +604,7 @@ int RGWSystemMetaObj::store_name(const DoutPrefixProvider *dpp, bool exclusive, bufferlist bl; using ceph::encode; encode(nameToId, bl); - auto obj_ctx = sysobj_svc->init_obj_ctx(); - auto sysobj = sysobj_svc->get_obj(obj_ctx, rgw_raw_obj(pool, oid)); + auto sysobj = sysobj_svc->get_obj(rgw_raw_obj(pool, oid)); return sysobj.wop() .set_exclusive(exclusive) .write(dpp, bl, y); @@ -643,8 +637,7 @@ int RGWSystemMetaObj::rename(const DoutPrefixProvider *dpp, const string& new_na rgw_pool pool(get_pool(cct)); string oid = get_names_oid_prefix() + old_name; rgw_raw_obj old_name_obj(pool, oid); - auto obj_ctx = sysobj_svc->init_obj_ctx(); - auto sysobj = sysobj_svc->get_obj(obj_ctx, old_name_obj); + auto sysobj = sysobj_svc->get_obj(old_name_obj); ret = sysobj.wop().remove(dpp, y); if (ret < 0) { ldpp_dout(dpp, 0) << "Error delete old obj name " << old_name << ": " << cpp_strerror(-ret) << dendl; @@ -663,8 +656,7 @@ int RGWSystemMetaObj::read_info(const DoutPrefixProvider *dpp, const string& obj string oid = get_info_oid_prefix(old_format) + obj_id; - auto obj_ctx = sysobj_svc->init_obj_ctx(); - auto sysobj = sysobj_svc->get_obj(obj_ctx, rgw_raw_obj{pool, oid}); + auto sysobj = sysobj_svc->get_obj(rgw_raw_obj{pool, oid}); int ret = sysobj.rop().read(dpp, &bl, y); if (ret < 0) { ldpp_dout(dpp, 0) << "failed reading obj info from " << pool << ":" << oid << ": " << cpp_strerror(-ret) << dendl; @@ -734,8 +726,7 @@ int RGWSystemMetaObj::store_info(const DoutPrefixProvider *dpp, bool exclusive, bufferlist bl; using ceph::encode; encode(*this, bl); - auto obj_ctx = sysobj_svc->init_obj_ctx(); - auto sysobj = sysobj_svc->get_obj(obj_ctx, rgw_raw_obj{pool, oid}); + auto sysobj = sysobj_svc->get_obj(rgw_raw_obj{pool, oid}); return sysobj.wop() .set_exclusive(exclusive) .write(dpp, bl, y); @@ -834,8 +825,7 @@ int RGWRealm::create_control(const DoutPrefixProvider *dpp, bool exclusive, opti auto pool = rgw_pool{get_pool(cct)}; auto oid = get_control_oid(); bufferlist bl; - auto obj_ctx = sysobj_svc->init_obj_ctx(); - auto sysobj = sysobj_svc->get_obj(obj_ctx, rgw_raw_obj{pool, oid}); + auto sysobj = sysobj_svc->get_obj(rgw_raw_obj{pool, oid}); return sysobj.wop() .set_exclusive(exclusive) .write(dpp, bl, y); @@ -845,8 +835,7 @@ int RGWRealm::delete_control(const DoutPrefixProvider *dpp, optional_yield y) { auto pool = rgw_pool{get_pool(cct)}; auto obj = rgw_raw_obj{pool, get_control_oid()}; - auto obj_ctx = sysobj_svc->init_obj_ctx(); - auto sysobj = sysobj_svc->get_obj(obj_ctx, obj); + auto sysobj = sysobj_svc->get_obj(obj); return sysobj.wop().remove(dpp, y); } @@ -917,8 +906,7 @@ string RGWRealm::get_control_oid() const int RGWRealm::notify_zone(const DoutPrefixProvider *dpp, bufferlist& bl, optional_yield y) { rgw_pool pool{get_pool(cct)}; - auto obj_ctx = sysobj_svc->init_obj_ctx(); - auto sysobj = sysobj_svc->get_obj(obj_ctx, rgw_raw_obj{pool, get_control_oid()}); + auto sysobj = sysobj_svc->get_obj(rgw_raw_obj{pool, get_control_oid()}); int ret = sysobj.wn().notify(dpp, bl, 0, nullptr, y); if (ret < 0) { return ret; @@ -992,8 +980,7 @@ int RGWPeriodConfig::read(const DoutPrefixProvider *dpp, RGWSI_SysObj *sysobj_sv const auto& oid = get_oid(realm_id); bufferlist bl; - auto obj_ctx = sysobj_svc->init_obj_ctx(); - auto sysobj = sysobj_svc->get_obj(obj_ctx, rgw_raw_obj{pool, oid}); + auto sysobj = sysobj_svc->get_obj(rgw_raw_obj{pool, oid}); int ret = sysobj.rop().read(dpp, &bl, y); if (ret < 0) { return ret; @@ -1017,8 +1004,7 @@ int RGWPeriodConfig::write(const DoutPrefixProvider *dpp, bufferlist bl; using ceph::encode; encode(*this, bl); - auto obj_ctx = sysobj_svc->init_obj_ctx(); - auto sysobj = sysobj_svc->get_obj(obj_ctx, rgw_raw_obj{pool, oid}); + auto sysobj = sysobj_svc->get_obj(rgw_raw_obj{pool, oid}); return sysobj.wop() .set_exclusive(false) .write(dpp, bl, y); @@ -1146,8 +1132,7 @@ int RGWPeriod::read_latest_epoch(const DoutPrefixProvider *dpp, rgw_pool pool(get_pool(cct)); bufferlist bl; - auto obj_ctx = sysobj_svc->init_obj_ctx(); - auto sysobj = sysobj_svc->get_obj(obj_ctx, rgw_raw_obj{pool, oid}); + auto sysobj = sysobj_svc->get_obj(rgw_raw_obj{pool, oid}); int ret = sysobj.rop().read(dpp, &bl, y); if (ret < 0) { ldpp_dout(dpp, 1) << "error read_lastest_epoch " << pool << ":" << oid << dendl; @@ -1208,8 +1193,7 @@ int RGWPeriod::set_latest_epoch(const DoutPrefixProvider *dpp, using ceph::encode; encode(info, bl); - auto obj_ctx = sysobj_svc->init_obj_ctx(); - auto sysobj = sysobj_svc->get_obj(obj_ctx, rgw_raw_obj(pool, oid)); + auto sysobj = sysobj_svc->get_obj(rgw_raw_obj(pool, oid)); return sysobj.wop() .set_exclusive(exclusive) .write(dpp, bl, y); @@ -1268,8 +1252,7 @@ int RGWPeriod::delete_obj(const DoutPrefixProvider *dpp, optional_yield y) for (epoch_t e = 1; e <= epoch; e++) { RGWPeriod p{get_id(), e}; rgw_raw_obj oid{pool, p.get_period_oid()}; - auto obj_ctx = sysobj_svc->init_obj_ctx(); - auto sysobj = sysobj_svc->get_obj(obj_ctx, oid); + auto sysobj = sysobj_svc->get_obj(oid); int ret = sysobj.wop().remove(dpp, y); if (ret < 0) { ldpp_dout(dpp, 0) << "WARNING: failed to delete period object " << oid @@ -1279,8 +1262,7 @@ int RGWPeriod::delete_obj(const DoutPrefixProvider *dpp, optional_yield y) // delete the .latest_epoch object rgw_raw_obj oid{pool, get_period_oid_prefix() + get_latest_epoch_oid()}; - auto obj_ctx = sysobj_svc->init_obj_ctx(); - auto sysobj = sysobj_svc->get_obj(obj_ctx, oid); + auto sysobj = sysobj_svc->get_obj(oid); int ret = sysobj.wop().remove(dpp, y); if (ret < 0) { ldpp_dout(dpp, 0) << "WARNING: failed to delete period object " << oid @@ -1295,8 +1277,7 @@ int RGWPeriod::read_info(const DoutPrefixProvider *dpp, optional_yield y) bufferlist bl; - auto obj_ctx = sysobj_svc->init_obj_ctx(); - auto sysobj = sysobj_svc->get_obj(obj_ctx, rgw_raw_obj{pool, get_period_oid()}); + auto sysobj = sysobj_svc->get_obj(rgw_raw_obj{pool, get_period_oid()}); int ret = sysobj.rop().read(dpp, &bl, y); if (ret < 0) { ldpp_dout(dpp, 0) << "failed reading obj info from " << pool << ":" << get_period_oid() << ": " << cpp_strerror(-ret) << dendl; @@ -1353,8 +1334,7 @@ int RGWPeriod::store_info(const DoutPrefixProvider *dpp, bool exclusive, optiona using ceph::encode; encode(*this, bl); - auto obj_ctx = sysobj_svc->init_obj_ctx(); - auto sysobj = sysobj_svc->get_obj(obj_ctx, rgw_raw_obj(pool, oid)); + auto sysobj = sysobj_svc->get_obj(rgw_raw_obj(pool, oid)); return sysobj.wop() .set_exclusive(exclusive) .write(dpp, bl, y); @@ -1812,8 +1792,7 @@ int RGWZoneParams::create(const DoutPrefixProvider *dpp, optional_yield y, bool { /* check for old pools config */ rgw_raw_obj obj(domain_root, avail_pools); - auto obj_ctx = sysobj_svc->init_obj_ctx(); - auto sysobj = sysobj_svc->get_obj(obj_ctx, obj); + auto sysobj = sysobj_svc->get_obj(obj); int r = sysobj.rop().stat(y, dpp); if (r < 0) { ldpp_dout(dpp, 10) << "couldn't find old data placement pools config, setting up new ones for the zone" << dendl; diff --git a/src/rgw/services/svc_bucket_sync_sobj.cc b/src/rgw/services/svc_bucket_sync_sobj.cc index 87a2372488cc..2f3cfb82517d 100644 --- a/src/rgw/services/svc_bucket_sync_sobj.cc +++ b/src/rgw/services/svc_bucket_sync_sobj.cc @@ -303,7 +303,6 @@ class RGWSI_BS_SObj_HintIndexObj RGWSI_SysObj *sysobj; } svc; - RGWSysObjectCtx obj_ctx; rgw_raw_obj obj; RGWSysObj sysobj; @@ -469,9 +468,8 @@ public: RGWSI_BS_SObj_HintIndexObj(RGWSI_SysObj *_sysobj_svc, const rgw_raw_obj& _obj) : cct(_sysobj_svc->ctx()), - obj_ctx(_sysobj_svc->init_obj_ctx()), obj(_obj), - sysobj(obj_ctx.get_obj(obj)) + sysobj(_sysobj_svc->get_obj(obj)) { svc.sysobj = _sysobj_svc; } diff --git a/src/rgw/services/svc_mdlog.cc b/src/rgw/services/svc_mdlog.cc index a553072778c8..b9622a9bf747 100644 --- a/src/rgw/services/svc_mdlog.cc +++ b/src/rgw/services/svc_mdlog.cc @@ -63,18 +63,17 @@ int RGWSI_MDLog::read_history(RGWMetadataLogHistory *state, optional_yield y, const DoutPrefixProvider *dpp) const { - auto obj_ctx = svc.sysobj->init_obj_ctx(); auto& pool = svc.zone->get_zone_params().log_pool; const auto& oid = RGWMetadataLogHistory::oid; bufferlist bl; - int ret = rgw_get_system_obj(obj_ctx, pool, oid, bl, objv_tracker, nullptr, y, dpp); + int ret = rgw_get_system_obj(svc.sysobj, pool, oid, bl, objv_tracker, nullptr, y, dpp); if (ret < 0) { return ret; } if (bl.length() == 0) { /* bad history object, remove it */ rgw_raw_obj obj(pool, oid); - auto sysobj = obj_ctx.get_obj(obj); + auto sysobj = svc.sysobj->get_obj(obj); ret = sysobj.wop().remove(dpp, y); if (ret < 0) { ldpp_dout(dpp, 0) << "ERROR: meta history is empty, but cannot remove it (" << cpp_strerror(-ret) << ")" << dendl; @@ -103,8 +102,7 @@ int RGWSI_MDLog::write_history(const DoutPrefixProvider *dpp, auto& pool = svc.zone->get_zone_params().log_pool; const auto& oid = RGWMetadataLogHistory::oid; - auto obj_ctx = svc.sysobj->init_obj_ctx(); - return rgw_put_system_obj(dpp, obj_ctx, pool, oid, bl, + return rgw_put_system_obj(dpp, svc.sysobj, pool, oid, bl, exclusive, objv_tracker, real_time{}, y); } diff --git a/src/rgw/services/svc_meta_be_otp.cc b/src/rgw/services/svc_meta_be_otp.cc index bc5db4614555..ec3c6b2050be 100644 --- a/src/rgw/services/svc_meta_be_otp.cc +++ b/src/rgw/services/svc_meta_be_otp.cc @@ -29,7 +29,7 @@ RGWSI_MetaBackend_Handler *RGWSI_MetaBackend_OTP::alloc_be_handler() RGWSI_MetaBackend::Context *RGWSI_MetaBackend_OTP::alloc_ctx() { - return new Context_OTP(sysobj_svc); + return new Context_OTP; } int RGWSI_MetaBackend_OTP::call_with_get_params(ceph::real_time *pmtime, std::function cb) diff --git a/src/rgw/services/svc_meta_be_otp.h b/src/rgw/services/svc_meta_be_otp.h index fc17d761fcd2..d58def473580 100644 --- a/src/rgw/services/svc_meta_be_otp.h +++ b/src/rgw/services/svc_meta_be_otp.h @@ -48,8 +48,6 @@ class RGWSI_MetaBackend_OTP : public RGWSI_MetaBackend_SObj public: struct Context_OTP : public RGWSI_MetaBackend_SObj::Context_SObj { otp_devices_list_t devices; - - Context_OTP(RGWSI_SysObj*_sysobj_svc) : RGWSI_MetaBackend_SObj::Context_SObj(_sysobj_svc, nullptr) {} }; RGWSI_MetaBackend_OTP(CephContext *cct); diff --git a/src/rgw/services/svc_meta_be_params.h b/src/rgw/services/svc_meta_be_params.h index 4b0201e4379a..445f6e18819d 100644 --- a/src/rgw/services/svc_meta_be_params.h +++ b/src/rgw/services/svc_meta_be_params.h @@ -20,13 +20,6 @@ #include -struct RGWSysObjectCtx; - -struct RGWSI_MetaBackend_CtxParams_SObj { - RGWSysObjectCtx *sysobj_ctx{nullptr}; - - RGWSI_MetaBackend_CtxParams_SObj() {} - RGWSI_MetaBackend_CtxParams_SObj(RGWSysObjectCtx * _sysobj_ctx) : sysobj_ctx(_sysobj_ctx) {} -}; +struct RGWSI_MetaBackend_CtxParams_SObj {}; using RGWSI_MetaBackend_CtxParams = std::variant; diff --git a/src/rgw/services/svc_meta_be_sobj.cc b/src/rgw/services/svc_meta_be_sobj.cc index 208f6045f588..5b3ce35f78c3 100644 --- a/src/rgw/services/svc_meta_be_sobj.cc +++ b/src/rgw/services/svc_meta_be_sobj.cc @@ -26,7 +26,7 @@ RGWSI_MetaBackend_Handler *RGWSI_MetaBackend_SObj::alloc_be_handler() RGWSI_MetaBackend::Context *RGWSI_MetaBackend_SObj::alloc_ctx() { - return new Context_SObj(sysobj_svc); + return new Context_SObj; } int RGWSI_MetaBackend_SObj::pre_modify(const DoutPrefixProvider *dpp, RGWSI_MetaBackend::Context *_ctx, @@ -102,31 +102,14 @@ int RGWSI_MetaBackend_SObj::get_shard_id(RGWSI_MetaBackend::Context *_ctx, int RGWSI_MetaBackend_SObj::call(std::optional opt, std::function f) { - if (!opt) { - RGWSI_MetaBackend_SObj::Context_SObj ctx(sysobj_svc); - return f(&ctx); - } - - try { - auto& opt_sobj = std::get(*opt); // w contains int, not float: will throw - - RGWSI_MetaBackend_SObj::Context_SObj ctx(sysobj_svc, opt_sobj.sysobj_ctx); - return f(&ctx); - } catch (const std::bad_variant_access&) { - ldout(cct, 0) << "ERROR: possible bug: " << __FILE__ << ":" << __LINE__ << ":" << __func__ << "(): bad variant access" << dendl; - } - - return -EINVAL; + RGWSI_MetaBackend_SObj::Context_SObj ctx; + return f(&ctx); } void RGWSI_MetaBackend_SObj::Context_SObj::init(RGWSI_MetaBackend_Handler *h) { RGWSI_MetaBackend_Handler_SObj *handler = static_cast(h); module = handler->module; - if (!obj_ctx) { - _obj_ctx.emplace(sysobj_svc->init_obj_ctx()); - obj_ctx = &(*_obj_ctx); - } } int RGWSI_MetaBackend_SObj::call_with_get_params(ceph::real_time *pmtime, std::function cb) @@ -154,7 +137,7 @@ int RGWSI_MetaBackend_SObj::get_entry(RGWSI_MetaBackend::Context *_ctx, ctx->module->get_pool_and_oid(key, &pool, &oid); int ret = 0; - ret = rgw_get_system_obj(*ctx->obj_ctx, pool, oid, *params.pbl, + ret = rgw_get_system_obj(sysobj_svc, pool, oid, *params.pbl, objv_tracker, params.pmtime, y, dpp, params.pattrs, params.cache_info, @@ -177,7 +160,7 @@ int RGWSI_MetaBackend_SObj::put_entry(const DoutPrefixProvider *dpp, string oid; ctx->module->get_pool_and_oid(key, &pool, &oid); - return rgw_put_system_obj(dpp, *ctx->obj_ctx, pool, oid, params.bl, params.exclusive, + return rgw_put_system_obj(dpp, sysobj_svc, pool, oid, params.bl, params.exclusive, objv_tracker, params.mtime, y, params.pattrs); } @@ -195,7 +178,7 @@ int RGWSI_MetaBackend_SObj::remove_entry(const DoutPrefixProvider *dpp, ctx->module->get_pool_and_oid(key, &pool, &oid); rgw_raw_obj k(pool, oid); - auto sysobj = ctx->obj_ctx->get_obj(k); + auto sysobj = sysobj_svc->get_obj(k); return sysobj.wop() .set_objv_tracker(objv_tracker) .remove(dpp, y); diff --git a/src/rgw/services/svc_meta_be_sobj.h b/src/rgw/services/svc_meta_be_sobj.h index fe3230ec8d97..a7b703f703c1 100644 --- a/src/rgw/services/svc_meta_be_sobj.h +++ b/src/rgw/services/svc_meta_be_sobj.h @@ -96,20 +96,12 @@ protected: public: struct Context_SObj : public RGWSI_MetaBackend::Context { - RGWSI_SysObj *sysobj_svc{nullptr}; - RGWSI_MBSObj_Handler_Module *module{nullptr}; - std::optional _obj_ctx; - RGWSysObjectCtx *obj_ctx{nullptr}; struct _list { std::optional pool; std::optional op; } list; - Context_SObj(RGWSI_SysObj *_sysobj_svc, - RGWSysObjectCtx *_oc = nullptr) : sysobj_svc(_sysobj_svc), - obj_ctx(_oc) {} - void init(RGWSI_MetaBackend_Handler *h) override; }; diff --git a/src/rgw/services/svc_sys_obj.cc b/src/rgw/services/svc_sys_obj.cc index a19a66279f1f..0bd3e877bdd5 100644 --- a/src/rgw/services/svc_sys_obj.cc +++ b/src/rgw/services/svc_sys_obj.cc @@ -12,19 +12,9 @@ using namespace std; -RGWSysObjectCtx RGWSI_SysObj::init_obj_ctx() +RGWSI_SysObj::Obj RGWSI_SysObj::get_obj(const rgw_raw_obj& obj) { - return RGWSysObjectCtx(this); -} - -RGWSI_SysObj::Obj RGWSI_SysObj::get_obj(RGWSysObjectCtx& obj_ctx, const rgw_raw_obj& obj) -{ - return Obj(core_svc, obj_ctx, obj); -} - -void RGWSI_SysObj::Obj::invalidate() -{ - ctx.invalidate(obj); + return Obj(core_svc, obj); } RGWSI_SysObj::Obj::ROp::ROp(Obj& _source) : source(_source) { diff --git a/src/rgw/services/svc_sys_obj.h b/src/rgw/services/svc_sys_obj.h index cc618bf7b75c..aaf0d347e6d5 100644 --- a/src/rgw/services/svc_sys_obj.h +++ b/src/rgw/services/svc_sys_obj.h @@ -14,7 +14,6 @@ class RGWSI_Zone; class RGWSI_SysObj; -class RGWSysObjectCtx; struct rgw_cache_entry_info; @@ -27,21 +26,11 @@ public: friend class ROp; RGWSI_SysObj_Core *core_svc; - RGWSysObjectCtx& ctx; rgw_raw_obj obj; public: - Obj(RGWSI_SysObj_Core *_core_svc, - RGWSysObjectCtx& _ctx, - const rgw_raw_obj& _obj) : core_svc(_core_svc), - ctx(_ctx), - obj(_obj) {} - - void invalidate(); - - RGWSysObjectCtx& get_ctx() { - return ctx; - } + Obj(RGWSI_SysObj_Core *_core_svc, const rgw_raw_obj& _obj) + : core_svc(_core_svc), obj(_obj) {} rgw_raw_obj& get_obj() { return obj; @@ -269,8 +258,7 @@ protected: public: RGWSI_SysObj(CephContext *cct): RGWServiceInstance(cct) {} - RGWSysObjectCtx init_obj_ctx(); - Obj get_obj(RGWSysObjectCtx& obj_ctx, const rgw_raw_obj& obj); + Obj get_obj(const rgw_raw_obj& obj); Pool get_pool(const rgw_pool& pool) { return Pool(core_svc, pool); @@ -280,14 +268,3 @@ public: }; using RGWSysObj = RGWSI_SysObj::Obj; - -class RGWSysObjectCtx : public RGWSysObjectCtxBase -{ - RGWSI_SysObj *sysobj_svc; -public: - RGWSysObjectCtx(RGWSI_SysObj *_sysobj_svc) : sysobj_svc(_sysobj_svc) {} - - RGWSI_SysObj::Obj get_obj(const rgw_raw_obj& obj) { - return sysobj_svc->get_obj(*this, obj); - } -}; diff --git a/src/rgw/services/svc_sys_obj_core_types.h b/src/rgw/services/svc_sys_obj_core_types.h index 159c55115813..77536dcac158 100644 --- a/src/rgw/services/svc_sys_obj_core_types.h +++ b/src/rgw/services/svc_sys_obj_core_types.h @@ -32,86 +32,3 @@ struct RGWSI_SysObj_Core_PoolListImplInfo : public RGWSI_SysObj_Pool_ListInfo { RGWSI_SysObj_Core_PoolListImplInfo(const std::string& prefix) : op(pool.op()), filter(prefix) {} }; - -struct RGWSysObjState { - rgw_raw_obj obj; - bool has_attrs{false}; - bool exists{false}; - uint64_t size{0}; - ceph::real_time mtime; - uint64_t epoch{0}; - bufferlist obj_tag; - bool has_data{false}; - bufferlist data; - bool prefetch_data{false}; - uint64_t pg_ver{0}; - - /* important! don't forget to update copy constructor */ - - RGWObjVersionTracker objv_tracker; - - std::map attrset; - RGWSysObjState() {} - RGWSysObjState(const RGWSysObjState& rhs) : obj (rhs.obj) { - has_attrs = rhs.has_attrs; - exists = rhs.exists; - size = rhs.size; - mtime = rhs.mtime; - epoch = rhs.epoch; - if (rhs.obj_tag.length()) { - obj_tag = rhs.obj_tag; - } - has_data = rhs.has_data; - if (rhs.data.length()) { - data = rhs.data; - } - prefetch_data = rhs.prefetch_data; - pg_ver = rhs.pg_ver; - objv_tracker = rhs.objv_tracker; - } -}; - - -class RGWSysObjectCtxBase { - std::map objs_state; - ceph::shared_mutex lock = ceph::make_shared_mutex("RGWSysObjectCtxBase"); - -public: - RGWSysObjectCtxBase() = default; - - RGWSysObjectCtxBase(const RGWSysObjectCtxBase& rhs) : objs_state(rhs.objs_state) {} - RGWSysObjectCtxBase(RGWSysObjectCtxBase&& rhs) : objs_state(std::move(rhs.objs_state)) {} - - RGWSysObjState *get_state(const rgw_raw_obj& obj) { - RGWSysObjState *result; - std::map::iterator iter; - lock.lock_shared(); - assert (!obj.empty()); - iter = objs_state.find(obj); - if (iter != objs_state.end()) { - result = &iter->second; - lock.unlock_shared(); - } else { - lock.unlock_shared(); - lock.lock(); - result = &objs_state[obj]; - lock.unlock(); - } - return result; - } - - void set_prefetch_data(rgw_raw_obj& obj) { - std::unique_lock wl{lock}; - assert (!obj.empty()); - objs_state[obj].prefetch_data = true; - } - void invalidate(const rgw_raw_obj& obj) { - std::unique_lock wl{lock}; - auto iter = objs_state.find(obj); - if (iter == objs_state.end()) { - return; - } - objs_state.erase(iter); - } -}; - diff --git a/src/rgw/services/svc_user.h b/src/rgw/services/svc_user.h index a998f857e8b9..ef867e699430 100644 --- a/src/rgw/services/svc_user.h +++ b/src/rgw/services/svc_user.h @@ -90,17 +90,14 @@ public: const DoutPrefixProvider *dpp) = 0; virtual int add_bucket(const DoutPrefixProvider *dpp, - RGWSI_MetaBackend::Context *ctx, const rgw_user& user, const rgw_bucket& bucket, ceph::real_time creation_time, optional_yield y) = 0; virtual int remove_bucket(const DoutPrefixProvider *dpp, - RGWSI_MetaBackend::Context *ctx, const rgw_user& user, const rgw_bucket& _bucket, optional_yield) = 0; virtual int list_buckets(const DoutPrefixProvider *dpp, - RGWSI_MetaBackend::Context *ctx, const rgw_user& user, const std::string& marker, const std::string& end_marker, @@ -110,13 +107,11 @@ public: optional_yield y) = 0; virtual int flush_bucket_stats(const DoutPrefixProvider *dpp, - RGWSI_MetaBackend::Context *ctx, const rgw_user& user, const RGWBucketEnt& ent, optional_yield y) = 0; - virtual int complete_flush_stats(const DoutPrefixProvider *dpp, RGWSI_MetaBackend::Context *ctx, + virtual int complete_flush_stats(const DoutPrefixProvider *dpp, const rgw_user& user, optional_yield y) = 0; virtual int reset_bucket_stats(const DoutPrefixProvider *dpp, - RGWSI_MetaBackend::Context *ctx, const rgw_user& user, optional_yield y) = 0; virtual int read_stats(const DoutPrefixProvider *dpp, @@ -126,7 +121,7 @@ public: ceph::real_time *last_stats_update, optional_yield y) = 0; /* last time a stats update was done */ - virtual int read_stats_async(const DoutPrefixProvider *dpp, RGWSI_MetaBackend::Context *ctx, + virtual int read_stats_async(const DoutPrefixProvider *dpp, const rgw_user& user, RGWGetUserStats_CB *cb) = 0; }; diff --git a/src/rgw/services/svc_user_rados.cc b/src/rgw/services/svc_user_rados.cc index 88dfca285a7c..1866ff682f78 100644 --- a/src/rgw/services/svc_user_rados.cc +++ b/src/rgw/services/svc_user_rados.cc @@ -255,12 +255,10 @@ public: bufferlist link_bl; encode(ui, link_bl); - auto& obj_ctx = *ctx->obj_ctx; - if (!info.user_email.empty()) { if (!old_info || old_info->user_email.compare(info.user_email) != 0) { /* only if new index changed */ - ret = rgw_put_system_obj(dpp, obj_ctx, svc.zone->get_zone_params().user_email_pool, info.user_email, + ret = rgw_put_system_obj(dpp, svc.sysobj, svc.zone->get_zone_params().user_email_pool, info.user_email, link_bl, exclusive, NULL, real_time(), y); if (ret < 0) return ret; @@ -273,7 +271,7 @@ public: if (old_info && old_info->access_keys.count(iter->first) != 0 && !renamed) continue; - ret = rgw_put_system_obj(dpp, obj_ctx, svc.zone->get_zone_params().user_keys_pool, k.id, + ret = rgw_put_system_obj(dpp, svc.sysobj, svc.zone->get_zone_params().user_keys_pool, k.id, link_bl, exclusive, NULL, real_time(), y); if (ret < 0) return ret; @@ -284,7 +282,7 @@ public: if (old_info && old_info->swift_keys.count(siter->first) != 0 && !renamed) continue; - ret = rgw_put_system_obj(dpp, obj_ctx, svc.zone->get_zone_params().user_swift_pool, k.id, + ret = rgw_put_system_obj(dpp, svc.sysobj, svc.zone->get_zone_params().user_swift_pool, k.id, link_bl, exclusive, NULL, real_time(), y); if (ret < 0) return ret; @@ -318,7 +316,7 @@ public: if (!old_info.user_email.empty() && old_info.user_email != new_info.user_email) { - ret = svc.user->remove_email_index(dpp, ctx, old_info.user_email, y); + ret = svc.user->remove_email_index(dpp, old_info.user_email, y); if (ret < 0 && ret != -ENOENT) { set_err_msg("ERROR: could not remove index for email " + old_info.user_email); return ret; @@ -327,7 +325,7 @@ public: for ([[maybe_unused]] const auto& [name, access_key] : old_info.access_keys) { if (!new_info.access_keys.count(access_key.id)) { - ret = svc.user->remove_key_index(dpp, ctx, access_key, y); + ret = svc.user->remove_key_index(dpp, access_key, y); if (ret < 0 && ret != -ENOENT) { set_err_msg("ERROR: could not remove index for key " + access_key.id); return ret; @@ -339,7 +337,7 @@ public: const auto& swift_key = old_iter->second; auto new_iter = new_info.swift_keys.find(swift_key.id); if (new_iter == new_info.swift_keys.end()) { - ret = svc.user->remove_swift_name_index(dpp, ctx, swift_key.id, y); + ret = svc.user->remove_swift_name_index(dpp, swift_key.id, y); if (ret < 0 && ret != -ENOENT) { set_err_msg("ERROR: could not remove index for swift_name " + swift_key.id); return ret; @@ -391,36 +389,32 @@ int RGWSI_User_RADOS::store_user_info(RGWSI_MetaBackend::Context *ctx, } int RGWSI_User_RADOS::remove_key_index(const DoutPrefixProvider *dpp, - RGWSI_MetaBackend::Context *_ctx, const RGWAccessKey& access_key, optional_yield y) { - RGWSI_MetaBackend_SObj::Context_SObj *ctx = static_cast(_ctx); rgw_raw_obj obj(svc.zone->get_zone_params().user_keys_pool, access_key.id); - auto sysobj = ctx->obj_ctx->get_obj(obj); + auto sysobj = svc.sysobj->get_obj(obj); return sysobj.wop().remove(dpp, y); } int RGWSI_User_RADOS::remove_email_index(const DoutPrefixProvider *dpp, - RGWSI_MetaBackend::Context *_ctx, const string& email, optional_yield y) { if (email.empty()) { return 0; } - RGWSI_MetaBackend_SObj::Context_SObj *ctx = static_cast(_ctx); rgw_raw_obj obj(svc.zone->get_zone_params().user_email_pool, email); - auto sysobj = ctx->obj_ctx->get_obj(obj); + auto sysobj = svc.sysobj->get_obj(obj); return sysobj.wop().remove(dpp, y); } -int RGWSI_User_RADOS::remove_swift_name_index(const DoutPrefixProvider *dpp, RGWSI_MetaBackend::Context *_ctx, const string& swift_name, +int RGWSI_User_RADOS::remove_swift_name_index(const DoutPrefixProvider *dpp, + const string& swift_name, optional_yield y) { - RGWSI_MetaBackend_SObj::Context_SObj *ctx = static_cast(_ctx); rgw_raw_obj obj(svc.zone->get_zone_params().user_swift_pool, swift_name); - auto sysobj = ctx->obj_ctx->get_obj(obj); + auto sysobj = svc.sysobj->get_obj(obj); return sysobj.wop().remove(dpp, y); } @@ -430,7 +424,7 @@ int RGWSI_User_RADOS::remove_swift_name_index(const DoutPrefixProvider *dpp, RGW * from the user and user email pools. This leaves the pools * themselves alone, as well as any ACLs embedded in object xattrs. */ -int RGWSI_User_RADOS::remove_user_info(RGWSI_MetaBackend::Context *_ctx, +int RGWSI_User_RADOS::remove_user_info(RGWSI_MetaBackend::Context *ctx, const RGWUserInfo& info, RGWObjVersionTracker *objv_tracker, optional_yield y, @@ -441,7 +435,7 @@ int RGWSI_User_RADOS::remove_user_info(RGWSI_MetaBackend::Context *_ctx, auto kiter = info.access_keys.begin(); for (; kiter != info.access_keys.end(); ++kiter) { ldpp_dout(dpp, 10) << "removing key index: " << kiter->first << dendl; - ret = remove_key_index(dpp, _ctx, kiter->second, y); + ret = remove_key_index(dpp, kiter->second, y); if (ret < 0 && ret != -ENOENT) { ldpp_dout(dpp, 0) << "ERROR: could not remove " << kiter->first << " (access key object), should be fixed (err=" << ret << ")" << dendl; return ret; @@ -453,7 +447,7 @@ int RGWSI_User_RADOS::remove_user_info(RGWSI_MetaBackend::Context *_ctx, auto& k = siter->second; ldpp_dout(dpp, 10) << "removing swift subuser index: " << k.id << dendl; /* check if swift mapping exists */ - ret = remove_swift_name_index(dpp, _ctx, k.id, y); + ret = remove_swift_name_index(dpp, k.id, y); if (ret < 0 && ret != -ENOENT) { ldpp_dout(dpp, 0) << "ERROR: could not remove " << k.id << " (swift name object), should be fixed (err=" << ret << ")" << dendl; return ret; @@ -461,7 +455,7 @@ int RGWSI_User_RADOS::remove_user_info(RGWSI_MetaBackend::Context *_ctx, } ldpp_dout(dpp, 10) << "removing email index: " << info.user_email << dendl; - ret = remove_email_index(dpp, _ctx, info.user_email, y); + ret = remove_email_index(dpp, info.user_email, y); if (ret < 0 && ret != -ENOENT) { ldpp_dout(dpp, 0) << "ERROR: could not remove email index object for " << info.user_email << ", should be fixed (err=" << ret << ")" << dendl; @@ -470,8 +464,7 @@ int RGWSI_User_RADOS::remove_user_info(RGWSI_MetaBackend::Context *_ctx, rgw_raw_obj uid_bucks = get_buckets_obj(info.user_id); ldpp_dout(dpp, 10) << "removing user buckets index" << dendl; - RGWSI_MetaBackend_SObj::Context_SObj *ctx = static_cast(_ctx); - auto sysobj = ctx->obj_ctx->get_obj(uid_bucks); + auto sysobj = svc.sysobj->get_obj(uid_bucks); ret = sysobj.wop().remove(dpp, y); if (ret < 0 && ret != -ENOENT) { ldpp_dout(dpp, 0) << "ERROR: could not remove " << info.user_id << ":" << uid_bucks << ", should be fixed (err=" << ret << ")" << dendl; @@ -504,15 +497,14 @@ int RGWSI_User_RADOS::remove_uid_index(RGWSI_MetaBackend::Context *ctx, const RG return 0; } -int RGWSI_User_RADOS::get_user_info_from_index(RGWSI_MetaBackend::Context *_ctx, - const string& key, - const rgw_pool& pool, - RGWUserInfo *info, - RGWObjVersionTracker * const objv_tracker, - real_time * const pmtime, optional_yield y, const DoutPrefixProvider *dpp) +int RGWSI_User_RADOS::get_user_info_from_index(RGWSI_MetaBackend::Context* ctx, + const string& key, + const rgw_pool& pool, + RGWUserInfo *info, + RGWObjVersionTracker* objv_tracker, + real_time* pmtime, optional_yield y, + const DoutPrefixProvider* dpp) { - RGWSI_MetaBackend_SObj::Context_SObj *ctx = static_cast(_ctx); - string cache_key = pool.to_str() + "/" + key; if (auto e = uinfo_cache->find(cache_key)) { @@ -528,7 +520,7 @@ int RGWSI_User_RADOS::get_user_info_from_index(RGWSI_MetaBackend::Context *_ctx, bufferlist bl; RGWUID uid; - int ret = rgw_get_system_obj(*ctx->obj_ctx, pool, key, bl, nullptr, &e.mtime, y, dpp); + int ret = rgw_get_system_obj(svc.sysobj, pool, key, bl, nullptr, &e.mtime, y, dpp); if (ret < 0) return ret; @@ -652,7 +644,6 @@ int RGWSI_User_RADOS::cls_user_remove_bucket(const DoutPrefixProvider *dpp, rgw_ } int RGWSI_User_RADOS::add_bucket(const DoutPrefixProvider *dpp, - RGWSI_MetaBackend::Context *ctx, const rgw_user& user, const rgw_bucket& bucket, ceph::real_time creation_time, @@ -681,7 +672,6 @@ int RGWSI_User_RADOS::add_bucket(const DoutPrefixProvider *dpp, int RGWSI_User_RADOS::remove_bucket(const DoutPrefixProvider *dpp, - RGWSI_MetaBackend::Context *ctx, const rgw_user& user, const rgw_bucket& _bucket, optional_yield y) @@ -747,7 +737,6 @@ int RGWSI_User_RADOS::cls_user_list_buckets(const DoutPrefixProvider *dpp, } int RGWSI_User_RADOS::list_buckets(const DoutPrefixProvider *dpp, - RGWSI_MetaBackend::Context *ctx, const rgw_user& user, const string& marker, const string& end_marker, @@ -796,7 +785,6 @@ int RGWSI_User_RADOS::list_buckets(const DoutPrefixProvider *dpp, } int RGWSI_User_RADOS::flush_bucket_stats(const DoutPrefixProvider *dpp, - RGWSI_MetaBackend::Context *ctx, const rgw_user& user, const RGWBucketEnt& ent, optional_yield y) @@ -807,7 +795,6 @@ int RGWSI_User_RADOS::flush_bucket_stats(const DoutPrefixProvider *dpp, } int RGWSI_User_RADOS::reset_bucket_stats(const DoutPrefixProvider *dpp, - RGWSI_MetaBackend::Context *ctx, const rgw_user& user, optional_yield y) { @@ -851,7 +838,6 @@ int RGWSI_User_RADOS::cls_user_reset_stats(const DoutPrefixProvider *dpp, const } int RGWSI_User_RADOS::complete_flush_stats(const DoutPrefixProvider *dpp, - RGWSI_MetaBackend::Context *ctx, const rgw_user& user, optional_yield y) { rgw_raw_obj obj = get_buckets_obj(user); @@ -965,7 +951,7 @@ public: } }; -int RGWSI_User_RADOS::read_stats_async(const DoutPrefixProvider *dpp, RGWSI_MetaBackend::Context *ctx, +int RGWSI_User_RADOS::read_stats_async(const DoutPrefixProvider *dpp, const rgw_user& user, RGWGetUserStats_CB *_cb) { string user_str = user.to_str(); diff --git a/src/rgw/services/svc_user_rados.h b/src/rgw/services/svc_user_rados.h index 3ab69b0355d1..d822528c5d97 100644 --- a/src/rgw/services/svc_user_rados.h +++ b/src/rgw/services/svc_user_rados.h @@ -69,9 +69,9 @@ class RGWSI_User_RADOS : public RGWSI_User int remove_uid_index(RGWSI_MetaBackend::Context *ctx, const RGWUserInfo& user_info, RGWObjVersionTracker *objv_tracker, optional_yield y, const DoutPrefixProvider *dpp); - int remove_key_index(const DoutPrefixProvider *dpp, RGWSI_MetaBackend::Context *ctx, const RGWAccessKey& access_key, optional_yield y); - int remove_email_index(const DoutPrefixProvider *dpp, RGWSI_MetaBackend::Context *ctx, const std::string& email, optional_yield y); - int remove_swift_name_index(const DoutPrefixProvider *dpp, RGWSI_MetaBackend::Context *ctx, const std::string& swift_name, optional_yield y); + int remove_key_index(const DoutPrefixProvider *dpp, const RGWAccessKey& access_key, optional_yield y); + int remove_email_index(const DoutPrefixProvider *dpp, const std::string& email, optional_yield y); + int remove_swift_name_index(const DoutPrefixProvider *dpp, const std::string& swift_name, optional_yield y); /* admin management */ int cls_user_update_buckets(const DoutPrefixProvider *dpp, rgw_raw_obj& obj, std::list& entries, bool add, optional_yield y); @@ -171,18 +171,15 @@ public: /* user buckets directory */ int add_bucket(const DoutPrefixProvider *dpp, - RGWSI_MetaBackend::Context *ctx, const rgw_user& user, const rgw_bucket& bucket, ceph::real_time creation_time, optional_yield y) override; int remove_bucket(const DoutPrefixProvider *dpp, - RGWSI_MetaBackend::Context *ctx, const rgw_user& user, const rgw_bucket& _bucket, optional_yield y) override; int list_buckets(const DoutPrefixProvider *dpp, - RGWSI_MetaBackend::Context *ctx, const rgw_user& user, const std::string& marker, const std::string& end_marker, @@ -193,16 +190,13 @@ public: /* quota related */ int flush_bucket_stats(const DoutPrefixProvider *dpp, - RGWSI_MetaBackend::Context *ctx, const rgw_user& user, const RGWBucketEnt& ent, optional_yield y) override; int complete_flush_stats(const DoutPrefixProvider *dpp, - RGWSI_MetaBackend::Context *ctx, const rgw_user& user, optional_yield y) override; int reset_bucket_stats(const DoutPrefixProvider *dpp, - RGWSI_MetaBackend::Context *ctx, const rgw_user& user, optional_yield y) override; int read_stats(const DoutPrefixProvider *dpp, @@ -212,7 +206,7 @@ public: ceph::real_time *last_stats_update, optional_yield y) override; /* last time a stats update was done */ - int read_stats_async(const DoutPrefixProvider *dpp, RGWSI_MetaBackend::Context *ctx, - const rgw_user& user, RGWGetUserStats_CB *cb) override; + int read_stats_async(const DoutPrefixProvider *dpp, const rgw_user& user, + RGWGetUserStats_CB *cb) override; }; diff --git a/src/rgw/services/svc_zone.cc b/src/rgw/services/svc_zone.cc index f314ea79c0c4..e8ab23b4edcb 100644 --- a/src/rgw/services/svc_zone.cc +++ b/src/rgw/services/svc_zone.cc @@ -488,8 +488,7 @@ int RGWSI_Zone::replace_region_with_zonegroup(const DoutPrefixProvider *dpp, opt string oid = "converted"; bufferlist bl; - RGWSysObjectCtx obj_ctx = sysobj_svc->init_obj_ctx(); - RGWSysObj sysobj = sysobj_svc->get_obj(obj_ctx, rgw_raw_obj(pool, oid)); + RGWSysObj sysobj = sysobj_svc->get_obj(rgw_raw_obj(pool, oid)); int ret = sysobj.rop().read(dpp, &bl, y); if (ret < 0 && ret != -ENOENT) { @@ -891,8 +890,7 @@ int RGWSI_Zone::convert_regionmap(const DoutPrefixProvider *dpp, optional_yield rgw_pool pool(pool_name); bufferlist bl; - RGWSysObjectCtx obj_ctx = sysobj_svc->init_obj_ctx(); - RGWSysObj sysobj = sysobj_svc->get_obj(obj_ctx, rgw_raw_obj(pool, oid)); + RGWSysObj sysobj = sysobj_svc->get_obj(rgw_raw_obj(pool, oid)); int ret = sysobj.rop().read(dpp, &bl, y); if (ret < 0 && ret != -ENOENT) { @@ -1262,9 +1260,7 @@ int RGWSI_Zone::select_legacy_bucket_placement(const DoutPrefixProvider *dpp, RG rgw_raw_obj obj(zone_params->domain_root, avail_pools); - auto obj_ctx = sysobj_svc->init_obj_ctx(); - auto sysobj = obj_ctx.get_obj(obj); - + auto sysobj = sysobj_svc->get_obj(obj); int ret = sysobj.rop().read(dpp, &map_bl, y); if (ret < 0) { goto read_omap; @@ -1332,9 +1328,7 @@ int RGWSI_Zone::update_placement_map(const DoutPrefixProvider *dpp, optional_yie map m; rgw_raw_obj obj(zone_params->domain_root, avail_pools); - auto obj_ctx = sysobj_svc->init_obj_ctx(); - auto sysobj = obj_ctx.get_obj(obj); - + auto sysobj = sysobj_svc->get_obj(obj); int ret = sysobj.omap().get_all(dpp, &m, y); if (ret < 0) return ret; @@ -1357,8 +1351,7 @@ int RGWSI_Zone::add_bucket_placement(const DoutPrefixProvider *dpp, const rgw_po } rgw_raw_obj obj(zone_params->domain_root, avail_pools); - auto obj_ctx = sysobj_svc->init_obj_ctx(); - auto sysobj = obj_ctx.get_obj(obj); + auto sysobj = sysobj_svc->get_obj(obj); bufferlist empty_bl; ret = sysobj.omap().set(dpp, new_pool.to_str(), empty_bl, y); @@ -1372,9 +1365,7 @@ int RGWSI_Zone::add_bucket_placement(const DoutPrefixProvider *dpp, const rgw_po int RGWSI_Zone::remove_bucket_placement(const DoutPrefixProvider *dpp, const rgw_pool& old_pool, optional_yield y) { rgw_raw_obj obj(zone_params->domain_root, avail_pools); - auto obj_ctx = sysobj_svc->init_obj_ctx(); - auto sysobj = obj_ctx.get_obj(obj); - + auto sysobj = sysobj_svc->get_obj(obj); int ret = sysobj.omap().del(dpp, old_pool.to_str(), y); // don't care about return value @@ -1389,8 +1380,7 @@ int RGWSI_Zone::list_placement_set(const DoutPrefixProvider *dpp, set& map m; rgw_raw_obj obj(zone_params->domain_root, avail_pools); - auto obj_ctx = sysobj_svc->init_obj_ctx(); - auto sysobj = obj_ctx.get_obj(obj); + auto sysobj = sysobj_svc->get_obj(obj); int ret = sysobj.omap().get_all(dpp, &m, y); if (ret < 0) return ret;