Skip to content
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

[v24.1.x] CORE-8082 cloud_io: add missing error handling to #24079

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
18 changes: 12 additions & 6 deletions src/v/cloud_storage/remote.cc
Original file line number Diff line number Diff line change
Expand Up @@ -863,12 +863,18 @@ remote::download_object(cloud_storage::download_request download_request) {

if (resp) {
vlog(ctxlog.debug, "Receive OK response from {}", path);
auto buffer
= co_await cloud_storage_clients::util::drain_response_stream(
resp.value());
download_request.payload.append_fragments(std::move(buffer));
transfer_details.on_success(_probe);
co_return download_result::success;
try {
auto buffer
= co_await cloud_storage_clients::util::drain_response_stream(
resp.value());
download_request.payload.append_fragments(std::move(buffer));
transfer_details.on_success(_probe);
co_return download_result::success;
} catch (...) {
resp
= cloud_storage_clients::util::handle_client_transport_error(
std::current_exception(), ctxlog);
}
}

lease.client->shutdown();
Expand Down
9 changes: 8 additions & 1 deletion src/v/cloud_storage_clients/util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

#include "bytes/streambuf.h"
#include "net/connection.h"
#include "utils/retry_chain_node.h"

#include <boost/property_tree/xml_parser.hpp>

Expand All @@ -38,8 +39,9 @@ bool has_abort_or_gate_close_exception(const ss::nested_exception& ex) {
|| is_abort_or_gate_close_exception(ex.outer);
}

template<typename Logger>
error_outcome handle_client_transport_error(
std::exception_ptr current_exception, ss::logger& logger) {
std::exception_ptr current_exception, Logger& logger) {
auto outcome = error_outcome::retry;

try {
Expand Down Expand Up @@ -112,6 +114,11 @@ error_outcome handle_client_transport_error(
return outcome;
}

template error_outcome
handle_client_transport_error<ss::logger>(std::exception_ptr, ss::logger&);
template error_outcome handle_client_transport_error<retry_chain_logger>(
std::exception_ptr, retry_chain_logger&);

ss::future<iobuf>
drain_response_stream(http::client::response_stream_ref resp) {
const auto transfer_encoding = resp->get_headers().find(
Expand Down
3 changes: 2 additions & 1 deletion src/v/cloud_storage_clients/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ namespace cloud_storage_clients::util {
/// cloud provider (e.g. connection error).
/// \param current_exception is the current exception thrown by the client
/// \param logger is the logger to use
template<typename Logger>
error_outcome handle_client_transport_error(
std::exception_ptr current_exception, ss::logger& logger);
std::exception_ptr current_exception, Logger& logger);

/// \brief: Drain the reponse stream pointed to by the 'resp' handle into an
/// iobuf
Expand Down
Loading