Skip to content
This repository was archived by the owner on Mar 31, 2026. It is now read-only.

feat: add configurable checksumming for blob uploads and downloads - #246

Merged
tseaver merged 14 commits into
masterfrom
crc32c
Aug 26, 2020
Merged

feat: add configurable checksumming for blob uploads and downloads#246
tseaver merged 14 commits into
masterfrom
crc32c

Conversation

@andrewsg

Copy link
Copy Markdown
Contributor

No description provided.

@google-clagoogle-claBot added the cla: yes This human has signed the Contributor License Agreement. label Aug 14, 2020
response = upload.transmit_next_chunk(transport, timeout=timeout)
except resumable_media.DataCorruption:
# Attempt to delete the corrupted object.
self.delete()

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

If this fails for any reason, both exceptions will be reported, using the Python exception pattern "During handling of the above exception, another exception occurred"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What occurs here if a valid previous generation of the blob exists?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

In the default case, if versioning is off, there is no way to recover the older version. Unfortunately this can only be resolved by backend changes to make server-side checksumming possible for resumable uploads.

In the case where versioning is on, the previous generation still exists, but is not live. This is consistent with behavior in nodejs, which I modeled this code after. We could potentially try to roll back and make the previous version live, but we should also modify nodejs and other languages to be consistent across languages. What do you think?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this is more of a documentation issue until there's a better fix in the backend to support checksums better.

I'd prefer consistency here with clear acknowledgment that these cases can occur when using checksumming. It's not done automatically so it doesn't change behavior for uploads.

:type checksum: str
:param checksum:
(Optional) The type of checksum to compute to verify
the integrity of the object. If the upload is completed in a single

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

This "if the upload is completed in a single request" / "if the upload is too large" is undeniably ugly and hopefully we can implement server-side handling of resumable upload checksums to resolve that soon

@andrewsgandrewsg changed the title Add configurable checksumming for blob uploads and downloadsfeat: add configurable checksumming for blob uploads and downloadsAug 14, 2020
@andrewsg

Copy link
Copy Markdown
ContributorAuthor

Recommend hold off on merging until google-resumable-media releases to 1.0 (and bump up the dependency version number in setup.py here)

Comment threadtests/system/test_system.py Outdated
@product-auto-labelproduct-auto-labelBot added the api: storage Issues related to the googleapis/python-storage API. label Aug 21, 2020
Comment threadtests/system/test_system.py
response = upload.transmit_next_chunk(transport, timeout=timeout)
except resumable_media.DataCorruption:
# Attempt to delete the corrupted object.
self.delete()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this is more of a documentation issue until there's a better fix in the backend to support checksums better.

I'd prefer consistency here with clear acknowledgment that these cases can occur when using checksumming. It's not done automatically so it doesn't change behavior for uploads.

@tseaver

Copy link
Copy Markdown
Contributor

googleapis/google-resumable-media-python#142 is the PR for bumping GRMP to 1.0.

@andrewsg

Copy link
Copy Markdown
ContributorAuthor

@tseaver@frankyn PTAL

@tseaver Has the PR you linked made it to release yet? If it's released I'll use this PR to also update setup.py to use the new version.

Comment threadgoogle/cloud/storage/blob.py
@andrewsg

Copy link
Copy Markdown
ContributorAuthor

Bumped version number. This should be good to merge as soon as final review comes through. Thanks all

@frankynfrankyn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, thanks @andrewsg!

@andrewsg

Copy link
Copy Markdown
ContributorAuthor

@tseaver PTAL soon if you are available, I've been asked to release. Thanks!

@tseaver

Copy link
Copy Markdown
Contributor

@tseaver
tseaver merged commit 23b7d1c into masterAug 26, 2020
@tseaver
tseaver deleted the crc32c branch August 26, 2020 19:20
cojenco pushed a commit to cojenco/python-storage that referenced this pull request Oct 13, 2021
…oogleapis#246)
Co-authored-by: Tres Seaver <tseaver@palladion.com>
Co-authored-by: Frank Natividad <frankyn@users.noreply.github.com>
cojenco pushed a commit to cojenco/python-storage that referenced this pull request Oct 13, 2021
…oogleapis#246)
Co-authored-by: Tres Seaver <tseaver@palladion.com>
Co-authored-by: Frank Natividad <frankyn@users.noreply.github.com>
@release-pleaserelease-pleaseBot mentioned this pull request Jan 12, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api: storageIssues related to the googleapis/python-storage API.cla: yesThis human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@andrewsg@tseaver@frankyn