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): only backoff before resume attempts #14427

Merged

Conversation

coryan
Copy link
Member

@coryan coryan commented Jul 3, 2024

storage::Client::ReadObject() resumes a download that gets
interrupted (controlled by policy). Before making a resume attempt, the
library backsoff in case the problem is load related. The library was
also backing off before issuing the first Read() on the newly
created source of data. That effectively doubles the backoff time.

Fixes #14424


This change is Reviewable

@product-auto-label product-auto-label bot added the api: storage Issues related to the Cloud Storage API. label Jul 3, 2024
Copy link

codecov bot commented Jul 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.59%. Comparing base (c39fb3a) to head (9374247).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #14427   +/-   ##
=======================================
  Coverage   93.58%   93.59%           
=======================================
  Files        2313     2313           
  Lines      206951   206983   +32     
=======================================
+ Hits       193680   193716   +36     
+ Misses      13271    13267    -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

`storage::Client::ReadObject()` resumes a download that gets
interrupted (controlled by policy). On the first resume attempt, the
library does not back off (sleep), becuase there is no reason to believe
the problem is load related. If the first resume fails, the library
backsoff before each attempt, as the problem might be load related after
this point.

The library was *also* backing off before issuing the first `Read()` on
the newly created source of data. That effectively doubles the backoff
time, and leaves the resumed connection idle for (potentially) a long
time when there are multiple resume attempts needed.
@coryan coryan force-pushed the fix-storage-only-sleep-before-resume-attempts branch from 5e65592 to eacd9e4 Compare July 3, 2024 18:19
@coryan coryan marked this pull request as ready for review July 3, 2024 18:42
@coryan coryan requested review from a team as code owners July 3, 2024 18:42
HttpResponse{100, "", {}}}));
EXPECT_CALL(*source, Read).WillOnce(Return(TransientError()));
// No backoffs to resume after a (partially) successful request:
// EXPECT_CALL(backoff, Call).Times(1);
Copy link
Member

Choose a reason for hiding this comment

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

remove?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@@ -222,21 +224,22 @@ TEST(RetryObjectReadSourceTest, BackoffPolicyResetOnSuccess) {

Copy link
Member

Choose a reason for hiding this comment

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

s/closed/cloned/ on L217

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@coryan coryan enabled auto-merge (squash) July 3, 2024 20:20
@coryan coryan merged commit f54ba19 into googleapis:main Jul 3, 2024
63 checks passed
@coryan coryan deleted the fix-storage-only-sleep-before-resume-attempts branch July 3, 2024 21:23
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 Cloud Storage API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Client library sleeps after successfully resuming a download
2 participants