Skip to content

Commit 8af1891

Browse files
authored
Merge pull request redpanda-data#25273 from andrwng/rest-retry-abort
iceberg/rest_client: catch exception in retry() attempt
2 parents 1268c96 + ba2415e commit 8af1891

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

src/v/iceberg/rest_client/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ redpanda_cc_library(
129129
"//src/v/iceberg:table_requests",
130130
"//src/v/iceberg:table_requests_json",
131131
"//src/v/json",
132+
"//src/v/ssx:future_util",
132133
"//src/v/utils:named_type",
133134
"//src/v/utils:retry_chain_node",
134135
"@abseil-cpp//absl/strings",

src/v/iceberg/rest_client/catalog_client.cc

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "iceberg/rest_client/json.h"
2323
#include "iceberg/table_requests_json.h"
2424
#include "json/istreamwrapper.h"
25+
#include "ssx/future-util.h"
2526

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

200201
while (true) {
201-
const auto permit = rtc.retry();
202+
retry_permit permit{};
203+
try {
204+
permit = rtc.retry();
205+
} catch (...) {
206+
auto ex = std::current_exception();
207+
auto msg = fmt::format("{}", ex);
208+
bool is_shutdown = ssx::is_shutdown_exception(ex);
209+
vlogl(
210+
log,
211+
is_shutdown ? ss::log_level::debug : ss::log_level::error,
212+
"Exception during catalog request: {}",
213+
msg);
214+
if (is_shutdown) {
215+
co_return tl::unexpected(aborted_error{msg});
216+
}
217+
// NOTE: we only expect shutdown errors. If that's not the case,
218+
// conservatively return a non-aborted error so callers don't think
219+
// we're shutting down when we're not.
220+
co_return tl::unexpected(
221+
retries_exhausted{.errors = std::move(retriable_errors)});
222+
}
202223
if (!permit.is_allowed) {
203224
co_return tl::unexpected(
204225
retries_exhausted{.errors = std::move(retriable_errors)});

0 commit comments

Comments
 (0)