Skip to content

[PLUGIN-1787] Ignore 409 Conflict during retry of bucket creation in BigQuery source plugin - #1624

Open
vishwasvaidya-cloudsufi wants to merge 2 commits into
data-integrations:developfrom
cloudsufi:fix-bq-source-bucket-conflict
Open

[PLUGIN-1787] Ignore 409 Conflict during retry of bucket creation in BigQuery source plugin#1624
vishwasvaidya-cloudsufi wants to merge 2 commits into
data-integrations:developfrom
cloudsufi:fix-bq-source-bucket-conflict

Conversation

@vishwasvaidya-cloudsufi

@vishwasvaidya-cloudsufi vishwasvaidya-cloudsufi commented Sep 9, 2026

Copy link
Copy Markdown

Summary

Fixes PLUGIN-1787 / b/539473185 where BigQuery Source intermittently fails with 409 Conflict: Your previous request to create the named bucket succeeded and you already own it when the GCS client retries temporary staging bucket creation after transient network timeouts.

Changes

  • Refactored bucket creation in BigQuerySourceUtils.java into a shared createBucket helper for both auto-generated and user-configured buckets.
  • Caught StorageException and ignored 409 Conflict so the pipeline proceeds normally when the bucket already exists.
  • Non-409 errors (e.g. 403 Forbidden) continue to fail as expected.

Testing

  • Unit Tests: Updated BigQuerySourceUtilsTest following Google Unit Testing Best Practices (AAA pattern, methodName_stateUnderTest_expectedBehavior, and Assert.assertThrows).
    • getOrCreateBucket_nullBucketConflict409_returnsBucketAndEnablesDelete: Verifies 409 retry response returns the bucket and keeps delete enabled.
    • getOrCreateBucket_nullBucketNon409Error_throwsProgramFailureException: Verifies non-409 exceptions are properly propagated.
  • Validated end-to-end on CDAP instance with pipeline bq-409-conflict-resolution (completed successfully).
image

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

Copy link
Copy Markdown

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 refactors the bucket creation logic in BigQuerySourceUtils by extracting it into a reusable private helper method createBucket. This helper centralizes the handling of StorageException (specifically 409 conflicts) and safely handles potential null values for the dataset ID. Additionally, comprehensive unit tests have been added in BigQuerySourceUtilsTest to cover various success and failure scenarios during bucket creation. I have no feedback to provide as the changes are well-structured and properly tested.

@vikasrathee-cs vikasrathee-cs added the build Trigger unit test build label Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Trigger unit test build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants