FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix: update ApiaryUnbufferedWritableByteChannel to be graceful of non-quantum aligned write calls by BenWhitehead · Pull Request #2493 · googleapis/java-storage · GitHub

fix: update ApiaryUnbufferedWritableByteChannel to be graceful of non-quantum aligned write calls - #2493

Merged
BenWhitehead merged 1 commit into
mainfrom
dangling-bytes
Apr 9, 2024
Merged

fix: update ApiaryUnbufferedWritableByteChannel to be graceful of non-quantum aligned write calls#2493
BenWhitehead merged 1 commit into
mainfrom
dangling-bytes

Conversation

Copy link
Copy Markdown
Collaborator

Despite GCS only allowing incremental updates to a resumable session at 256KiB byte boundaries, we have observed an extremely rare case (<0.000001%) of an incremental write being non-quantum aligned. The change in this PR makes ApiaryUnbufferedWritableByteChannel graceful to this possibility, and will only set the finalization header when close is invoked.

If a write is not quantum aligned, it will either: 1) not be consumed at all, at which point write can be called again with the still enqueued bytes 2) partially consumed, with the position of the provided ByteBuffers updated to reflect how much of their bytes were consumed, matching up with the number of bytes actually consumed returned from write()

Add new integration test to intentionally perform non-quantum aligned write() calls to ApiaryUnbufferedWritableByteChannel.

Separate change to gRPC affected code path to come in a later PR.

b/330550326

…-quantum aligned write calls

Despite GCS only allowing incremental updates to a resumable session at 256KiB byte boundaries, we have observed an extremely rare case of an incremental write being non-quantum aligned. The change in this PR makes ApiaryUnbufferedWritableByteChannel graceful to this possibility, and will only set the finalization header when close is invoked.

If a write is not quantum aligned, it will either:
1) not be consumed at all, at which point write can be called again with the still enqueued bytes
2) partially consumed, with the position of the provided ByteBuffers updated to reflect how much of their bytes were consumed, matching up with the number of bytes actually consumed returned from `write()`

Add new integration test to intentionally perform non-quantum aligned `write()` calls to ApiaryUnbufferedWritableByteChannel.

Separate change to gRPC affected code path to come in a later PR.

b/330550326
BenWhitehead added the owlbot:ignore instruct owl-bot to ignore a PR label Apr 8, 2024
BenWhitehead requested a review from a team April 8, 2024 22:04
product-auto-label Bot added size: m Pull request size is medium. api: storage Issues related to the googleapis/java-storage API. labels Apr 8, 2024
* committed.
*/
@Test
public void scenario9() throws Exception {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This test would verify that GCS ack'ing fewer bytes than were sent was correctly categorized as a failure scenario, however as we are now gracefully handling the partial write case. We no longer need this test for failure categorization.

BenWhitehead merged commit f548335 into main Apr 9, 2024
BenWhitehead deleted the dangling-bytes branch April 9, 2024 19:22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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 googleapis/java-storage API. owlbot:ignore instruct owl-bot to ignore a PR size: m Pull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL