Skip to content

feat: add and register bq stream v2 async destination manager - #7057

Merged
achettyiitr merged 10 commits into
masterfrom
feat.bqstreamv2-2-async-manager
Jun 12, 2026
Merged

achettyiitr merged 10 commits into
masterfrom
feat.bqstreamv2-2-async-manager

Conversation

@achettyiitr

@achettyiitr achettyiitr commented Jun 5, 2026 •

Copy link
Copy Markdown
Member

Description

PR 2/3 of the BQSTREAM_V2 stack (splits #7019). Stacked on #.

Implements the Manager upload orchestration on top of the building blocks from PR 1, and wires it up:

Upload orchestration

  • Transform using common.GetMarshalledData(string(job.EventPayload), job.JobID).
  • Upload flow: reads the async file, groups and chunks events (helpers from PR 1), and processes tables with bounded concurrency.
  • Schema lifecycle via the warehouse BigQuery manager (FetchSchema, CreateSchema, CreateTable, AddColumns), including dataset-not-found create-and-retry handling and schema caching.
  • Discard-path writes to rudder_discards; appends encoded rows through cached per-table Storage Write API writers.
  • Append error classification into failed vs aborted job IDs; schema cache/writer invalidation on failures.
  • Unit tests for the full upload flow (31 scenarios).

Registration

  • Registered BQSTREAM_V2 in the async destination manager factory via common.SimpleAsyncDestinationManager.
  • Added BQSTREAM_V2 to the async destinations whitelist and misc.BatchDestinations().
  • Registration unit test and README entry.

This PR turns the feature on for configured destinations. ~65% of the diff is unit tests.

Stack: PR 1 (enablement + building blocks) → PR 2 (this) → PR 3 (integration tests)

Linear Ticket

  • Resolves INT-6410

Security

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

Validation

  • go test ./router/batchrouter/asyncdestinationmanager/bqstreamv2/...
  • go test ./router/batchrouter -run Async -count=1

@codecov

codecov Bot commented Jun 5, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.78199% with 60 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.44%. Comparing base (dc071cd) to head (8b25067).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...r/asyncdestinationmanager/bqstreamv2/bqstreamv2.go 86.35% 36 Missing and 10 partials ⚠️
.../asyncdestinationmanager/bqstreamv2/integration.go 88.23% 3 Missing and 3 partials ⚠️
...outer/asyncdestinationmanager/bqstreamv2/events.go 0.00% 4 Missing ⚠️
...asyncdestinationmanager/bqstreamv2/streamwriter.go 83.33% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7057      +/-   ##
==========================================
+ Coverage   79.37%   79.44%   +0.07%     
==========================================
  Files         581      583       +2     
  Lines       64644    65061     +417     
==========================================
+ Hits        51311    51690     +379     
- Misses      10274    10291      +17     
- Partials     3059     3080      +21     

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

@achettyiitr
achettyiitr force-pushed the feat.bqstreamv2-2-async-manager branch from bdeb22c to f0007e8 Compare June 5, 2026 17:05
@achettyiitr
achettyiitr force-pushed the feat.bqstreamv2-1-destination-enablement branch from 99b7d1c to 0153a25 Compare June 5, 2026 17:05
@achettyiitr
achettyiitr force-pushed the feat.bqstreamv2-1-destination-enablement branch from 0153a25 to 7389a84 Compare June 9, 2026 06:00
Base automatically changed from feat.bqstreamv2-1-destination-enablement to master June 9, 2026 10:48
Akash Chetty added 4 commits June 9, 2026 16:18
Add the BQSTREAM_V2 destination constant and enable warehouse-side
support: route it to the BigQuery warehouse manager, treat it as a
pseudo-warehouse destination, and add embedded warehouse transformer
support (loaded_at column, JSON paths, users-table skip, reserved
keywords).
Add the building blocks for the upcoming BQSTREAM_V2 async destination
manager: package types and destination config decoding, BigQuery data
type mapping, an in-memory table schema cache with TTL, and the
Storage Write API managed-writer wrapper.

No production code path reaches this package yet; the upload pipeline
and registration land in the next PRs of the stack.
Add the remaining building blocks of the BQSTREAM_V2 manager:

- event parsing from async files, per-table grouping and size-bounded
  chunking, and event-schema derivation
- discard extraction for schema-mismatched values and duplicate ID
  detection
- dynamic protobuf row encoding with numeric/timestamp coercion, plus
  an equivalence test against the protojson path and benchmarks
- schema diffing (findNewColumns) and BigQuery error classification

The Manager upload orchestration that ties these together lands in the
next PR of the stack.
Implement the Manager upload flow on top of the helpers from the
previous PRs and wire it up:

- Upload pipeline: reads the async file, groups and chunks events,
  reconciles table schemas via the warehouse BigQuery manager
  (FetchSchema, CreateSchema, CreateTable, AddColumns) with
  dataset-not-found create-and-retry handling, writes discards to
  rudder_discards, and appends encoded rows through cached per-table
  Storage Write API writers with bounded table concurrency
- append error classification into failed vs aborted job IDs and
  schema cache/writer invalidation on failures
- unit tests for the full upload flow
- registration: BQSTREAM_V2 in the async destination manager factory,
  async/batch destination whitelists, registration test, README entry
@achettyiitr
achettyiitr force-pushed the feat.bqstreamv2-2-async-manager branch 3 times, most recently from 5e19433 to d852591 Compare June 9, 2026 12:05
@achettyiitr achettyiitr changed the title feat: add and register BQSTREAM_V2 async destination manager feat: add and register bq stream vs async destination manager Jun 9, 2026
@achettyiitr achettyiitr changed the title feat: add and register bq stream vs async destination manager feat: add and register bq stream v2 async destination manager Jun 9, 2026
@achettyiitr
achettyiitr force-pushed the feat.bqstreamv2-2-async-manager branch from d852591 to 3dc5119 Compare June 9, 2026 15:02
🔒 Scanned for secrets using gitleaks 8.29.1
@achettyiitr
achettyiitr force-pushed the feat.bqstreamv2-2-async-manager branch from 3dc5119 to 9b2a002 Compare June 9, 2026 19:59

@shekhar-rudder shekhar-rudder left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Independent code review focused on correctness, concurrency, and the registration wiring, plus a few notes raised during review. The concurrency design in bqstreamv2.go is carefully done; the findings below are a mix of one correctness bug (per-table abort classification), a misleading error message, a stream-writer lifecycle leak, and several maintainability/consistency suggestions. Review-only — no code changes.

Comment thread utils/misc/misc.go Resolved
@achettyiitr
achettyiitr force-pushed the feat.bqstreamv2-2-async-manager branch from 25471c7 to 6020691 Compare June 10, 2026 12:19
🔒 Scanned for secrets using gitleaks 8.29.1
@achettyiitr
achettyiitr force-pushed the feat.bqstreamv2-2-async-manager branch 2 times, most recently from f46bcf6 to 184fd55 Compare June 10, 2026 14:21
…mv2-2-async-manager

🔒 Scanned for secrets using gitleaks 8.29.1
@achettyiitr
achettyiitr force-pushed the feat.bqstreamv2-2-async-manager branch from 184fd55 to 503421a Compare June 10, 2026 17:44
…mv2-2-async-manager

🔒 Scanned for secrets using gitleaks 8.29.1

@shekhar-rudder shekhar-rudder left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Review of the BQSTREAM_V2 async manager. One likely resource leak (racing discards stream writer), one misleading log message, and one stale doc comment about pipelining. Test coverage looks thorough.

🔒 Scanned for secrets using gitleaks 8.29.1
🔒 Scanned for secrets using gitleaks 8.29.1
@achettyiitr
achettyiitr merged commit 787b7ac into master Jun 12, 2026
73 checks passed
@achettyiitr
achettyiitr deleted the feat.bqstreamv2-2-async-manager branch June 12, 2026 03:33
atzoum pushed a commit that referenced this pull request Jun 23, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.78.0-rc.1](v1.77.0...v1.78.0-rc.1)
(2026-06-22)


### Features

* add and register bq stream v2 async destination manager
([#7057](#7057))
([787b7ac](787b7ac))
* add BQSTREAM_V2 destination type and bqstreamv2 building blocks
([#7056](#7056))
([02e84e5](02e84e5))
* **batchrouter:** raise getImportingJobs max iterations and remove
payload size limit
([#7076](#7076))
([15707f6](15707f6))
* **gateway:** throttling support for internal batch endpoint
([#7055](#7055))
([6b6ba65](6b6ba65))
* **jobsdb:** introduce compaction min ds age
([#7077](#7077))
([4d6d97a](4d6d97a))
* **processor:** new intermediate jobsdb
([#7048](#7048))
([dfef1f1](dfef1f1))


### Bug Fixes

* abort non-retryable Klaviyo upload errors instead of retrying
([#7085](#7085))
([4c3e4f1](4c3e4f1))
* **batchrouter:** correlate poll results by externalId instead of
whole-row hash
([09326d2](09326d2))
* **batchrouter:** report real status code and sample event for drained
jobs ([#7104](#7104))
([d3fab82](d3fab82))
* internal endpoints enabled in open source version of rudder-server
([#7075](#7075))
([dc071cd](dc071cd))
* **jobsdb:** get jobs lateral join against the v_last view
([#7105](#7105))
([853d14c](853d14c))
* klaviyo upload partial failures
([#7107](#7107))
([37e79e9](37e79e9))
* **router:** shared barrier causing illegal job sequence errors
([#7101](#7101))
([b5435ba](b5435ba))


### Miscellaneous

* add BQSTREAM_V2 integration tests
([#7058](#7058))
([478e217](478e217))
* add rudderai announcement
([#7046](#7046))
([ff02fe8](ff02fe8))
* bump codecov-action to 7.0.0
([#7070](#7070))
([31f0623](31f0623))
* cleanup embedded warehouse transformations
([#7072](#7072))
([31f0623](31f0623))
* **deps:** bump actions/checkout from 6.0.2 to 6.0.3
([#7084](#7084))
([745d5ab](745d5ab))
* **deps:** bump aws-actions/configure-aws-credentials from 6.1.2 to
6.2.0 ([#7081](#7081))
([19251cd](19251cd))
* **jobsdb:** refactoring and cleanup
([#7043](#7043))
([2e4ea92](2e4ea92))
* remove legacy warehouse endpoints
([#7090](#7090))
([6f85153](6f85153))
* rename bqstream all events
([#7088](#7088))
([4d9ad19](4d9ad19))
* **router:** rename experimental buffer size calculator to dynamic
([#7103](#7103))
([52896cd](52896cd))
* support using the full event schema key as pulsar ordering key
([#7086](#7086))
([ff50611](ff50611))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
atzoum pushed a commit that referenced this pull request Jun 23, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.78.0](v1.77.0...v1.78.0)
(2026-06-22)


### Features

* add and register bq stream v2 async destination manager
([#7057](#7057))
([787b7ac](787b7ac))
* add BQSTREAM_V2 destination type and bqstreamv2 building blocks
([#7056](#7056))
([02e84e5](02e84e5))
* **batchrouter:** raise getImportingJobs max iterations and remove
payload size limit
([#7076](#7076))
([15707f6](15707f6))
* **gateway:** throttling support for internal batch endpoint
([#7055](#7055))
([6b6ba65](6b6ba65))
* **jobsdb:** introduce compaction min ds age
([#7077](#7077))
([4d6d97a](4d6d97a))
* **processor:** new intermediate jobsdb
([#7048](#7048))
([dfef1f1](dfef1f1))


### Bug Fixes

* abort non-retryable Klaviyo upload errors instead of retrying
([#7085](#7085))
([4c3e4f1](4c3e4f1))
* **batchrouter:** correlate poll results by externalId instead of
whole-row hash
([09326d2](09326d2))
* **batchrouter:** report real status code and sample event for drained
jobs ([#7104](#7104))
([d3fab82](d3fab82))
* internal endpoints enabled in open source version of rudder-server
([#7075](#7075))
([dc071cd](dc071cd))
* **jobsdb:** get jobs lateral join against the v_last view
([#7105](#7105))
([853d14c](853d14c))
* klaviyo upload partial failures
([#7107](#7107))
([37e79e9](37e79e9))
* **router:** shared barrier causing illegal job sequence errors
([#7101](#7101))
([b5435ba](b5435ba))


### Miscellaneous

* add BQSTREAM_V2 integration tests
([#7058](#7058))
([478e217](478e217))
* add rudderai announcement
([#7046](#7046))
([ff02fe8](ff02fe8))
* bump codecov-action to 7.0.0
([#7070](#7070))
([31f0623](31f0623))
* cleanup embedded warehouse transformations
([#7072](#7072))
([31f0623](31f0623))
* **deps:** bump actions/checkout from 6.0.2 to 6.0.3
([#7084](#7084))
([745d5ab](745d5ab))
* **deps:** bump aws-actions/configure-aws-credentials from 6.1.2 to
6.2.0 ([#7081](#7081))
([19251cd](19251cd))
* **jobsdb:** refactoring and cleanup
([#7043](#7043))
([2e4ea92](2e4ea92))
* remove legacy warehouse endpoints
([#7090](#7090))
([6f85153](6f85153))
* rename bqstream all events
([#7088](#7088))
([4d9ad19](4d9ad19))
* **router:** rename experimental buffer size calculator to dynamic
([#7103](#7103))
([52896cd](52896cd))
* support using the full event schema key as pulsar ordering key
([#7086](#7086))
([ff50611](ff50611))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
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.

3 participants