From 1fccdad21d5bcdebbdd7167b7ed18391a1e8d1e2 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Sun, 4 Feb 2024 15:17:47 -0500 Subject: [PATCH] rgw: RGWPubSub requires SiteConfig RGWPubSub constructor takes SiteConfig instead of zonegroup map replace do_all_zonegroups_support_notification_v2() with a generic function rgw::all_zonegroups_support() that handles non-realm configurations too remove unused sal::ZoneGroup::supports_feature() Signed-off-by: Casey Bodley --- src/rgw/driver/daos/rgw_sal_daos.h | 3 --- src/rgw/driver/motr/rgw_sal_motr.h | 3 --- src/rgw/driver/rados/rgw_cr_rados.cc | 2 +- src/rgw/driver/rados/rgw_notify.cc | 22 ++++++++-------- src/rgw/driver/rados/rgw_notify.h | 5 +++- src/rgw/driver/rados/rgw_rados.cc | 2 +- src/rgw/driver/rados/rgw_sal_rados.cc | 4 +-- src/rgw/driver/rados/rgw_sal_rados.h | 3 --- src/rgw/driver/rados/rgw_zone.cc | 13 ++++++++++ src/rgw/driver/rados/rgw_zone.h | 3 +++ src/rgw/rgw_admin.cc | 27 ++++++++------------ src/rgw/rgw_pubsub.cc | 17 +++---------- src/rgw/rgw_pubsub.h | 6 +---- src/rgw/rgw_rest_pubsub.cc | 36 +++++++++------------------ src/rgw/rgw_sal.h | 2 -- src/rgw/rgw_sal_dbstore.h | 3 --- src/rgw/rgw_sal_filter.h | 3 --- 17 files changed, 64 insertions(+), 90 deletions(-) diff --git a/src/rgw/driver/daos/rgw_sal_daos.h b/src/rgw/driver/daos/rgw_sal_daos.h index 479f5b84a5e..c5cfefc222d 100644 --- a/src/rgw/driver/daos/rgw_sal_daos.h +++ b/src/rgw/driver/daos/rgw_sal_daos.h @@ -430,9 +430,6 @@ class DaosZoneGroup : public StoreZoneGroup { return std::make_unique(store, group); } const RGWZoneGroup& get_group() { return group; } - virtual bool supports_feature(std::string_view feature) const override { - return group.supports(feature); - } }; class DaosZone : public StoreZone { diff --git a/src/rgw/driver/motr/rgw_sal_motr.h b/src/rgw/driver/motr/rgw_sal_motr.h index 9ff14a58307..3cc3b37fa9a 100644 --- a/src/rgw/driver/motr/rgw_sal_motr.h +++ b/src/rgw/driver/motr/rgw_sal_motr.h @@ -474,9 +474,6 @@ public: virtual std::unique_ptr clone() override { return std::make_unique(store, group); } - virtual bool supports_feature(std::string_view feature) const override { - return group.supports(feature); - } friend class MotrZone; }; diff --git a/src/rgw/driver/rados/rgw_cr_rados.cc b/src/rgw/driver/rados/rgw_cr_rados.cc index b7d362423e5..fb5722528c3 100644 --- a/src/rgw/driver/rados/rgw_cr_rados.cc +++ b/src/rgw/driver/rados/rgw_cr_rados.cc @@ -809,7 +809,7 @@ int RGWAsyncFetchRemoteObj::_send_request(const DoutPrefixProvider *dpp) req_id, null_yield); auto notify_res = static_cast(notify.get())->get_reservation(); - int ret = rgw::notify::publish_reserve(dpp, rgw::notify::ObjectSyncedCreate, notify_res, &obj_tags); + int ret = rgw::notify::publish_reserve(dpp, *store->svc()->site, rgw::notify::ObjectSyncedCreate, notify_res, &obj_tags); if (ret < 0) { ldpp_dout(dpp, 1) << "ERROR: reserving notification failed, with error: " << ret << dendl; // no need to return, the sync already happened diff --git a/src/rgw/driver/rados/rgw_notify.cc b/src/rgw/driver/rados/rgw_notify.cc index e3ee61ba9df..a1290ec9b20 100644 --- a/src/rgw/driver/rados/rgw_notify.cc +++ b/src/rgw/driver/rados/rgw_notify.cc @@ -121,6 +121,7 @@ class Manager : public DoutPrefixProvider { const uint32_t stale_reservations_period_s; const uint32_t reservations_cleanup_period_s; queues_persistency_tracker topics_persistency_tracker; + const SiteConfig& site; public: rgw::sal::RadosStore& rados_store; @@ -491,7 +492,7 @@ private: std::string tenant_name; // TODO: extract tenant name from queue_name once it is fixed uint64_t size_to_migrate = 0; - RGWPubSub ps(&rados_store, tenant_name); + RGWPubSub ps(&rados_store, tenant_name, site); rgw_pubsub_topic topic; auto ret_of_get_topic = ps.get_topic(this, queue_name, topic, @@ -669,7 +670,8 @@ public: Manager(CephContext* _cct, uint32_t _max_queue_size, uint32_t _queues_update_period_ms, uint32_t _queues_update_retry_ms, uint32_t _queue_idle_sleep_us, u_int32_t failover_time_ms, uint32_t _stale_reservations_period_s, uint32_t _reservations_cleanup_period_s, - uint32_t _worker_count, rgw::sal::RadosStore* store) : + uint32_t _worker_count, rgw::sal::RadosStore* store, + const SiteConfig& site) : max_queue_size(_max_queue_size), queues_update_period_ms(_queues_update_period_ms), queues_update_retry_ms(_queues_update_retry_ms), @@ -681,6 +683,7 @@ public: worker_count(_worker_count), stale_reservations_period_s(_stale_reservations_period_s), reservations_cleanup_period_s(_reservations_cleanup_period_s), + site(site), rados_store(*store) { spawn::spawn(io_context, [this](spawn::yield_context yield) { @@ -753,7 +756,8 @@ constexpr uint32_t WORKER_COUNT = 1; // 1 worker thread constexpr uint32_t STALE_RESERVATIONS_PERIOD_S = 120; // cleanup reservations that are more than 2 minutes old constexpr uint32_t RESERVATIONS_CLEANUP_PERIOD_S = 30; // reservation cleanup every 30 seconds -bool init(CephContext* cct, rgw::sal::RadosStore* store, const DoutPrefixProvider *dpp) { +bool init(CephContext* cct, rgw::sal::RadosStore* store, + const SiteConfig& site, const DoutPrefixProvider *dpp) { if (s_manager) { return false; } @@ -763,7 +767,7 @@ bool init(CephContext* cct, rgw::sal::RadosStore* store, const DoutPrefixProvide IDLE_TIMEOUT_USEC, FAILOVER_TIME_MSEC, STALE_RESERVATIONS_PERIOD_S, RESERVATIONS_CLEANUP_PERIOD_S, WORKER_COUNT, - store); + store, site); return true; } @@ -978,13 +982,13 @@ static inline bool notification_match(reservation_t& res, } int publish_reserve(const DoutPrefixProvider* dpp, + const SiteConfig& site, EventType event_type, reservation_t& res, const RGWObjTags* req_tags) { rgw_pubsub_bucket_topics bucket_topics; - if (do_all_zonegroups_support_notification_v2( - res.store->svc()->zone->get_current_period().get_map().zonegroups)) { + if (all_zonegroups_support(site, zone_features::notification_v2)) { auto ret = 0; if (!res.s) { // for non S3-request caller (e.g., lifecycle, ObjectSync), bucket attrs @@ -1004,7 +1008,7 @@ static inline bool notification_match(reservation_t& res, return ret; } } else { - const RGWPubSub ps(res.store, res.user_tenant); + const RGWPubSub ps(res.store, res.user_tenant, site); const RGWPubSub::Bucket ps_bucket(ps, res.bucket); auto rc = ps_bucket.get_topics(res.dpp, bucket_topics, res.yield); if (rc < 0) { @@ -1054,9 +1058,7 @@ static inline bool notification_match(reservation_t& res, // load the topic,if there is change in topic config while it's stored in // notification. rgw_pubsub_topic result; - const RGWPubSub ps( - res.store, res.user_tenant, - &res.store->svc()->zone->get_current_period().get_map().zonegroups); + const RGWPubSub ps(res.store, res.user_tenant, site); auto ret = ps.get_topic(res.dpp, topic_cfg.name, result, res.yield, nullptr); if (ret < 0) { ldpp_dout(res.dpp, 1) diff --git a/src/rgw/driver/rados/rgw_notify.h b/src/rgw/driver/rados/rgw_notify.h index 5117f9eecd8..4f2f57341ec 100644 --- a/src/rgw/driver/rados/rgw_notify.h +++ b/src/rgw/driver/rados/rgw_notify.h @@ -12,6 +12,7 @@ #include "rgw_pubsub.h" // forward declarations +namespace rgw { class SiteConfig; } namespace rgw::sal { class RadosStore; class RGWObject; @@ -25,7 +26,8 @@ namespace rgw::notify { // initialize the notification manager // notification manager is dequeuing the 2-phase-commit queues // and send the notifications to the endpoints -bool init(CephContext* cct, rgw::sal::RadosStore* store, const DoutPrefixProvider *dpp); +bool init(CephContext* cct, rgw::sal::RadosStore* store, + const rgw::SiteConfig& site, const DoutPrefixProvider *dpp); // shutdown the notification manager void shutdown(); @@ -110,6 +112,7 @@ struct rgw_topic_stats { // create a reservation on the 2-phase-commit queue int publish_reserve(const DoutPrefixProvider *dpp, + const SiteConfig& site, EventType event_type, reservation_t& reservation, const RGWObjTags* req_tags); diff --git a/src/rgw/driver/rados/rgw_rados.cc b/src/rgw/driver/rados/rgw_rados.cc index 18ff24f2181..6084c21ef8e 100644 --- a/src/rgw/driver/rados/rgw_rados.cc +++ b/src/rgw/driver/rados/rgw_rados.cc @@ -1357,7 +1357,7 @@ int RGWRados::init_complete(const DoutPrefixProvider *dpp, optional_yield y) index_completion_manager = new RGWIndexCompletionManager(this); if (run_notification_thread) { - ret = rgw::notify::init(cct, driver, dpp); + ret = rgw::notify::init(cct, driver, *svc.site, dpp); if (ret < 0 ) { ldpp_dout(dpp, 1) << "ERROR: failed to initialize notification manager" << dendl; } diff --git a/src/rgw/driver/rados/rgw_sal_rados.cc b/src/rgw/driver/rados/rgw_sal_rados.cc index 6e4d346120e..6aba08828b7 100644 --- a/src/rgw/driver/rados/rgw_sal_rados.cc +++ b/src/rgw/driver/rados/rgw_sal_rados.cc @@ -367,7 +367,7 @@ int RadosBucket::remove(const DoutPrefixProvider* dpp, // if bucket has notification definitions associated with it // they should be removed (note that any pending notifications on the bucket are still going to be sent) - const RGWPubSub ps(store, info.owner.tenant); + const RGWPubSub ps(store, info.owner.tenant, *store->svc()->site); const RGWPubSub::Bucket ps_bucket(ps, this); const auto ps_ret = ps_bucket.remove_notifications(dpp, y); if (ps_ret < 0 && ps_ret != -ENOENT) { @@ -3061,7 +3061,7 @@ std::unique_ptr RadosLifecycle::get_serializer(const std::string& int RadosNotification::publish_reserve(const DoutPrefixProvider *dpp, RGWObjTags* obj_tags) { - return rgw::notify::publish_reserve(dpp, event_type, res, obj_tags); + return rgw::notify::publish_reserve(dpp, *store->svc()->site, event_type, res, obj_tags); } int RadosNotification::publish_commit(const DoutPrefixProvider* dpp, uint64_t size, diff --git a/src/rgw/driver/rados/rgw_sal_rados.h b/src/rgw/driver/rados/rgw_sal_rados.h index e85b3fde1d4..e15c754d1b4 100644 --- a/src/rgw/driver/rados/rgw_sal_rados.h +++ b/src/rgw/driver/rados/rgw_sal_rados.h @@ -85,9 +85,6 @@ public: virtual std::unique_ptr clone() override { return std::make_unique(store, group); } - virtual bool supports_feature(std::string_view feature) const override { - return group.supports(feature); - } const RGWZoneGroup& get_group() const { return group; } }; diff --git a/src/rgw/driver/rados/rgw_zone.cc b/src/rgw/driver/rados/rgw_zone.cc index b93f319ac17..2c504712381 100644 --- a/src/rgw/driver/rados/rgw_zone.cc +++ b/src/rgw/driver/rados/rgw_zone.cc @@ -1117,6 +1117,19 @@ auto find_zone_placement(const DoutPrefixProvider* dpp, return &i->second; } +bool all_zonegroups_support(const SiteConfig& site, std::string_view feature) +{ + const auto& period = site.get_period(); + if (!period) { + // if we're not in a realm, just check the local zonegroup + return site.get_zonegroup().supports(feature); + } + const auto& zgs = period->period_map.zonegroups; + return std::all_of(zgs.begin(), zgs.end(), [feature] (const auto& pair) { + return pair.second.supports(feature); + }); +} + static int read_or_create_default_zone(const DoutPrefixProvider* dpp, optional_yield y, sal::ConfigStore* cfgstore, diff --git a/src/rgw/driver/rados/rgw_zone.h b/src/rgw/driver/rados/rgw_zone.h index 2eb3e725253..345cbc6a217 100644 --- a/src/rgw/driver/rados/rgw_zone.h +++ b/src/rgw/driver/rados/rgw_zone.h @@ -1009,4 +1009,7 @@ class SiteConfig { }; +/// Test whether all zonegroups in the realm support the given zone feature. +bool all_zonegroups_support(const SiteConfig& site, std::string_view feature); + } // namespace rgw diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index be91c66e9ff..395e05ce517 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -10628,8 +10628,7 @@ next: cerr << "ERROR: could not init bucket: " << cpp_strerror(-ret) << std::endl; return -ret; } - if (driver->get_zone()->get_zonegroup().supports_feature( - rgw::zone_features::notification_v2)) { + if (rgw::all_zonegroups_support(*site, rgw::zone_features::notification_v2)) { ret = get_bucket_notifications(dpp(), bucket.get(), result); if (ret < 0) { cerr << "ERROR: could not get topics: " << cpp_strerror(-ret) @@ -10637,7 +10636,7 @@ next: return -ret; } } else { - RGWPubSub ps(driver, tenant); + RGWPubSub ps(driver, tenant, *site); const RGWPubSub::Bucket b(ps, bucket.get()); ret = b.get_topics(dpp(), result, null_yield); if (ret < 0 && ret != -ENOENT) { @@ -10650,7 +10649,7 @@ next: } if (opt_cmd == OPT::PUBSUB_TOPIC_LIST) { - RGWPubSub ps(driver, tenant, &site->get_period()->get_map().zonegroups); + RGWPubSub ps(driver, tenant, *site); rgw_pubsub_topics result; ret = ps.get_topics(dpp(), result, null_yield); if (ret < 0 && ret != -ENOENT) { @@ -10667,8 +10666,7 @@ next: } } } - if (driver->get_zone()->get_zonegroup().supports_feature( - rgw::zone_features::notification_v2)) { + if (rgw::all_zonegroups_support(*site, rgw::zone_features::notification_v2)) { Formatter::ObjectSection top_section(*formatter, "result"); Formatter::ArraySection s(*formatter, "topics"); for (const auto& [_, topic] : result.topics) { @@ -10693,7 +10691,7 @@ next: cerr << "ERROR: topic name was not provided (via --topic)" << std::endl; return EINVAL; } - RGWPubSub ps(driver, tenant, &site->get_period()->get_map().zonegroups); + RGWPubSub ps(driver, tenant, *site); rgw_pubsub_topic topic; std::set subscribed_buckets; @@ -10703,8 +10701,7 @@ next: cerr << "ERROR: could not get topic: " << cpp_strerror(-ret) << std::endl; return -ret; } - if (driver->get_zone()->get_zonegroup().supports_feature( - rgw::zone_features::notification_v2)) { + if (rgw::all_zonegroups_support(*site, rgw::zone_features::notification_v2)) { show_topics_info_v2(topic, subscribed_buckets, formatter.get()); } else { encode_json("topic", topic, formatter.get()); @@ -10728,8 +10725,7 @@ next: return -ret; } rgw_pubsub_bucket_topics bucket_topics; - if (driver->get_zone()->get_zonegroup().supports_feature( - rgw::zone_features::notification_v2)) { + if (rgw::all_zonegroups_support(*site, rgw::zone_features::notification_v2)) { ret = get_bucket_notifications(dpp(), bucket.get(), bucket_topics); if (ret < 0) { cerr << "ERROR: could not get bucket notifications: " @@ -10737,7 +10733,7 @@ next: return -ret; } } else { - RGWPubSub ps(driver, tenant); + RGWPubSub ps(driver, tenant, *site); const RGWPubSub::Bucket b(ps, bucket.get()); ret = b.get_topics(dpp(), bucket_topics, null_yield); if (ret < 0 && ret != -ENOENT) { @@ -10770,7 +10766,7 @@ next: return -ret; } - RGWPubSub ps(driver, tenant, &site->get_period()->get_map().zonegroups); + RGWPubSub ps(driver, tenant, *site); ret = ps.remove_topic(dpp(), topic_name, null_yield); if (ret < 0) { @@ -10794,12 +10790,11 @@ next: return -ret; } - if (driver->get_zone()->get_zonegroup().supports_feature( - rgw::zone_features::notification_v2)) { + if (rgw::all_zonegroups_support(*site, rgw::zone_features::notification_v2)) { ret = remove_notification_v2(dpp(), driver, bucket.get(), notification_id, null_yield); } else { - RGWPubSub ps(driver, tenant); + RGWPubSub ps(driver, tenant, *site); rgw_pubsub_bucket_topics bucket_topics; const RGWPubSub::Bucket b(ps, bucket.get()); diff --git a/src/rgw/rgw_pubsub.cc b/src/rgw/rgw_pubsub.cc index dec38ee87e8..f4ddb118cd3 100644 --- a/src/rgw/rgw_pubsub.cc +++ b/src/rgw/rgw_pubsub.cc @@ -504,9 +504,10 @@ RGWPubSub::RGWPubSub(rgw::sal::Driver* _driver, const std::string& _tenant) RGWPubSub::RGWPubSub(rgw::sal::Driver* _driver, const std::string& _tenant, - const std::map* _zonegroups) - : driver(_driver), tenant(_tenant), zonegroups(_zonegroups) { - use_notification_v2 = do_all_zonegroups_support_notification_v2(*zonegroups); + const rgw::SiteConfig& site) + : driver(_driver), tenant(_tenant), + use_notification_v2(rgw::all_zonegroups_support(site, rgw::zone_features::notification_v2)) +{ } int RGWPubSub::read_topics(const DoutPrefixProvider *dpp, rgw_pubsub_topics& result, @@ -651,16 +652,6 @@ int get_bucket_notifications(const DoutPrefixProvider* dpp, return 0; } -bool do_all_zonegroups_support_notification_v2( - std::map zonegroups) { - for (const auto& [_, zonegroup] : zonegroups) { - if (!zonegroup.supports(rgw::zone_features::notification_v2)) { - return false; - } - } - return true; -} - std::string topic_to_unique(const std::string& topic, const std::string& notification) { return notification + "_" + topic; diff --git a/src/rgw/rgw_pubsub.h b/src/rgw/rgw_pubsub.h index 8509d86e225..ed785672175 100644 --- a/src/rgw/rgw_pubsub.h +++ b/src/rgw/rgw_pubsub.h @@ -560,7 +560,6 @@ class RGWPubSub rgw::sal::Driver* const driver; const std::string tenant; - const std::map* zonegroups = nullptr; bool use_notification_v2 = false; int read_topics(const DoutPrefixProvider *dpp, rgw_pubsub_topics& result, @@ -573,7 +572,7 @@ public: RGWPubSub(rgw::sal::Driver* _driver, const std::string& _tenant, - const std::map* zonegroups); + const rgw::SiteConfig& site); class Bucket { friend class RGWPubSub; @@ -670,9 +669,6 @@ namespace rgw::notify { constexpr static const std::string_view DEFAULT_CONFIG{"None"}; } -bool do_all_zonegroups_support_notification_v2( - std::map zonegroups); - std::string topic_to_unique(const std::string& topic, const std::string& notification); diff --git a/src/rgw/rgw_rest_pubsub.cc b/src/rgw/rgw_rest_pubsub.cc index 38943736e45..c64b5785337 100644 --- a/src/rgw/rgw_rest_pubsub.cc +++ b/src/rgw/rgw_rest_pubsub.cc @@ -197,8 +197,7 @@ class RGWPSCreateTopicOp : public RGWOp { return ret; } - const RGWPubSub ps(driver, s->owner.id.tenant, - &s->penv.site->get_period()->get_map().zonegroups); + const RGWPubSub ps(driver, s->owner.id.tenant, *s->penv.site); rgw_pubsub_topic result; ret = ps.get_topic(this, topic_name, result, y, nullptr); if (ret == -ENOENT) { @@ -278,8 +277,7 @@ void RGWPSCreateTopicOp::execute(optional_yield y) { return; } } - const RGWPubSub ps(driver, s->owner.id.tenant, - &s->penv.site->get_period()->get_map().zonegroups); + const RGWPubSub ps(driver, s->owner.id.tenant, *s->penv.site); op_ret = ps.create_topic(this, topic_name, dest, topic_arn, opaque_data, s->owner.id, policy_text, y); if (op_ret < 0) { @@ -334,8 +332,7 @@ public: }; void RGWPSListTopicsOp::execute(optional_yield y) { - const RGWPubSub ps(driver, s->owner.id.tenant, - &s->penv.site->get_period()->get_map().zonegroups); + const RGWPubSub ps(driver, s->owner.id.tenant, *s->penv.site); op_ret = ps.get_topics(this, result, y); // if there are no topics it is not considered an error op_ret = op_ret == -ENOENT ? 0 : op_ret; @@ -422,8 +419,7 @@ void RGWPSGetTopicOp::execute(optional_yield y) { if (op_ret < 0) { return; } - const RGWPubSub ps(driver, s->owner.id.tenant, - &s->penv.site->get_period()->get_map().zonegroups); + const RGWPubSub ps(driver, s->owner.id.tenant, *s->penv.site); op_ret = ps.get_topic(this, topic_name, result, y, nullptr); if (op_ret < 0) { ldpp_dout(this, 1) << "failed to get topic '" << topic_name << "', ret=" << op_ret << dendl; @@ -507,8 +503,7 @@ void RGWPSGetTopicAttributesOp::execute(optional_yield y) { if (op_ret < 0) { return; } - const RGWPubSub ps(driver, s->owner.id.tenant, - &s->penv.site->get_period()->get_map().zonegroups); + const RGWPubSub ps(driver, s->owner.id.tenant, *s->penv.site); op_ret = ps.get_topic(this, topic_name, result, y, nullptr); if (op_ret < 0) { ldpp_dout(this, 1) << "failed to get topic '" << topic_name << "', ret=" << op_ret << dendl; @@ -636,8 +631,7 @@ class RGWPSSetTopicAttributesOp : public RGWOp { return ret; } rgw_pubsub_topic result; - const RGWPubSub ps(driver, s->owner.id.tenant, - &s->penv.site->get_period()->get_map().zonegroups); + const RGWPubSub ps(driver, s->owner.id.tenant, *s->penv.site); ret = ps.get_topic(this, topic_name, result, y, nullptr); if (ret < 0) { ldpp_dout(this, 1) << "failed to get topic '" << topic_name @@ -715,8 +709,7 @@ void RGWPSSetTopicAttributesOp::execute(optional_yield y) { return; } } - const RGWPubSub ps(driver, s->owner.id.tenant, - &s->penv.site->get_period()->get_map().zonegroups); + const RGWPubSub ps(driver, s->owner.id.tenant, *s->penv.site); op_ret = ps.create_topic(this, topic_name, dest, topic_arn, opaque_data, topic_owner, policy_text, y); if (op_ret < 0) { @@ -797,8 +790,7 @@ void RGWPSDeleteTopicOp::execute(optional_yield y) { return; } } - const RGWPubSub ps(driver, s->owner.id.tenant, - &s->penv.site->get_period()->get_map().zonegroups); + const RGWPubSub ps(driver, s->owner.id.tenant, *s->penv.site); rgw_pubsub_topic result; op_ret = ps.get_topic(this, topic_name, result, y, nullptr); @@ -991,8 +983,7 @@ public: }; void RGWPSCreateNotifOp::execute(optional_yield y) { - if (do_all_zonegroups_support_notification_v2( - s->penv.site->get_period()->get_map().zonegroups)) { + if (rgw::all_zonegroups_support(*s->penv.site, rgw::zone_features::notification_v2)) { return execute_v2(y); } op_ret = verify_params(); @@ -1174,8 +1165,7 @@ void RGWPSCreateNotifOp::execute_v2(optional_yield y) { << "' , ret = " << op_ret << dendl; return; } - const RGWPubSub ps(driver, s->owner.id.tenant, - &s->penv.site->get_period()->get_map().zonegroups); + const RGWPubSub ps(driver, s->owner.id.tenant, *s->penv.site); std::unordered_map topics; for (const auto& c : configurations.list) { const auto& notif_name = c.id; @@ -1295,8 +1285,7 @@ class RGWPSDeleteNotifOp : public RGWDefaultResponseOp { }; void RGWPSDeleteNotifOp::execute(optional_yield y) { - if (do_all_zonegroups_support_notification_v2( - s->penv.site->get_period()->get_map().zonegroups)) { + if (rgw::all_zonegroups_support(*s->penv.site, rgw::zone_features::notification_v2)) { return execute_v2(y); } std::string notif_name; @@ -1457,8 +1446,7 @@ void RGWPSListNotifsOp::execute(optional_yield y) { // get all topics on a bucket rgw_pubsub_bucket_topics bucket_topics; - if (do_all_zonegroups_support_notification_v2( - s->penv.site->get_period()->get_map().zonegroups)) { + if (rgw::all_zonegroups_support(*s->penv.site, rgw::zone_features::notification_v2)) { op_ret = get_bucket_notifications(this, bucket.get(), bucket_topics); } else { const RGWPubSub ps(driver, s->owner.id.tenant); diff --git a/src/rgw/rgw_sal.h b/src/rgw/rgw_sal.h index 4dc3c9dc836..f1bc455835f 100644 --- a/src/rgw/rgw_sal.h +++ b/src/rgw/rgw_sal.h @@ -1495,8 +1495,6 @@ public: virtual int list_zones(std::list& zone_ids) = 0; /** Clone a copy of this zonegroup. */ virtual std::unique_ptr clone() = 0; - /** Determine if zonegroup |feature| is supported.*/ - virtual bool supports_feature(std::string_view feature) const = 0; }; /** diff --git a/src/rgw/rgw_sal_dbstore.h b/src/rgw/rgw_sal_dbstore.h index 140b2839662..3c0c7c76519 100644 --- a/src/rgw/rgw_sal_dbstore.h +++ b/src/rgw/rgw_sal_dbstore.h @@ -259,9 +259,6 @@ protected: std::unique_ptrzg = std::make_unique(*group.get()); return std::make_unique(store, std::move(zg)); } - virtual bool supports_feature(std::string_view feature) const override { - return group->supports(feature); - } }; class DBZone : public StoreZone { diff --git a/src/rgw/rgw_sal_filter.h b/src/rgw/rgw_sal_filter.h index d5bf9afe248..8bb704ce17c 100644 --- a/src/rgw/rgw_sal_filter.h +++ b/src/rgw/rgw_sal_filter.h @@ -75,9 +75,6 @@ public: std::unique_ptr nzg = next->clone(); return std::make_unique(std::move(nzg)); } - virtual bool supports_feature(std::string_view feature) const override { - return next->supports_feature(feature); - } }; class FilterZone : public Zone { -- 2.39.5