Skip to content

Commit

Permalink
cloud_storage: add error_outcome::operation_not_supported
Browse files Browse the repository at this point in the history
Adds a value to the `cloud_storage::error_outcome` enum for handling cases
where the response to a request made had some flavor of `OperationNotSupported`
code.

This will be used immediately to handle a case for the `abs_client` where
`Delete Blob` requests made on directories results in a
`OperationNotSupportedOnDirectory` response.
  • Loading branch information
WillemKauf committed Jul 25, 2024
1 parent 1c235a4 commit 457faa0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/v/cloud_storage/remote.cc
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,8 @@ ss::future<download_result> remote::do_download_manifest(
retry_permit.delay, fib.root_abort_source());
retry_permit = fib.retry();
break;
case cloud_storage_clients::error_outcome::operation_not_supported:
[[fallthrough]];
case cloud_storage_clients::error_outcome::fail:
result = download_result::failed;
vlog(
Expand Down Expand Up @@ -401,6 +403,8 @@ ss::future<upload_result> remote::upload_manifest(
co_await ss::sleep_abortable(permit.delay, fib.root_abort_source());
permit = fib.retry();
break;
case cloud_storage_clients::error_outcome::operation_not_supported:
[[fallthrough]];
case cloud_storage_clients::error_outcome::key_not_found:
// not expected during upload
[[fallthrough]];
Expand Down Expand Up @@ -575,6 +579,8 @@ ss::future<upload_result> remote::upload_stream(
}
permit = fib.retry();
break;
case cloud_storage_clients::error_outcome::operation_not_supported:
[[fallthrough]];
case cloud_storage_clients::error_outcome::key_not_found:
// not expected during upload
[[fallthrough]];
Expand Down Expand Up @@ -757,6 +763,8 @@ ss::future<download_result> remote::download_stream(
co_await ss::sleep_abortable(permit.delay, fib.root_abort_source());
permit = fib.retry();
break;
case cloud_storage_clients::error_outcome::operation_not_supported:
[[fallthrough]];
case cloud_storage_clients::error_outcome::fail:
result = download_result::failed;
break;
Expand Down Expand Up @@ -860,6 +868,8 @@ remote::download_object(cloud_storage::download_request download_request) {
co_await ss::sleep_abortable(permit.delay, fib.root_abort_source());
permit = fib.retry();
break;
case cloud_storage_clients::error_outcome::operation_not_supported:
[[fallthrough]];
case cloud_storage_clients::error_outcome::fail:
result = download_result::failed;
break;
Expand Down Expand Up @@ -931,6 +941,8 @@ ss::future<download_result> remote::object_exists(
co_await ss::sleep_abortable(permit.delay, fib.root_abort_source());
permit = fib.retry();
break;
case cloud_storage_clients::error_outcome::operation_not_supported:
[[fallthrough]];
case cloud_storage_clients::error_outcome::fail:
result = download_result::failed;
break;
Expand Down Expand Up @@ -1013,6 +1025,8 @@ ss::future<upload_result> remote::delete_object(
co_await ss::sleep_abortable(permit.delay, fib.root_abort_source());
permit = fib.retry();
break;
case cloud_storage_clients::error_outcome::operation_not_supported:
[[fallthrough]];
case cloud_storage_clients::error_outcome::fail:
result = upload_result::failed;
break;
Expand Down Expand Up @@ -1172,6 +1186,8 @@ ss::future<upload_result> remote::delete_object_batch(
co_await ss::sleep_abortable(permit.delay, _as);
permit = fib.retry();
break;
case cloud_storage_clients::error_outcome::operation_not_supported:
[[fallthrough]];
case cloud_storage_clients::error_outcome::fail:
result = upload_result::failed;
break;
Expand Down Expand Up @@ -1384,6 +1400,8 @@ ss::future<remote::list_result> remote::list_objects(
co_await ss::sleep_abortable(permit.delay, _as);
permit = fib.retry();
break;
case cloud_storage_clients::error_outcome::operation_not_supported:
[[fallthrough]];
case cloud_storage_clients::error_outcome::fail:
result = cloud_storage_clients::error_outcome::fail;
break;
Expand Down Expand Up @@ -1466,6 +1484,8 @@ ss::future<upload_result> remote::upload_object(upload_request upload_request) {
co_await ss::sleep_abortable(permit.delay, _as);
permit = fib.retry();
break;
case cloud_storage_clients::error_outcome::operation_not_supported:
[[fallthrough]];
case cloud_storage_clients::error_outcome::key_not_found:
[[fallthrough]];
case cloud_storage_clients::error_outcome::fail:
Expand Down
5 changes: 5 additions & 0 deletions src/v/cloud_storage_clients/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ enum class error_outcome {
fail,
/// Missing key API error (only suitable for downloads and deletions)
key_not_found,
/// Currently used for directory deletion errors in ABS, typically treated
/// as regular failure outcomes.
operation_not_supported
};

struct error_outcome_category final : public std::error_category {
Expand All @@ -49,6 +52,8 @@ struct error_outcome_category final : public std::error_category {
return "Non retriable error";
case error_outcome::key_not_found:
return "Key not found error";
case error_outcome::operation_not_supported:
return "Operation not supported error";
default:
return "Undefined error_outcome encountered";
}
Expand Down

0 comments on commit 457faa0

Please sign in to comment.