Skip to content

Conversation

@nishantsharma
Copy link

Description

BQ with Profiles often faces rate limit errors and too many table update errors. This is an update to retry in certain conditions.

Linear Ticket

https://linear.app/rudderstack/issue/PRO-5029/parent-fix-bq-issues

Security

  • The code changed/added as part of this pull request won't create any security issues with how the software is being used.

…query hangs

Add MaxRetries and MaxRetryDuration configuration options for BigQuery
connections. The timeout is enforced via context.WithTimeout() which
limits total query execution time including BigQuery's internal retries.

This solves the issue where queries could hang indefinitely (3+ hours in CI)
when BigQuery's internal retry logic encountered retryable errors like 503
or network issues.

Configuration example:
  {
    "maxRetries": 16,          // advisory, for documentation
    "maxRetryDuration": "10m"  // enforced via context timeout
  }

🔒 Scanned for secrets using gitleaks 8.28.0
BigQuery returns "too many table update operations" as HTTP 400 +
invalidQuery, which the google-cloud-go client does NOT automatically
retry. This adds:

- Type-safe error detection (errors.As + googleapi.Error fields)
- Application-level retry with exponential backoff (1s→32s, 2x multiplier)
- Configurable MaxRetries and MaxRetryDuration
- Jitter to prevent thundering herd

Distinguishes rate limit errors from actual syntax errors by checking
both the structured Reason field AND the Message content (unavoidable
given BigQuery's API design).

🔒 Scanned for secrets using gitleaks 8.28.0
🔒 Scanned for secrets using gitleaks 8.28.0
🔒 Scanned for secrets using gitleaks 8.28.0
…ogle-cloud-go

🔒 Scanned for secrets using gitleaks 8.28.0
- Updated replace directives to use git tags
- cloud.google.com/go => v0.123.0-rudder.2
- cloud.google.com/go/bigquery => v1.69.0-rudder.1
- connector.go passes WithMaxRetries to BQ client

🔒 Scanned for secrets using gitleaks 8.28.0
🔒 Scanned for secrets using gitleaks 8.28.0

// Retry configuration for BigQuery API calls
// MaxRetries limits the number of retry attempts (default: unlimited if not set)
MaxRetries *int `json:"maxRetries,omitempty"`
Copy link
Author

@nishantsharma nishantsharma Jan 14, 2026

Choose a reason for hiding this comment

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

Split MaxRetries into MaxRetriesDriver, MaxRetriesWrapper.

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.

2 participants