Skip to content

iceberg/rest_client: catch exception in retry() attempt #25273

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 7, 2025
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
1 change: 1 addition & 0 deletions src/v/iceberg/rest_client/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ redpanda_cc_library(
"//src/v/iceberg:table_requests",
"//src/v/iceberg:table_requests_json",
"//src/v/json",
"//src/v/ssx:future_util",
"//src/v/utils:named_type",
"//src/v/utils:retry_chain_node",
"@abseil-cpp//absl/strings",
Expand Down
23 changes: 22 additions & 1 deletion src/v/iceberg/rest_client/catalog_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "iceberg/rest_client/json.h"
#include "iceberg/table_requests_json.h"
#include "json/istreamwrapper.h"
#include "ssx/future-util.h"

#include <seastar/core/sleep.hh>
#include <seastar/coroutine/as_future.hh>
Expand Down Expand Up @@ -198,7 +199,27 @@ ss::future<expected<iobuf>> catalog_client::perform_request(
std::vector<http_call_error> retriable_errors{};

while (true) {
const auto permit = rtc.retry();
retry_permit permit{};
try {
permit = rtc.retry();
} catch (...) {
auto ex = std::current_exception();
auto msg = fmt::format("{}", ex);
bool is_shutdown = ssx::is_shutdown_exception(ex);
vlogl(
log,
is_shutdown ? ss::log_level::debug : ss::log_level::error,
"Exception during catalog request: {}",
msg);
if (is_shutdown) {
co_return tl::unexpected(aborted_error{msg});
}
// NOTE: we only expect shutdown errors. If that's not the case,
// conservatively return a non-aborted error so callers don't think
// we're shutting down when we're not.
co_return tl::unexpected(
retries_exhausted{.errors = std::move(retriable_errors)});
}
if (!permit.is_allowed) {
co_return tl::unexpected(
retries_exhausted{.errors = std::move(retriable_errors)});
Expand Down