From 1c579f2469be3083b9a99bc20298769f1bc24892 Mon Sep 17 00:00:00 2001 From: Jiffin Tony Thottan Date: Tue, 31 Oct 2023 12:50:52 +0530 Subject: [PATCH] rgw/rgw_period : remove realm name from period config The realm name is used in period configuration, only initialised in the beginning. Only value which is needed is the realm_id, hence removing realm_name from period config. Signed-off-by: Jiffin Tony Thottan --- src/rgw/driver/rados/rgw_rest_realm.cc | 5 ++--- src/rgw/driver/rados/rgw_trim_mdlog.cc | 7 +++---- src/rgw/driver/rados/rgw_zone.cc | 1 - src/rgw/driver/rados/rgw_zone.h | 6 +----- src/rgw/rgw_period.cc | 12 ++++-------- src/rgw/rgw_period_pusher.cc | 2 +- src/rgw/rgw_realm.cc | 6 +++--- src/rgw/services/svc_zone.cc | 3 +-- 8 files changed, 15 insertions(+), 27 deletions(-) diff --git a/src/rgw/driver/rados/rgw_rest_realm.cc b/src/rgw/driver/rados/rgw_rest_realm.cc index 79640a2a108..91381d77295 100644 --- a/src/rgw/driver/rados/rgw_rest_realm.cc +++ b/src/rgw/driver/rados/rgw_rest_realm.cc @@ -65,17 +65,16 @@ class RGWOp_Period_Get : public RGWOp_Period_Base { void RGWOp_Period_Get::execute(optional_yield y) { - string realm_id, realm_name, period_id; + string realm_id, period_id; epoch_t epoch = 0; RESTArgs::get_string(s, "realm_id", realm_id, &realm_id); - RESTArgs::get_string(s, "realm_name", realm_name, &realm_name); RESTArgs::get_string(s, "period_id", period_id, &period_id); RESTArgs::get_uint32(s, "epoch", 0, &epoch); period.set_id(period_id); period.set_epoch(epoch); - op_ret = period.init(this, driver->ctx(), static_cast(driver)->svc()->sysobj, realm_id, y, realm_name); + op_ret = period.init(this, driver->ctx(), static_cast(driver)->svc()->sysobj, realm_id, y); if (op_ret < 0) ldpp_dout(this, 5) << "failed to read period" << dendl; } diff --git a/src/rgw/driver/rados/rgw_trim_mdlog.cc b/src/rgw/driver/rados/rgw_trim_mdlog.cc index d97538f9832..da649366c0f 100644 --- a/src/rgw/driver/rados/rgw_trim_mdlog.cc +++ b/src/rgw/driver/rados/rgw_trim_mdlog.cc @@ -729,8 +729,8 @@ bool sanity_check_endpoints(const DoutPrefixProvider *dpp, rgw::sal::RadosStore* << __PRETTY_FUNCTION__ << ":" << __LINE__ << " WARNING: Cluster is is misconfigured! " << " Zonegroup " << zonegroup.get_name() - << " (" << zonegroup.get_id() << ") in Realm " - << period.get_realm_name() << " ( " << period.get_realm() << ") " + << " (" << zonegroup.get_id() << ") in Realm id ( " + << period.get_realm() << ") " << " has no endpoints!" << dendl; } for (const auto& [_, zone] : zonegroup.zones) { @@ -740,8 +740,7 @@ bool sanity_check_endpoints(const DoutPrefixProvider *dpp, rgw::sal::RadosStore* << " ERROR: Cluster is is misconfigured! " << " Zone " << zone.name << " (" << zone.id << ") in Zonegroup " << zonegroup.get_name() << " ( " << zonegroup.get_id() - << ") in Realm " << period.get_realm_name() - << " ( " << period.get_realm() << ") " + << ") in Realm id ( " << period.get_realm() << ") " << " has no endpoints! Trimming is impossible." << dendl; retval = false; } diff --git a/src/rgw/driver/rados/rgw_zone.cc b/src/rgw/driver/rados/rgw_zone.cc index 8c237f6beda..850748c8ff1 100644 --- a/src/rgw/driver/rados/rgw_zone.cc +++ b/src/rgw/driver/rados/rgw_zone.cc @@ -516,7 +516,6 @@ int create_realm(const DoutPrefixProvider* dpp, optional_yield y, period->period_map.id = period->id; period->epoch = FIRST_EPOCH; period->realm_id = info.id; - period->realm_name = info.name; r = cfgstore->create_period(dpp, y, true, *period); if (r < 0) { diff --git a/src/rgw/driver/rados/rgw_zone.h b/src/rgw/driver/rados/rgw_zone.h index 140678fcdce..fea7bdb2183 100644 --- a/src/rgw/driver/rados/rgw_zone.h +++ b/src/rgw/driver/rados/rgw_zone.h @@ -642,7 +642,6 @@ public: rgw_zone_id master_zone; std::string realm_id; - std::string realm_name; epoch_t realm_epoch{1}; //< realm epoch when period was made current CephContext *cct{nullptr}; @@ -678,7 +677,6 @@ public: const rgw_zone_id& get_master_zone() const { return master_zone; } const std::string& get_master_zonegroup() const { return master_zonegroup; } const std::string& get_realm() const { return realm_id; } - const std::string& get_realm_name() const { return realm_name; } const RGWPeriodMap& get_map() const { return period_map; } RGWPeriodConfig& get_config() { return period_config; } const RGWPeriodConfig& get_config() const { return period_config; } @@ -750,7 +748,7 @@ public: int update_latest_epoch(const DoutPrefixProvider *dpp, epoch_t epoch, optional_yield y); int init(const DoutPrefixProvider *dpp, CephContext *_cct, RGWSI_SysObj *_sysobj_svc, const std::string &period_realm_id, optional_yield y, - const std::string &period_realm_name = "", bool setup_obj = true); + bool setup_obj = true); int init(const DoutPrefixProvider *dpp, CephContext *_cct, RGWSI_SysObj *_sysobj_svc, optional_yield y, bool setup_obj = true); int create(const DoutPrefixProvider *dpp, optional_yield y, bool exclusive = true); @@ -780,7 +778,6 @@ public: encode(master_zonegroup, bl); encode(period_config, bl); encode(realm_id, bl); - encode(realm_name, bl); ENCODE_FINISH(bl); } @@ -796,7 +793,6 @@ public: decode(master_zonegroup, bl); decode(period_config, bl); decode(realm_id, bl); - decode(realm_name, bl); DECODE_FINISH(bl); } void dump(Formatter *f) const; diff --git a/src/rgw/rgw_period.cc b/src/rgw/rgw_period.cc index 1e7de60ea6f..67ce9803951 100644 --- a/src/rgw/rgw_period.cc +++ b/src/rgw/rgw_period.cc @@ -22,10 +22,10 @@ int RGWPeriod::init(const DoutPrefixProvider *dpp, return 0; if (id.empty()) { - RGWRealm realm(realm_id, realm_name); + RGWRealm realm(realm_id); int ret = realm.init(dpp, cct, sysobj_svc, y); if (ret < 0) { - ldpp_dout(dpp, 4) << "RGWPeriod::init failed to init realm " << realm_name << " id " << realm_id << " : " << + ldpp_dout(dpp, 4) << "RGWPeriod::init failed to init realm id " << realm_id << " : " << cpp_strerror(-ret) << dendl; return ret; } @@ -36,7 +36,7 @@ int RGWPeriod::init(const DoutPrefixProvider *dpp, if (!epoch) { int ret = use_latest_epoch(dpp, y); if (ret < 0) { - ldpp_dout(dpp, 0) << "failed to use_latest_epoch period id " << id << " realm " << realm_name << " id " << realm_id + ldpp_dout(dpp, 0) << "failed to use_latest_epoch period id " << id << " realm id " << realm_id << " : " << cpp_strerror(-ret) << dendl; return ret; } @@ -46,14 +46,12 @@ int RGWPeriod::init(const DoutPrefixProvider *dpp, } int RGWPeriod::init(const DoutPrefixProvider *dpp, CephContext *_cct, RGWSI_SysObj *_sysobj_svc, - const string& period_realm_id, optional_yield y, - const string& period_realm_name, bool setup_obj) + const string& period_realm_id, optional_yield y, bool setup_obj) { cct = _cct; sysobj_svc = _sysobj_svc; realm_id = period_realm_id; - realm_name = period_realm_name; if (!setup_obj) return 0; @@ -244,7 +242,6 @@ void RGWPeriod::dump(Formatter *f) const encode_json("master_zone", master_zone, f); encode_json("period_config", period_config, f); encode_json("realm_id", realm_id, f); - encode_json("realm_name", realm_name, f); encode_json("realm_epoch", realm_epoch, f); } @@ -259,7 +256,6 @@ void RGWPeriod::decode_json(JSONObj *obj) JSONDecoder::decode_json("master_zone", master_zone, obj); JSONDecoder::decode_json("period_config", period_config, obj); JSONDecoder::decode_json("realm_id", realm_id, obj); - JSONDecoder::decode_json("realm_name", realm_name, obj); JSONDecoder::decode_json("realm_epoch", realm_epoch, obj); } diff --git a/src/rgw/rgw_period_pusher.cc b/src/rgw/rgw_period_pusher.cc index d9c899e5c1c..0fc9efa85e7 100644 --- a/src/rgw/rgw_period_pusher.cc +++ b/src/rgw/rgw_period_pusher.cc @@ -175,7 +175,7 @@ RGWPeriodPusher::RGWPeriodPusher(const DoutPrefixProvider *dpp, rgw::sal::Driver // always send out the current period on startup RGWPeriod period; // XXX dang - int r = period.init(dpp, cct, static_cast(driver)->svc()->sysobj, realm_id, y, zone->get_realm_name()); + int r = period.init(dpp, cct, static_cast(driver)->svc()->sysobj, realm_id, y); if (r < 0) { ldpp_dout(dpp, -1) << "failed to load period for realm " << realm_id << dendl; return; diff --git a/src/rgw/rgw_realm.cc b/src/rgw/rgw_realm.cc index 8dd6d6f50b9..2d854e7244f 100644 --- a/src/rgw/rgw_realm.cc +++ b/src/rgw/rgw_realm.cc @@ -64,7 +64,7 @@ int RGWRealm::create(const DoutPrefixProvider *dpp, optional_yield y, bool exclu RGWPeriod period; if (current_period.empty()) { /* create new period for the realm */ - ret = period.init(dpp, cct, sysobj_svc, id, y, name, false); + ret = period.init(dpp, cct, sysobj_svc, id, y, false); if (ret < 0 ) { return ret; } @@ -75,7 +75,7 @@ int RGWRealm::create(const DoutPrefixProvider *dpp, optional_yield y, bool exclu } } else { period = RGWPeriod(current_period, 0); - int ret = period.init(dpp, cct, sysobj_svc, id, y, name); + int ret = period.init(dpp, cct, sysobj_svc, id, y); if (ret < 0) { ldpp_dout(dpp, 0) << "ERROR: failed to init period " << current_period << dendl; return ret; @@ -228,7 +228,7 @@ int RGWRealm::find_zone(const DoutPrefixProvider *dpp, epoch_t epoch = 0; RGWPeriod period(period_id, epoch); - int r = period.init(dpp, cct, sysobj_svc, get_id(), y, get_name()); + int r = period.init(dpp, cct, sysobj_svc, get_id(), y); if (r < 0) { ldpp_dout(dpp, 0) << "WARNING: period init failed: " << cpp_strerror(-r) << " ... skipping" << dendl; return r; diff --git a/src/rgw/services/svc_zone.cc b/src/rgw/services/svc_zone.cc index 180d9371222..c0530ae6743 100644 --- a/src/rgw/services/svc_zone.cc +++ b/src/rgw/services/svc_zone.cc @@ -146,8 +146,7 @@ int RGWSI_Zone::do_start(optional_yield y, const DoutPrefixProvider *dpp) } ldpp_dout(dpp, 20) << "realm " << realm->get_name() << " " << realm->get_id() << dendl; - ret = current_period->init(dpp, cct, sysobj_svc, realm->get_id(), y, - realm->get_name()); + ret = current_period->init(dpp, cct, sysobj_svc, realm->get_id(), y); if (ret < 0 && ret != -ENOENT) { ldpp_dout(dpp, 0) << "failed reading current period info: " << " " << cpp_strerror(-ret) << dendl; return ret; -- 2.39.5