|
22 | 22 | #include "iceberg/rest_client/json.h"
|
23 | 23 | #include "iceberg/table_requests_json.h"
|
24 | 24 | #include "json/istreamwrapper.h"
|
| 25 | +#include "ssx/future-util.h" |
25 | 26 |
|
26 | 27 | #include <seastar/core/sleep.hh>
|
27 | 28 | #include <seastar/coroutine/as_future.hh>
|
@@ -198,7 +199,27 @@ ss::future<expected<iobuf>> catalog_client::perform_request(
|
198 | 199 | std::vector<http_call_error> retriable_errors{};
|
199 | 200 |
|
200 | 201 | 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 | + } |
202 | 223 | if (!permit.is_allowed) {
|
203 | 224 | co_return tl::unexpected(
|
204 | 225 | retries_exhausted{.errors = std::move(retriable_errors)});
|
|
0 commit comments