Skip to content

Commit

Permalink
cloud_storage_clients: modify abs_client::delete_object()
Browse files Browse the repository at this point in the history
Previously, a `Delete Blob` request made on a directory in ABS would result
in an `error_outcome` due to the `OperationNotSupportedOnDirectory` response.
We now ignore this outcome instead of propegating an error, and issue a
debug log to `abs_log`.
  • Loading branch information
WillemKauf committed Jul 25, 2024
1 parent 457faa0 commit 01ac328
Showing 1 changed file with 35 additions and 13 deletions.
48 changes: 35 additions & 13 deletions src/v/cloud_storage_clients/abs_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,14 @@ ss::future<result<T, error_outcome>> abs_client::send_request(
vlog(abs_log.debug, "BlobNotFound response received {}", key);
outcome = error_outcome::key_not_found;
_probe->register_failure(err.code());
} else if (
err.code() == abs_error_code::operation_not_supported_on_directory) {
vlog(
abs_log.debug,
"OperationNotSupportedOnDirectory response received {}",
key);
outcome = error_outcome::operation_not_supported;
_probe->register_failure(err.code());
} else {
vlog(
abs_log.error,
Expand Down Expand Up @@ -731,20 +739,34 @@ abs_client::delete_object(
}),
key)
.then([&name, &key](const ret_t& result) {
// ABS returns a 404 for attempts to delete a blob that doesn't
// exist. The remote doesn't expect this, so we map 404s to a
// successful response.
if (!result && result.error() == error_outcome::key_not_found) {
vlog(
abs_log.debug,
"Object to be deleted was not found in cloud storage: "
"object={}, bucket={}. Ignoring ...",
name,
key);
return ss::make_ready_future<ret_t>(no_response{});
} else {
return ss::make_ready_future<ret_t>(result);
if (!result) {
if (result.error() == error_outcome::key_not_found) {
// ABS returns a 404 for attempts to delete a blob that
// doesn't exist. The remote doesn't expect this, so we
// map 404s to a successful response.
vlog(
abs_log.debug,
"Object to be deleted was not found in cloud storage: "
"object={}, bucket={}. Ignoring ...",
name,
key);
return ss::make_ready_future<ret_t>(no_response{});
} else if (
result.error() == error_outcome::operation_not_supported) {
// ABS does not allow for deletion of directories, as they
// are treated like a flat namespace. The "folder" is
// "removed" when all blobs inside of it are deleted.
// Map this to a successful response.
vlog(
abs_log.debug,
"Cannot delete a directory in ABS cloud storage: "
"object={}, bucket={}. Ignoring ...",
name,
key);
return ss::make_ready_future<ret_t>(no_response{});
}
}
return ss::make_ready_future<ret_t>(result);
});
} else {
return delete_path(name, key, timeout);
Expand Down

0 comments on commit 01ac328

Please sign in to comment.