Skip to content

impl(bigquery): add default job retry policies - #6233

Open
alvarowolfx wants to merge 6 commits into
googleapis:mainfrom
alvarowolfx:impl-bq-retry-policy
Open

impl(bigquery): add default job retry policies#6233
alvarowolfx wants to merge 6 commits into
googleapis:mainfrom
alvarowolfx:impl-bq-retry-policy

Conversation

@alvarowolfx

Copy link
Copy Markdown
Contributor

Towards #6218 #5844

@product-auto-label product-auto-label Bot added the api: bigquery Issues related to the BigQuery API. label Jul 30, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new retry policy module (retry_policy.rs) for BigQuery, defining the RetryableErrors policy and helper functions to map BigQuery error reasons to gRPC status codes. Feedback points out a logic issue in query_job_failed_to_gax_error where permanent errors could be incorrectly mapped to a retryable Code::Unavailable status, potentially causing unnecessary retries. A code suggestion is provided to prioritize retryable errors and fall back to a non-retryable code if none are found.

Comment thread src/bigquery/src/retry_policy.rs Outdated
@codecov

codecov Bot commented Jul 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.67816% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.06%. Comparing base (0dac6ea) to head (1089ab4).

Files with missing lines Patch % Lines
src/bigquery/src/retry_policy.rs 93.67% 11 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6233      +/-   ##
==========================================
- Coverage   96.07%   96.06%   -0.01%     
==========================================
  Files         275      276       +1     
  Lines       68829    69003     +174     
==========================================
+ Hits        66126    66289     +163     
- Misses       2703     2714      +11     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@alvarowolfx
alvarowolfx marked this pull request as ready for review July 31, 2026 20:18
@alvarowolfx
alvarowolfx requested a review from a team as a code owner July 31, 2026 20:18
@alvarowolfx alvarowolfx changed the title impl(bigquery): add default retry policies impl(bigquery): add default job retry policies Jul 31, 2026
@alvarowolfx

Copy link
Copy Markdown
Contributor Author

/gemini review

@alvarowolfx
alvarowolfx marked this pull request as draft July 31, 2026 20:20

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a retry policy for BigQuery, defining retry strategies for both RPC and job-level execution. The review feedback identifies several critical issues: a private-in-public visibility mismatch for RetryableErrors, a type mismatch and logical bug in is_retryable_errors (which should use .all() instead of .any() to avoid retrying permanent failures), a test failure in test_job_attempt_limit due to a mismatched attempt limit, and an outdated assertion in test_is_retryable_errors.

Comment thread src/bigquery/src/retry_policy.rs
Comment thread src/bigquery/src/retry_policy.rs Outdated
Comment thread src/bigquery/src/retry_policy.rs
Comment thread src/bigquery/src/retry_policy.rs
@alvarowolfx

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces retry and backoff policies for BigQuery, including RetryableErrors for RPC retries and RetryableJobErrors for job-level retries. Feedback suggests updating the RetryableErrors policy to check state.idempotent before retrying to prevent unsafe retries on non-idempotent requests, and updating the corresponding unit tests to verify both idempotent and non-idempotent retry behaviors.

Comment thread src/bigquery/src/retry_policy.rs
Comment thread src/bigquery/src/retry_policy.rs
@alvarowolfx
alvarowolfx marked this pull request as ready for review July 31, 2026 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: bigquery Issues related to the BigQuery API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant