Skip to content

[馃崚] Ignore 409 Conflict on bucket creation retry in BigQuery plugin for release/0.24 - #1625

Open
vishwasvaidya-cloudsufi wants to merge 1 commit into
data-integrations:release/0.24from
cloudsufi:ignore-409-conflict-cherrypick-0.24
Open

[馃崚] Ignore 409 Conflict on bucket creation retry in BigQuery plugin for release/0.24#1625
vishwasvaidya-cloudsufi wants to merge 1 commit into
data-integrations:release/0.24from
cloudsufi:ignore-409-conflict-cherrypick-0.24

Conversation

@vishwasvaidya-cloudsufi

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

Copy link
Copy Markdown
Contributor

[馃崚]

馃崚 cherrypick

PR : (#1624)

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).

@vishwasvaidya-cloudsufi
vishwasvaidya-cloudsufi force-pushed the ignore-409-conflict-cherrypick-0.24 branch from 2eeb02d to f5aacbd Compare September 11, 2026 13:28

@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 private helper method, adding null-safety checks for the dataset ID, and introducing debug logging for 409 conflicts. It also adds corresponding unit tests to cover 409 conflict and non-409 error scenarios. The review feedback suggests replacing the magic number 409 with HttpURLConnection.HTTP_CONFLICT for better readability, and adding an additional unit test to cover the 409 conflict scenario when a user-provided bucket name is used.

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.

1 participant