Skip to content

feat(spanner): add a priority setter to BatchDmlBuilder#6047

Merged
olavloite merged 3 commits into
googleapis:mainfrom
fornwall:up-4-batch-dml-priority
Jul 17, 2026
Merged

feat(spanner): add a priority setter to BatchDmlBuilder#6047
olavloite merged 3 commits into
googleapis:mainfrom
fornwall:up-4-batch-dml-priority

Conversation

@fornwall

Copy link
Copy Markdown
Contributor

ExecuteBatchDmlRequest.request_options carries an RPC priority, and BatchDmlBuilder already stores Option<RequestOptions> (populated by set_request_tag), but there was no way to set the priority on a batch DML request.

Add BatchDmlBuilder::set_priority, mirroring StatementBuilder::set_priority, so callers can apply a request priority to the ExecuteBatchDml RPC.

@fornwall
fornwall requested review from a team as code owners July 14, 2026 12:48
@product-auto-label product-auto-label Bot added the api: spanner Issues related to the Spanner API. label Jul 14, 2026
@fornwall
fornwall force-pushed the up-4-batch-dml-priority branch from 5d4df12 to 5242419 Compare July 14, 2026 12:49

@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 set_priority method to BatchDmlBuilder in src/spanner/src/batch_dml.rs to allow setting the RPC priority for batch DML requests, along with a corresponding unit test. The reviewer suggested adding a doctest example to the new public method to align with the repository style guide and maintain consistency with other builder methods.

Comment thread src/spanner/src/batch_dml.rs
ExecuteBatchDmlRequest.request_options carries an RPC priority, and
BatchDmlBuilder already stores Option<RequestOptions> (populated by
set_request_tag), but there was no way to set the priority on a batch
DML request. Add BatchDmlBuilder::set_priority, mirroring
StatementBuilder::set_priority, so callers can apply a request
priority to the ExecuteBatchDml RPC.

Signed-off-by: Fredrik Fornwall <fredrik@fornwall.net>
@fornwall
fornwall force-pushed the up-4-batch-dml-priority branch from 5242419 to 08f901e Compare July 14, 2026 12:52
@olavloite

Copy link
Copy Markdown
Contributor

/gcbrun

@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.02%. Comparing base (e0ead5f) to head (11b58e9).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6047   +/-   ##
=======================================
  Coverage   97.02%   97.02%           
=======================================
  Files         253      253           
  Lines       63547    63565   +18     
=======================================
+ Hits        61655    61673   +18     
  Misses       1892     1892           

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

@olavloite
olavloite merged commit 76d03e4 into googleapis:main Jul 17, 2026
41 of 42 checks passed
fornwall added a commit to fornwall/adbc-spanner that referenced this pull request Jul 17, 2026
…, UP-5, SPAN-8) (#355)

Two upstream asks landed in google-cloud-rust, so bump the family pin to
`5c1fe131` (main) and adopt both:

- UP-4 / googleapis/google-cloud-rust#6047 added `BatchDmlBuilder::set_priority`.
  `RequestConfig::apply_to_batch_dml` now applies the priority alongside the
  request tag, so `spanner.request.priority` reaches the `ExecuteBatchDml` RPC
  that carries every plain autocommit DML statement — previously the batch went
  out `PRIORITY_UNSPECIFIED` while only its commit honoured the caller's choice.
  That closes SPAN-8, which existed solely as the driver-side record of the gap.

- UP-5 / googleapis/google-cloud-rust#6073 added `set_priority`,
  `set_transaction_tag` and `set_exclude_txn_from_change_streams` to
  `BatchWriteTransactionBuilder`. The new `RequestConfig::apply_to_batch_write`
  applies the first two to the `spanner.ingest.batch_write` firehose path.
  `spanner.request.tag` stays off it deliberately — Spanner ignores per-request
  tags on BatchWrite, which is why the builder exposes no setter for it — and
  `max_commit_delay` / `commit_stats` still do not apply, since BatchWrite
  carries no per-request commit options. `exclude_txn_from_change_streams` stays
  unexposed: it is the SPAN-9 wishlist option, now unblocked.

Two wire tests in `tests/mock_spanner.rs` pin the request options as sent,
including the BatchWrite request-tag negative; both were checked non-vacuous by
reverting the wiring. Docs updated where they recorded the old limitations
(`src/request.rs` module doc, `OPTION_INGEST_BATCH_WRITE`, docs/options.md,
README.md, CLAUDE.md).

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: spanner Issues related to the Spanner API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants