GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: retrying get remote offset and recover from last chunk failures. by frankyn · Pull Request #726 · googleapis/java-storage

This repository was archived by the owner on Sep 25, 2026. It is now read-only.

Conversation

@frankyn

@frankyn frankyn commented Feb 24, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

I added three things in this PR:

  1. Retries around getting remote offset from GCS
  2. Retrying last chunk failures correctly.
  3. Updated documentation for the retry cases

Fixes #709 #687 ☕️

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Frank Natividad added 2 commits February 24, 2021 00:20
Frank Natividad
fix: address offset retry strategy issues
3d5a723
Frank Natividad
Merge branch 'master' into improve-retry-reliability
d00c044
@product-auto-label product-auto-label Bot added the api: storage Issues related to the googleapis/java-storage API. label Feb 24, 2021
@google-cla google-cla Bot added the cla: yes This human has signed the Contributor License Agreement. label Feb 24, 2021
@frankyn frankyn changed the title Improve retry reliability fix: retrying get remote offset and recover from last chunk failures. Feb 24, 2021
@codecov

codecov Bot commented Feb 24, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

Merging #726 (fbea777) into master (1389d01) will increase coverage by 0.26%.
The diff coverage is 78.04%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #726      +/-   ##
============================================
+ Coverage     64.33%   64.60%   +0.26%     
- Complexity      621      634      +13     
============================================
  Files            32       32              
  Lines          5322     5311      -11     
  Branches        521      519       -2     
============================================
+ Hits           3424     3431       +7     
+ Misses         1733     1718      -15     
+ Partials        165      162       -3     
Impacted Files Coverage Δ Complexity Δ
...om/google/cloud/storage/spi/v1/HttpStorageRpc.java 1.56% <0.00%> (+<0.01%) 2.00 <0.00> (ø)
...ava/com/google/cloud/storage/BlobWriteChannel.java 79.79% <88.88%> (+12.50%) 15.00 <4.00> (+4.00)

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 1389d01...5446314. Read the comment docs.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@frankyn
frankyn marked this pull request as ready for review February 24, 2021 19:23
@frankyn
frankyn requested a review from a team February 24, 2021 19:23
BenWhitehead
BenWhitehead approved these changes Feb 24, 2021
View reviewed changes

@BenWhitehead BenWhitehead left a comment

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Just a few minor comments/questions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread google-cloud-storage/src/test/java/com/google/cloud/storage/BlobWriteChannelTest.java Outdated
}

@Test
public void testWriteWithDriftRetryCase10() throws IOException {

@BenWhitehead BenWhitehead Feb 24, 2021

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

nit: I don't know what case N is,

If easy can we improve these test names? maybe something like
testWriteWithDriftRetry_exceptionWhileWriting

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread google-cloud-storage/src/main/java/com/google/cloud/storage/spi/v1/HttpStorageRpc.java
response = httpRequest.execute();
int code = response.getStatusCode();
if (code == 201 || code == 200) {
// Upload completed successfully

@BenWhitehead BenWhitehead Feb 24, 2021

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

nit: create constants for compared values instead of commenting

201 -> STATUS_CREATED
200 -> STATUS_OK

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread google-cloud-storage/src/main/java/com/google/cloud/storage/spi/v1/HttpStorageRpc.java
sb.append("Not sure what occurred. Here's debugging information:\n");
sb.append("Response:\n").append(ex.toString()).append("\n\n");
throw new StorageException(0, sb.toString());
throw translate(ex);

@BenWhitehead BenWhitehead Feb 24, 2021

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

We don't want to keep the information in the exception message?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread google-cloud-storage/src/main/java/com/google/cloud/storage/BlobWriteChannel.java Outdated
sb.append("uploadId: ").append(getUploadId()).append('\n');
sb.append("localNextByteOffset: ").append(localNextByteOffset).append('\n');
sb.append("remoteNextByteOffset: ").append(remoteNextByteOffset).append('\n');
sb.append("driftOffset: ").append(driftOffset).append("\n\n");

@BenWhitehead BenWhitehead Feb 24, 2021

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

nit: only diff between this block and case 4 is Local vs Remote can we extract a method of this logic so it's easier to keep in sync?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Frank Natividad added 5 commits February 24, 2021 17:25
Frank Natividad
address feedback
372861d
Frank Natividad
refactor retry strategy
b67a0a2
Frank Natividad
refactor retry strategy
bcf037f
Frank Natividad
refactor
cb562b0
Frank Natividad
remove it for testing
5446314
@frankyn frankyn added the automerge Merge the pull request once unit tests and other checks pass. label Feb 26, 2021
@gcf-merge-on-green
gcf-merge-on-green Bot merged commit b41b881 into master Feb 26, 2021
@gcf-merge-on-green
gcf-merge-on-green Bot deleted the improve-retry-reliability branch February 26, 2021 02:34
@gcf-merge-on-green gcf-merge-on-green Bot removed the automerge Merge the pull request once unit tests and other checks pass. label Feb 26, 2021
gcf-merge-on-green Bot pushed a commit that referenced this pull request Mar 1, 2021
@release-please
chore(master): release 1.113.12 (#721)
aecbf52
🤖 I have created a release \*beep\* \*boop\* 
---
### [1.113.12](https://www.github.com/googleapis/java-storage/compare/v1.113.11...v1.113.12) (2021-02-26)


### Bug Fixes

* retrying get remote offset and recover from last chunk failures. ([#726](https://www.github.com/googleapis/java-storage/issues/726)) ([b41b881](https://www.github.com/googleapis/java-storage/commit/b41b88109e13b5ebbd0393d1f264225c12876be6))


### Dependencies

* update dependency com.google.api-client:google-api-client to v1.31.2 ([#686](https://www.github.com/googleapis/java-storage/issues/686)) ([6b1f036](https://www.github.com/googleapis/java-storage/commit/6b1f0361376167719ec5456181134136d27d1d3c))
* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.20.0 ([#732](https://www.github.com/googleapis/java-storage/issues/732)) ([c98413d](https://www.github.com/googleapis/java-storage/commit/c98413df9d9514340aed78b5a4d5e596760bb616))
* update kms.version to v0.87.7 ([#724](https://www.github.com/googleapis/java-storage/issues/724)) ([3229bd8](https://www.github.com/googleapis/java-storage/commit/3229bd860f3a4d700a969aa9e922bbf6b5c1ca10))
* update kms.version to v0.87.8 ([#733](https://www.github.com/googleapis/java-storage/issues/733)) ([a21b75f](https://www.github.com/googleapis/java-storage/commit/a21b75fa846f373970298dd98f8f3520fc2b3c97))
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

1 more reviewer
@BenWhitehead BenWhitehead BenWhitehead approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

api: storage Issues related to the googleapis/java-storage API. cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

google cloud storage: NPE from BlobId.java:119

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@frankyn @BenWhitehead
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.