]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw/rgw_period : remove realm name from period config
authorJiffin Tony Thottan <thottanjiffin@gmail.com>
Tue, 31 Oct 2023 07:20:52 +0000 (12:50 +0530)
committerJiffin Tony Thottan <thottanjiffin@gmail.com>
Tue, 31 Oct 2023 08:42:30 +0000 (14:12 +0530)
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 <thottanjiffin@gmail.com>
src/rgw/driver/rados/rgw_rest_realm.cc
src/rgw/driver/rados/rgw_trim_mdlog.cc
src/rgw/driver/rados/rgw_zone.cc
src/rgw/driver/rados/rgw_zone.h
src/rgw/rgw_period.cc
src/rgw/rgw_period_pusher.cc
src/rgw/rgw_realm.cc
src/rgw/services/svc_zone.cc

index 79640a2a1081297210bce2ca105265e80da17880..91381d7729541912245663407ba1a851e5c687be 100644 (file)
@@ -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<rgw::sal::RadosStore*>(driver)->svc()->sysobj, realm_id, y, realm_name);
+  op_ret = period.init(this, driver->ctx(), static_cast<rgw::sal::RadosStore*>(driver)->svc()->sysobj, realm_id, y);
   if (op_ret < 0)
     ldpp_dout(this, 5) << "failed to read period" << dendl;
 }
index d97538f983214f11db3edfa1e12cb4fe2abfd5a2..da649366c0fd4d03c6de45828b184e9c7aff4ae7 100644 (file)
@@ -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;
       }
index 8c237f6bedac1cb2b6e260b5c54cf7a344341076..850748c8ff1fbcce266cfe7c6877417d1c7402aa 100644 (file)
@@ -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) {
index 140678fcdce5afc06b0e18fd6c375b5f727d76a4..fea7bdb218381b46dc1dacefe8872efc430cd362 100644 (file)
@@ -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;
index 1e7de60ea6fa6cf2aff37ffb8365f1d34beaadaf..67ce980395133e8d6e034a568f5824daaeb033bf 100644 (file)
@@ -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);
 }
 
index d9c899e5c1c54220f250c16ff00ddc625dfb1c84..0fc9efa85e755a5cd877544cb08ccf7cbd6a6f61 100644 (file)
@@ -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<rgw::sal::RadosStore* >(driver)->svc()->sysobj, realm_id, y, zone->get_realm_name());
+  int r = period.init(dpp, cct, static_cast<rgw::sal::RadosStore* >(driver)->svc()->sysobj, realm_id, y);
   if (r < 0) {
     ldpp_dout(dpp, -1) << "failed to load period for realm " << realm_id << dendl;
     return;
index 8dd6d6f50b997ad08b340d8a9e5ba4df3c13816b..2d854e7244f5d521d57da461d46e148c1d70ac5f 100644 (file)
@@ -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;
index 180d9371222bf490934d6daed12c7d3ab12cd2ff..c0530ae6743189083671277b15067dbcde80fc13 100644 (file)
@@ -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;