Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions src/v/cluster/data_migration_frontend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@

#include <fmt/ostream.h>

#include <exception>

namespace cluster::data_migrations {

frontend::frontend(
Expand Down Expand Up @@ -313,8 +315,19 @@ ss::future<result<id>> frontend::do_create_migration(data_migration migration) {
co_return result<data_migrations::id>(id);
}

ss::future<chunked_vector<migration_metadata>> frontend::list_migrations() {
return _table.invoke_on_instance(&migrations_table::list_migrations);
ss::future<result<chunked_vector<migration_metadata>>>
frontend::list_migrations() {
try {
co_return co_await _table.invoke_on_instance(
&migrations_table::list_migrations);
} catch (...) {
auto eptr = std::current_exception();
if (ssx::is_shutdown_exception(eptr)) {
co_return cluster::errc::shutting_down;
}
vlog(dm_log.error, "unexpected exception on list_migrations {}", eptr);
throw;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use rethrow_exception?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Throw with no expression just rethrows the current exception

Am I missing something?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was a nitpick, I thought since eptr was already captured in a local variable, we may aswell just rethrow that.

}
}

ss::future<result<migration_metadata>>
Expand Down
2 changes: 1 addition & 1 deletion src/v/cluster/data_migration_frontend.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class frontend : public ss::peering_sharded_service<frontend> {
model::node_id node, check_ntp_states_request&& req);

ss::future<result<migration_metadata>> get_migration(id);
ss::future<chunked_vector<migration_metadata>> list_migrations();
ss::future<result<chunked_vector<migration_metadata>>> list_migrations();

using list_mountable_topics_result
= result<chunked_vector<cloud_storage::topic_mount_manifest_path>>;
Expand Down
10 changes: 8 additions & 2 deletions src/v/redpanda/admin/migrations.cc
Original file line number Diff line number Diff line change
Expand Up @@ -385,9 +385,15 @@ void admin_server::register_data_migration_routes() {
}

ss::future<std::unique_ptr<ss::http::reply>> admin_server::list_data_migrations(
std::unique_ptr<ss::http::request>, std::unique_ptr<ss::http::reply> reply) {
std::unique_ptr<ss::http::request> req,
std::unique_ptr<ss::http::reply> reply) {
auto& frontend = _controller->get_data_migration_frontend();
auto migrations = co_await frontend.local().list_migrations();
auto maybe_migrations = co_await frontend.local().list_migrations();
if (maybe_migrations.has_error()) {
co_await admin_server::throw_on_error(
*req, maybe_migrations.assume_error(), model::controller_ntp);
}
auto& migrations = maybe_migrations.assume_value();
json::StringBuffer buf;
json::Writer<json::StringBuffer> writer(buf);
writer.StartArray();
Expand Down