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

fix(storage): better error code for CreateBucket() and 409 errors #10480

Conversation

coryan
Copy link
Contributor

@coryan coryan commented Dec 30, 2022

It seems that 409 should be treated as a kAlreadyExists in this case, and this case only.

Fixes #10478


This change is Reviewable

@product-auto-label product-auto-label bot added the api: storage Issues related to the Cloud Storage API. label Dec 30, 2022
@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: fd47862e0ce25124e7d181a397396713a4bf8111

ℹ️ NOTE: Kokoro logs are linked from "Details" below.

@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: 6888190231992d27b184dba4d4ec46a1b9b3ae61

ℹ️ NOTE: Kokoro logs are linked from "Details" below.

@codecov
Copy link

codecov bot commented Dec 31, 2022

Codecov Report

Base: 93.94% // Head: 93.94% // Increases project coverage by +0.00% 🎉

Coverage data is based on head (a204b51) compared to base (afc873a).
Patch coverage: 92.00% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #10480   +/-   ##
=======================================
  Coverage   93.94%   93.94%           
=======================================
  Files        1626     1626           
  Lines      147461   147482   +21     
=======================================
+ Hits       138530   138554   +24     
+ Misses       8931     8928    -3     
Impacted Files Coverage Δ
google/cloud/storage/internal/rest_client.cc 73.93% <66.66%> (-0.11%) ⬇️
google/cloud/storage/internal/curl_client.cc 98.82% <100.00%> (+<0.01%) ⬆️
...gle/cloud/storage/tests/bucket_integration_test.cc 96.57% <100.00%> (+0.06%) ⬆️
...integration_tests/schema_admin_integration_test.cc 98.88% <0.00%> (-1.12%) ⬇️
...le/cloud/storage/internal/curl_download_request.cc 88.29% <0.00%> (-1.01%) ⬇️
google/cloud/storage/parallel_upload.cc 98.28% <0.00%> (-0.35%) ⬇️
google/cloud/completion_queue_test.cc 97.13% <0.00%> (-0.20%) ⬇️
...sub/internal/batching_publisher_connection_test.cc 99.62% <0.00%> (+0.18%) ⬆️
...ud/spanner/integration_tests/client_stress_test.cc 84.86% <0.00%> (+0.65%) ⬆️
...cloud/pubsub/internal/subscription_session_test.cc 99.33% <0.00%> (+1.16%) ⬆️
... and 1 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

It seems that 409 should be treated as a `kAlreadyExists` in this case,
and this case only.
@coryan coryan force-pushed the fix-storage-create-bucket-returns-kAlreadyExists branch from 6888190 to b98386f Compare January 2, 2023 17:21
@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: b98386f77021e4bed4669f721cac1a42c24222fd

ℹ️ NOTE: Kokoro logs are linked from "Details" below.

@coryan coryan marked this pull request as ready for review January 2, 2023 18:32
@coryan coryan requested a review from a team as a code owner January 2, 2023 18:32
Comment on lines 217 to 218
return google::cloud::internal::WithStatusCode(std::move(response).status(),
StatusCode::kAlreadyExists);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q. Could we, almost as effectively, avoid the extra Status complications with just ...

    return Status(StatusCode::kAlreadyExists, response.status().message(),
                  response.status().error_info());

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to avoid the extra copies, but meh. This is not happening on each call or anything.

@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: a204b51833b217391b7bcb719170db69dcfe61aa

ℹ️ NOTE: Kokoro logs are linked from "Details" below.

@coryan coryan enabled auto-merge (squash) January 3, 2023 13:56
@coryan coryan merged commit 598f07d into googleapis:main Jan 3, 2023
@coryan coryan deleted the fix-storage-create-bucket-returns-kAlreadyExists branch January 3, 2023 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the Cloud Storage API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Calling storage::Client::CreateBucket() returns kAborted instead of kAlreadyExists for existing bucket
4 participants