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(common): backoff policy clones initial state #7696

Merged
merged 2 commits into from
Dec 5, 2021

Conversation

dbolduc
Copy link
Member

@dbolduc dbolduc commented Dec 4, 2021

When calling .clone() on an exponential backoff policy, copy the initial state instead of the current state. This may result in a change of behavior, but we see it as a bug that ought to be fixed.


This change is Reviewable

@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Dec 4, 2021
@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: d883d1d42cf51b88789b9e98628a448df83744e3

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

@codecov
Copy link

codecov bot commented Dec 4, 2021

Codecov Report

Merging #7696 (8b9ec64) into main (edbe664) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #7696   +/-   ##
=======================================
  Coverage   95.29%   95.29%           
=======================================
  Files        1254     1254           
  Lines      113579   113589   +10     
=======================================
+ Hits       108233   108249   +16     
+ Misses       5346     5340    -6     
Impacted Files Coverage Δ
google/cloud/bigtable/rpc_backoff_policy.cc 100.00% <100.00%> (ø)
google/cloud/bigtable/rpc_backoff_policy.h 100.00% <100.00%> (ø)
google/cloud/bigtable/rpc_backoff_policy_test.cc 100.00% <100.00%> (ø)
google/cloud/internal/backoff_policy.cc 100.00% <100.00%> (ø)
google/cloud/internal/backoff_policy.h 100.00% <100.00%> (+8.33%) ⬆️
google/cloud/internal/backoff_policy_test.cc 100.00% <100.00%> (ø)
google/cloud/bigtable/internal/common_client.h 94.02% <0.00%> (-5.98%) ⬇️
google/cloud/pubsub/samples/samples.cc 92.10% <0.00%> (+0.07%) ⬆️
...cloud/pubsub/internal/subscription_session_test.cc 98.00% <0.00%> (+0.24%) ⬆️
...ud/spanner/integration_tests/client_stress_test.cc 86.18% <0.00%> (+0.65%) ⬆️
... and 3 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 edbe664...8b9ec64. Read the comment docs.

@dbolduc dbolduc marked this pull request as ready for review December 4, 2021 21:14
@dbolduc dbolduc requested a review from a team as a code owner December 4, 2021 21:14
Copy link
Contributor

@coryan coryan left a comment

Choose a reason for hiding this comment

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

Consider updating CHANGELOG.md as part of this PR, it will be harder to remember what we wanted to say when we release this.

Comment on lines -33 to +34
return std::unique_ptr<RPCBackoffPolicy>(new ExponentialBackoffPolicy(*this));
return std::unique_ptr<RPCBackoffPolicy>(
new ExponentialBackoffPolicy(initial_delay_, maximum_delay_));
Copy link
Contributor

Choose a reason for hiding this comment

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

Possible follow-up note: It seems to me that copy construction/assignment for these "clone-able" classes is an attractive nuisance (they don't support equality after all), and that we'd be well served trying to delete that capability.

@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: 8b9ec6446e3cc4c356be4eef9daf33ac21e33f31

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

@dbolduc dbolduc merged commit 10a0fe2 into googleapis:main Dec 5, 2021
@dbolduc dbolduc deleted the backoff-policy-clone branch December 5, 2021 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants