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

cleanup(storage)!: uploads track committed_size #7868

Merged

Conversation

coryan
Copy link
Contributor

@coryan coryan commented Jan 10, 2022

Fixing how the storage client library deals with reponses lacking a
Range header will break any existing unit tests that mock a
ResumableUploadSession. This creates an opportunity to cleanup the
semantics of ResumableUploadResponse. This change performs that
cleanup.

BREAKING CHANGE: with this PR any use of the
storage::internal::ResumableUploadResponse type require changes.
Applications should have little need for this type, outside mocks, so
the changes should not affect production code.

Nevertheless, we apologize for the inconvenience, and while we would have
preferred to avoid breaking changes, it was inevitable to introduce some
breaking changes to fix a data loss bug.

If you are affected by this change, we expect that any existing tests
will fail to compile. This was an intentional choice, the semantics of
some values are changing, we think it is better to have these issues
detected at compile-time rather than during test execution.

We have updated the examples to use the new mocks, and the release notes
include more details on how to change any affected tests.

Fixes #6880, part of the work for #7835


This change is Reviewable

Fixing how the `storage` client library deals with reponses lacking a
`Range` header will break any existing unit tests that mock a
`ResumableUploadSession`. This creates an opportunity to cleanup the
semantics of `ResumableUploadResponse`. This change performs that
cleanup.

**BREAKING CHANGE:** with this PR any use of the
`storage::internal::ResumableUploadResponse` type require changes.
Applications should have little need for this type, outside mocks, so
the changes should not affect production code.

Nevertheless, we apologize for the inconvenience, and while we would have
preferred to avoid breaking changes, it was inevitable to introduce some
breaking changes to fix a data loss bug.

If you are affected by this change, we expect that any existing tests
will fail to compile. This was an intentional choice, the semantics of
some values are changing, we think it is better to have these issues
detected at compile-time rather than during test execution.

We have updated the examples to use the new mocks, and the release notes
include more details on how to change any affected tests.
@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: 53775b2918f3606bf0ee357403c26aa1747a375a

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

@codecov
Copy link

codecov bot commented Jan 10, 2022

Codecov Report

Merging #7868 (f0071bb) into main (4373029) will not change coverage.
The diff coverage is 98.12%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #7868   +/-   ##
=======================================
  Coverage   95.12%   95.12%           
=======================================
  Files        1285     1285           
  Lines      116163   116122   -41     
=======================================
- Hits       110496   110457   -39     
+ Misses       5667     5665    -2     
Impacted Files Coverage Δ
...ud/storage/examples/storage_client_mock_samples.cc 100.00% <ø> (ø)
google/cloud/storage/internal/grpc_client.cc 74.44% <0.00%> (+0.27%) ⬆️
.../cloud/storage/internal/resumable_upload_session.h 60.00% <ø> (ø)
google/cloud/storage/parallel_uploads_test.cc 97.28% <ø> (ø)
...ge/internal/retry_resumable_upload_session_test.cc 99.57% <97.72%> (-0.01%) ⬇️
google/cloud/storage/client_write_object_test.cc 100.00% <100.00%> (ø)
.../storage/internal/curl_resumable_upload_session.cc 97.61% <100.00%> (-0.11%) ⬇️
...age/internal/curl_resumable_upload_session_test.cc 100.00% <100.00%> (ø)
...oud/storage/internal/grpc_object_request_parser.cc 94.50% <100.00%> (+0.48%) ⬆️
.../storage/internal/grpc_resumable_upload_session.cc 100.00% <100.00%> (ø)
... and 10 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4373029...f0071bb. Read the comment docs.

@coryan coryan marked this pull request as ready for review January 10, 2022 22:58
@coryan coryan requested a review from a team as a code owner January 10, 2022 22:58
CHANGELOG.md Outdated
}
```

That is, you need to re-order the fields **and** change increase the
Copy link
Contributor

Choose a reason for hiding this comment

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

s/change increase/increase/?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

// We expect a `Range:` header in the format described here:
// https://cloud.google.com/storage/docs/json_api/v1/how-tos/resumable-upload
// that is the value should match `bytes=0-[0-9]+`:

Copy link
Contributor

Choose a reason for hiding this comment

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

Opt nit: Remove blank line?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: f0071bbd24e8b66cc91e880b89f206851b6b6cc0

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

@coryan coryan merged commit 2c8bba4 into googleapis:main Jan 11, 2022
@coryan coryan deleted the cleanup-storage-bang-use-committed-size branch January 11, 2022 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Resumable uploads have confusing account for "last committed byte"
3 participants