From: Casey Bodley Date: Thu, 2 May 2024 18:46:47 +0000 (-0400) Subject: rgw/pubsub: use Driver::add/remove_persistent_topic() X-Git-Tag: v20.0.0~1893^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4c8b6768a822c8e7dd525da03f4dbc13180555a0;p=ceph.git rgw/pubsub: use Driver::add/remove_persistent_topic() Fixes: https://tracker.ceph.com/issues/65668 Signed-off-by: Casey Bodley --- diff --git a/src/rgw/driver/rados/topic.cc b/src/rgw/driver/rados/topic.cc index 7769649fbbf..9dda05a9f35 100644 --- a/src/rgw/driver/rados/topic.cc +++ b/src/rgw/driver/rados/topic.cc @@ -354,7 +354,11 @@ class MetadataHandler : public RGWMetadataHandler { } if (!info.dest.push_endpoint.empty() && info.dest.persistent && !info.dest.persistent_queue.empty()) { - r = rgw::notify::add_persistent_topic(info.dest.persistent_queue, y); + librados::IoCtx ioctx; + r = rgw_init_ioctx(dpp, &rados, zone.notif_pool, ioctx, true, false); + if (r >= 0) { + r = rgw::notify::add_persistent_topic(dpp, ioctx, info.dest.persistent_queue, y); + } if (r < 0) { ldpp_dout(dpp, 1) << "ERROR: failed to create queue for persistent topic " << info.dest.persistent_queue << " with: " << cpp_strerror(r) << dendl; @@ -388,7 +392,11 @@ class MetadataHandler : public RGWMetadataHandler { if (!dest.push_endpoint.empty() && dest.persistent && !dest.persistent_queue.empty()) { // delete persistent topic queue - r = rgw::notify::remove_persistent_topic(dest.persistent_queue, y); + librados::IoCtx ioctx; + r = rgw_init_ioctx(dpp, &rados, zone.notif_pool, ioctx, true, false); + if (r >= 0) { + r = rgw::notify::remove_persistent_topic(dpp, ioctx, dest.persistent_queue, y); + } if (r < 0 && r != -ENOENT) { ldpp_dout(dpp, 1) << "Failed to delete queue for persistent topic: " << name << " with error: " << r << dendl; diff --git a/src/rgw/rgw_pubsub.cc b/src/rgw/rgw_pubsub.cc index 160ecee1768..08118f57b36 100644 --- a/src/rgw/rgw_pubsub.cc +++ b/src/rgw/rgw_pubsub.cc @@ -1091,7 +1091,7 @@ int RGWPubSub::remove_topic_v2(const DoutPrefixProvider* dpp, const rgw_pubsub_dest& dest = topic.dest; if (!dest.push_endpoint.empty() && dest.persistent && !dest.persistent_queue.empty()) { - ret = rgw::notify::remove_persistent_topic(dest.persistent_queue, y); + ret = driver->remove_persistent_topic(dpp, y, dest.persistent_queue); if (ret < 0 && ret != -ENOENT) { ldpp_dout(dpp, 1) << "WARNING: failed to remove queue for " "persistent topic: " << cpp_strerror(ret) << dendl; @@ -1138,7 +1138,7 @@ int RGWPubSub::remove_topic(const DoutPrefixProvider *dpp, const std::string& na if (!dest.push_endpoint.empty() && dest.persistent && !dest.persistent_queue.empty()) { - ret = rgw::notify::remove_persistent_topic(dest.persistent_queue, y); + ret = driver->remove_persistent_topic(dpp, y, dest.persistent_queue); if (ret < 0 && ret != -ENOENT) { ldpp_dout(dpp, 1) << "WARNING: failed to remove queue for " "persistent topic: " << cpp_strerror(ret) << dendl; diff --git a/src/rgw/rgw_rest_pubsub.cc b/src/rgw/rgw_rest_pubsub.cc index 1913a0ac576..f3437269473 100644 --- a/src/rgw/rgw_rest_pubsub.cc +++ b/src/rgw/rgw_rest_pubsub.cc @@ -415,7 +415,7 @@ void RGWPSCreateTopicOp::execute(optional_yield y) { dest.persistent_queue = string_cat_reserve( get_account_or_tenant(s->owner.id), ":", topic_name); - op_ret = rgw::notify::add_persistent_topic(dest.persistent_queue, s->yield); + op_ret = driver->add_persistent_topic(this, y, dest.persistent_queue); if (op_ret < 0) { ldpp_dout(this, 1) << "CreateTopic Action failed to create queue for " "persistent topics. error:" @@ -874,7 +874,7 @@ void RGWPSSetTopicAttributesOp::execute(optional_yield y) { dest.persistent_queue = string_cat_reserve( get_account_or_tenant(s->owner.id), ":", topic_name); - op_ret = rgw::notify::add_persistent_topic(dest.persistent_queue, s->yield); + op_ret = driver->add_persistent_topic(this, y, dest.persistent_queue); if (op_ret < 0) { ldpp_dout(this, 4) << "SetTopicAttributes Action failed to create queue for " @@ -884,7 +884,7 @@ void RGWPSSetTopicAttributesOp::execute(optional_yield y) { } } else if (already_persistent) { // changing the persistent topic to non-persistent. - op_ret = rgw::notify::remove_persistent_topic(result.dest.persistent_queue, s->yield); + op_ret = driver->remove_persistent_topic(this, y, result.dest.persistent_queue); if (op_ret != -ENOENT && op_ret < 0) { ldpp_dout(this, 4) << "SetTopicAttributes Action failed to remove queue " "for persistent topics. error:"