Skip to content

fix(bigquery): Recover query jobs after ambiguous retries - #36735

Open
divenyijanos wants to merge 1 commit into
googleapis:mainfrom
divenyijanos:fix/bigquery-recover-retried-job
Open

divenyijanos wants to merge 1 commit into
googleapis:mainfrom
divenyijanos:fix/bigquery-recover-retried-job

Conversation

@divenyijanos

Copy link
Copy Markdown

Summary

jobs.insert(job_id)
  retryable insertion error
  retry jobs.insert(job_id)
    409 duplicate
      jobs.get(job_id, location)
      return the existing job

Recover an existing BigQuery query job when a retry receives 409 duplicate. An initial duplicate still raises Google::Cloud::AlreadyExistsError, preserving genuine job ID collision behavior.

Fixes #36734.

Evidence

  • Before: project_query_job_test.rb raised Google::Cloud::AlreadyExistsError for a retryable backendError followed by 409 duplicate.
  • After: focused query-job and backoff tests pass: 28 runs, 78 assertions, 0 failures, 0 errors.
  • Changed-line RuboCop check reports no offenses.
  • Full rake test reaches 1,435 runs and fails on 24 sparse-checkout fixture errors; focused affected tests pass. Most errors are missing acceptance/data fixtures. Three existing local-load mocks also reject keyword arguments under this dependency/runtime combination.

Merge Danger

Door: Two-way

The change is isolated to query-job insertion recovery and can be reverted without data migration or public interface changes.

Blast Radius: Query jobs

Only duplicate responses after this invocation has already retried are recovered. Initial duplicate responses continue to raise.

- Retrieve an existing query job when a retry receives a duplicate response
- Preserve AlreadyExistsError for duplicate responses on the initial insertion attempt
- Add regression coverage for both retry recovery and genuine initial collisions

Fixes googleapis#36734
@divenyijanos
divenyijanos requested review from a team and yoshi-approver as code owners November 19, 2026 10:05
@google-cla

google-cla Bot commented Nov 19, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

This branch has not been deployed

No deployments
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.

BigQuery query job retry raises when the job already exists

1 participant