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: Only override built-in retry settings when the customer provides them. #1588

Merged
merged 7 commits into from
Mar 4, 2024

Conversation

tom-andersen
Copy link
Contributor

@tom-andersen tom-andersen commented Feb 26, 2024

Internal tracking: b/283455016

The retry settings found in FirestoreStubSettings are being overridden, whether or not the customer provides an override. To prevent this, we conditionally override based on whether customer has provided retry settings.

In addition, default for maxAttempts is omitted from automatically generated in code. There is a link to issue in code. Until this issue is resolved, we will need to override maxAttempts, but everything else should be according to build-in config.

Also, the new streaming endpoint AggregateQuery never had the retry config applied. That is also fixed in this PR.

@product-auto-label product-auto-label bot added size: s Pull request size is small. api: firestore Issues related to the googleapis/java-firestore API. labels Feb 26, 2024
@tom-andersen tom-andersen changed the title Only overrride retry settings when the customer provides them. fix: Only override built-in retry settings when the customer provides them. Feb 26, 2024
Copy link

🤖 I detect that the PR title and the commit message differ and there's only one commit. To use the PR title for the commit history, you can use Github's automerge feature with squashing, or use automerge label. Good luck human!

-- conventional-commit-lint bot
https://conventionalcommits.org/

@tom-andersen tom-andersen added the owlbot:run Add this label to trigger the Owlbot post processor. label Feb 26, 2024
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Feb 26, 2024
@tom-andersen tom-andersen marked this pull request as ready for review February 26, 2024 22:20
@tom-andersen tom-andersen requested a review from a team as a code owner February 26, 2024 22:20
Copy link
Contributor

@ehsannas ehsannas left a comment

Choose a reason for hiding this comment

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

Is it possible to add a unit test for this?

@product-auto-label product-auto-label bot added size: l Pull request size is large. and removed size: s Pull request size is small. labels Feb 27, 2024
@tom-andersen tom-andersen added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Feb 27, 2024
@tom-andersen
Copy link
Contributor Author

Is it possible to add a unit test for this?

@ehsannas I added test in order to verify that retry settings are being passed correctly to the calling layer. It relies heavily on reflection, so there is a good chance this will break and need to be fixed with new versions of GAX. But hopefully, that will be manageable.

@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Feb 28, 2024
Copy link
Contributor

@ehsannas ehsannas left a comment

Choose a reason for hiding this comment

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

LGTM. Some nits pointed out below.

.setInitialRetryDelay(Duration.ofMillis(100))
.setMaxRetryDelay(Duration.ofSeconds(60))
.setRetryDelayMultiplier(1.3)
.build();
Copy link
Contributor

Choose a reason for hiding this comment

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

Aren't expectedRetrySettings1 and expectedRetrySettings4 and expectedRetrySettings5 the same? should we use the same variable for them?

}

@Test
public void batchWriteCallableFollowsServiceConfigFollowsServiceConfig() throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

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

FollowsServiceConfigFollowsServiceConfig

// Override retry settings only if customer provides settings different from default.
if (retrySettings.equals(ServiceOptions.getDefaultRetrySettings())) {
// This code should be removed when following issue is fixed:
// https://github.com/googleapis/sdk-platform-java/issues/2306
Copy link
Contributor

Choose a reason for hiding this comment

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

Someone reading the code for the first time may wonder where these setMaxAttempts(5) are coming from.

Perhaps the following is a better comment:

// We are manually setting `setMaxAttempts(5)` to follow
// the `firestore_grpc_service_config.json` configuration.
// This code should be removed when following issue is fixed:
// https://github.com/googleapis/sdk-platform-java/issues/2306

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice. I will copy/paste that.

@ehsannas ehsannas assigned tom-andersen and unassigned ehsannas Feb 29, 2024
@tom-andersen tom-andersen added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Mar 4, 2024
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Mar 4, 2024
@tom-andersen tom-andersen merged commit 103c37a into main Mar 4, 2024
24 checks passed
@tom-andersen tom-andersen deleted the tomandersen/retrySettings branch March 4, 2024 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: firestore Issues related to the googleapis/java-firestore API. size: l Pull request size is large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants