cerr << "ERROR: could not remove topic: " << cpp_strerror(-ret) << std::endl;
return -ret;
}
-
- ret = rgw::notify::remove_persistent_topic(
- dpp(), static_cast<rgw::sal::RadosStore*>(driver)->getRados()->get_notif_pool_ctx(), topic_name, null_yield);
- if (ret < 0 && ret != -ENOENT) {
- cerr << "ERROR: could not remove persistent topic: " << cpp_strerror(-ret) << std::endl;
- return -ret;
- }
}
if (opt_cmd == OPT::PUBSUB_NOTIFICATION_RM) {
#include "rgw_arn.h"
#include "rgw_pubsub_push.h"
#include "rgw_bucket.h"
+#include "driver/rados/rgw_notify.h"
#include "common/errno.h"
#include "include/function2.hpp"
#include <regex>
<< dendl;
return ret;
}
- return ret;
+
+ const rgw_pubsub_dest& dest = topic.dest;
+ if (!dest.push_endpoint.empty() && dest.persistent &&
+ !dest.persistent_queue.empty()) {
+ ret = rgw::notify::remove_persistent_topic(topic.name, y);
+ if (ret < 0 && ret != -ENOENT) {
+ ldpp_dout(dpp, 1) << "WARNING: failed to remove queue for "
+ "persistent topic: " << cpp_strerror(ret) << dendl;
+ } // not fatal
+ }
+ return 0;
}
int RGWPubSub::remove_topic(const DoutPrefixProvider *dpp, const std::string& name, optional_yield y) const
return 0;
}
- topics.topics.erase(name);
+ auto t = topics.topics.find(name);
+ if (t == topics.topics.end()) {
+ return -ENOENT;
+ }
+ const rgw_pubsub_dest dest = std::move(t->second.dest);
+ topics.topics.erase(t);
ret = write_topics_v1(dpp, topics, &objv_tracker, y);
if (ret < 0) {
return ret;
}
+ if (!dest.push_endpoint.empty() && dest.persistent &&
+ !dest.persistent_queue.empty()) {
+ ret = rgw::notify::remove_persistent_topic(name, y);
+ if (ret < 0 && ret != -ENOENT) {
+ ldpp_dout(dpp, 1) << "WARNING: failed to remove queue for "
+ "persistent topic: " << cpp_strerror(ret) << dendl;
+ } // not fatal
+ }
return 0;
}
// its not an error if no topics exist, just a no-op
op_ret = 0;
}
- // upon deletion it is not known if topic is persistent or not
- // will try to delete the persistent topic anyway
- // doing this regardless of the topic being previously deleted
- // to allow for cleanup if only the queue deletion failed
- if (const auto ret = rgw::notify::remove_persistent_topic(topic_name, s->yield); ret < 0 && ret != -ENOENT) {
- ldpp_dout(this, 1) << "DeleteTopic Action failed to remove queue for "
- "persistent topics. error:"
- << ret << dendl;
- }
}
using op_generator = RGWOp*(*)(bufferlist);