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

feat: use full jitter exp backoff policy in the generator #11748

Merged
merged 10 commits into from
May 31, 2023

Conversation

alevenberg
Copy link
Member

@alevenberg alevenberg commented May 30, 2023

Fixes issue #8755


This change is Reviewable

@alevenberg alevenberg requested a review from a team as a code owner May 30, 2023 18:49
@@ -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"
Copy link
Contributor

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.

Copy link
Member

@dbolduc dbolduc left a 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.

Copy link
Member Author

@alevenberg alevenberg left a 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?

Copy link
Member

@dbolduc dbolduc left a 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
Copy link

codecov bot commented May 30, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (403ca83) 93.77% compared to head (0108ee2) 93.77%.

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           
Impacted Files Coverage Δ
generator/internal/option_defaults_generator.cc 73.91% <ø> (ø)
...v1/internal/golden_kitchen_sink_option_defaults.cc 100.00% <100.00%> (ø)
...en/v1/internal/golden_rest_only_option_defaults.cc 100.00% <100.00%> (ø)
.../v1/internal/golden_thing_admin_option_defaults.cc 100.00% <100.00%> (ø)
.../tests/golden_kitchen_sink_option_defaults_test.cc 100.00% <100.00%> (ø)
...s/tests/golden_thing_admin_option_defaults_test.cc 100.00% <100.00%> (ø)
...le/cloud/pubsub/internal/schema_option_defaults.cc 100.00% <100.00%> (ø)

... and 4 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Member Author

@alevenberg alevenberg left a 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.

Copy link
Member

@dbolduc dbolduc left a comment

Choose a reason for hiding this comment

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

generator/internal/option_defaults_generator.cc Outdated Show resolved Hide resolved
* add golden kitchen sink options default to test for retry, backoff, and idempotency
* add golden thing admin tests for backoff, retry, and polling policy
Copy link
Member

@dbolduc dbolduc left a 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.

Copy link
Member Author

@alevenberg alevenberg left a 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 of google-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.

Copy link
Member Author

@alevenberg alevenberg left a 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)

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.

Reviewed 122 of 233 files at r1, 111 of 113 files at r3, 2 of 2 files at r4, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @alevenberg)

@alevenberg alevenberg merged commit 3f504e5 into googleapis:main May 31, 2023
@alevenberg alevenberg deleted the bug-8755 branch June 20, 2023 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants