Skip to content

impl(bigquery): introduce stream dispatcher - #6743

Open
dbolduc wants to merge 3 commits into
googleapis:mainfrom
dbolduc:impl-bq-dispatcher
Open

impl(bigquery): introduce stream dispatcher#6743
dbolduc wants to merge 3 commits into
googleapis:mainfrom
dbolduc:impl-bq-dispatcher

Conversation

@dbolduc

@dbolduc dbolduc commented Sep 8, 2026

Copy link
Copy Markdown
Member

Add a type that handles interactions with the stream pool. Eventually it will handle retries for individual writes.

It caches the StreamEntry (basically a handle on a gRPC stream) so that pool resizing is independent of writing on valid streams.

Eventually, we can even rebalance writers to other streams by swapping out the Dispatcher's ArcSwap<StreamEntry> also without slowing down the hot path.

Towards #5831

@product-auto-label product-auto-label Bot added the api: bigquery Issues related to the BigQuery API. label Sep 8, 2026

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

Copy link
Copy Markdown
Contributor

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 introduces a new Dispatcher struct in the BigQuery write module to efficiently dispatch writes to a stream pool using arc-swap for atomic stream loading and replacement on transient errors. The feedback suggests replacing the deprecated compare_and_swap method with compare_exchange to avoid deprecation warnings, and proactively evicting closed streams during stream selection to optimize the recovery process.

Comment thread src/bigquery/src/write/dispatcher.rs
Comment thread src/bigquery/src/write/dispatcher.rs
@codecov

codecov Bot commented Sep 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.95%. Comparing base (66a179e) to head (b4f03c9).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6743      +/-   ##
==========================================
+ Coverage   96.89%   96.95%   +0.06%     
==========================================
  Files         319      320       +1     
  Lines      105574   105722     +148     
==========================================
+ Hits       102292   102506     +214     
+ Misses       3282     3216      -66     

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

@dbolduc
dbolduc marked this pull request as ready for review September 9, 2026 16:16
@dbolduc
dbolduc requested a review from a team as a code owner September 9, 2026 16:16
Comment thread src/bigquery/src/write/dispatcher.rs Outdated
Comment thread src/bigquery/src/write/dispatcher.rs
Comment thread src/bigquery/src/write/dispatcher.rs Outdated
Comment thread src/bigquery/src/write/dispatcher.rs Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: bigquery Issues related to the BigQuery API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants