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): error message for resumable uploads #9855

Merged
merged 2 commits into from
Sep 15, 2022
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
36 changes: 24 additions & 12 deletions google/cloud/storage/internal/retry_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,12 @@ Status ValidateCommittedSize(UploadChunkRequest const& request,
<< response.committed_size.value_or(0) << " bytes as committed."
<< " This is most likely a bug in the GCS client library, possibly"
<< " related to parsing the server response."
<< " Please contact support or report the problem at"
<< " https://github.com/googleapis/google-cloud-cpp/issues/new"
<< " Include as much information as you can including this message";
os << ", session_id=" << request.upload_session_url();
<< " If you believe this is a bug in the client library, please contact"
<< " support (https://cloud.google.com/support/), or report the bug"
<< " (https://github.com/googleapis/google-cloud-cpp/issues/new)."
<< " Please include as much information as you can including this"
<< " message and the following details:";
os << " session_id=" << request.upload_session_url();
os << ", result=" << response;
os << ", request=" << request;
return Status(StatusCode::kInternal, os.str());
Expand All @@ -120,14 +122,24 @@ Status ValidateCommittedSize(UploadChunkRequest const& request,
os << __func__ << ": the server indicates that "
<< response.committed_size.value_or(0) << " bytes are committed "
<< " but given the current request no more than "
<< expected_committed_size << " should be."
<< " This could be caused by multiple applications trying to use the"
<< " same resumable upload, but could be a bug in the library or"
<< " the service. If you believe this is a bug, please contact support"
<< " or report the bug at"
<< " https://github.com/googleapis/google-cloud-cpp/issues/new"
<< " Include as much information as you can including this message";
os << ", session_id=" << request.upload_session_url();
<< expected_committed_size << " are expected be."
<< " Most likely your application resumed an upload, and the client"
<< " library queried the service to find the current persisted bytes."
<< " In some cases, the service is still writing data in the background"
<< " and conservatively reports fewer bytes as persisted."
<< " In this case, the next upload may report a much higher number of"
<< " bytes persisted than expected. It is not possible for the client"
<< " library to recover from this situation. The application needs to"
<< " resume the upload."
<< " This could also be caused by multiple instances of a distributed"
<< " application trying to use the same resumable upload, this is a bug"
<< " in the application."
Copy link
Member

Choose a reason for hiding this comment

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

same \n question

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ditto

<< " If you believe this is a bug in the client library, please contact"
<< " support (https://cloud.google.com/support/), or report the bug"
<< " (https://github.com/googleapis/google-cloud-cpp/issues/new)."
<< " Please include as much information as you can including this"
<< " message and the following details:";
os << " session_id=" << request.upload_session_url();
os << ", result=" << response;
os << ", request=" << request;
return Status(StatusCode::kInternal, os.str());
Expand Down
6 changes: 3 additions & 3 deletions google/cloud/storage/internal/retry_client_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -449,9 +449,9 @@ TEST(RetryClientTest, UploadChunkHandleOvercommit) {
UploadChunkRequest("test-only-upload-id", 0, {{payload}}));
EXPECT_THAT(
response,
StatusIs(StatusCode::kInternal,
HasSubstr("This could be caused by multiple applications trying "
"to use the same resumable upload")));
StatusIs(
StatusCode::kInternal,
HasSubstr("If you believe this is a bug in the client library")));
}

/// @test Verify that retry exhaustion following a short write fails.
Expand Down