Skip to content

Fix table.Session.Execute ignoring options.WithCommit()#2091

Merged
asmyasnikov merged 3 commits into
masterfrom
withCommit_fix
Apr 22, 2026
Merged

Fix table.Session.Execute ignoring options.WithCommit()#2091
asmyasnikov merged 3 commits into
masterfrom
withCommit_fix

Conversation

@kprokopenko

@kprokopenko kprokopenko commented Apr 22, 2026

Copy link
Copy Markdown
Collaborator

Pull request type

  • Bugfix

What is the current behavior?

tableClientExecutor.execute unconditionally overwrote request.TxControl with the txControl argument after ExecuteDataQueryOptions had already been applied to the request. This silently dropped the CommitTx=true flag that options.WithCommit() sets on the request, so transactions opened via table.BeginTx(...) remained uncommitted when WithCommit was passed to Execute.

Issue: repro added in #2089.

What is the new behavior?

  • Removed the stray request.TxControl = txControl.ToYdbTableTransactionControl() assignment in tableClientExecutor.execute so the TxControl built by Session.Execute (including ExecuteDataQueryOption mutations such as options.WithCommit()) is sent to the server as-is.
  • Renamed the now-unused txControl parameter to _ — it is still required by the dataQueryExecutor interface used by the query-service executor.
  • Extended TestTableTxControl with a write-with-commit subtest that opens a transaction with BeginTx, upserts a row using options.WithCommit(), then re-reads the row in an independent DefaultTxControl transaction to verify it was actually committed.

Other information

Git-bisect traced the regression to commit afdce85 ("replaced table transaction control types to internal/tx control").

Made with Cursor

The tableClientExecutor.execute unconditionally overwrote request.TxControl
with the txControl parameter after options (including options.WithCommit)
had already been applied to the request, silently dropping the CommitTx=true
flag set by WithCommit. This caused transactions opened with BeginTx to stay
uncommitted when WithCommit was used on the Execute call.

Drop the redundant assignment so modifications made by ExecuteDataQueryOption
options are preserved. Extend the table_tx_control integration test with a
write-with-commit scenario that upserts a row via WithCommit and asserts it is
visible in a subsequent read.

Made-with: Cursor
@github-actions

Copy link
Copy Markdown

summary

Inferred base version: v3.134.1
Suggested version: v3.134.2

@codecov-commenter

codecov-commenter commented Apr 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.43%. Comparing base (66fc52e) to head (5988ae7).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2091      +/-   ##
==========================================
- Coverage   74.66%   74.43%   -0.24%     
==========================================
  Files         427      427              
  Lines       44011    44009       -2     
==========================================
- Hits        32863    32760     -103     
- Misses       9978    10061      +83     
- Partials     1170     1188      +18     
Flag Coverage Δ
experiment 74.24% <ø> (-0.15%) ⬇️
go-1.21.x 71.95% <ø> (-0.26%) ⬇️
go-1.26.x 74.40% <ø> (-0.18%) ⬇️
integration 55.89% <ø> (-0.57%) ⬇️
macOS 46.12% <ø> (-0.03%) ⬇️
ubuntu 74.43% <ø> (-0.24%) ⬇️
unit 46.13% <ø> (-0.05%) ⬇️
windows 46.11% <ø> (-0.03%) ⬇️
ydb-24.4 55.43% <ø> (-0.28%) ⬇️
ydb-edge 55.69% <ø> (-0.54%) ⬇️
ydb-latest 55.55% <ø> (-0.53%) ⬇️
ydb-nightly 74.24% <ø> (-0.15%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 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.

Copilot AI 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.

Pull request overview

Fixes a regression where table.Session.Execute could silently drop options.WithCommit() by overwriting request.TxControl after options had already mutated it.

Changes:

  • Removed the redundant request.TxControl = ... assignment in tableClientExecutor.execute so option-mutated TxControl is preserved.
  • Renamed the now-unused txControl parameter to _ to keep the dataQueryExecutor interface unchanged.
  • Added an integration subtest intended to verify that options.WithCommit() actually commits a BeginTx transaction.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
internal/table/session.go Stops clobbering ExecuteDataQueryRequest.TxControl so WithCommit() is honored.
tests/integration/table_tx_control_test.go Adds an integration repro/verification for committing via options.WithCommit() on tx.Execute.
CHANGELOG.md Documents the bugfix for end users at the top of the changelog.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/integration/table_tx_control_test.go
@github-actions

Copy link
Copy Markdown

🌋 SLO Test Results

🟡 8 workload(s) tested — 1 workload(s) exceeded warning thresholds

Commit: f0286a4 · View run

Workload Thresholds Duration Report
native-table-node-hints 🟢 OK 10m 10s 📄 Report
native-query 🟢 OK 10m 1s 📄 Report
native-table 🟢 OK 10m 1s 📄 Report
native-bulk-upsert 🟢 OK 10m 1s 📄 Report
database-sql-table 🟢 OK 10m 1s 📄 Report
native-table-over-query-service 🟢 OK 10m 1s 📄 Report
database-sql-query 🟡 Warning 10m 1s 📄 Report
native-query-node-hints 🟢 OK 0s 📄 Report

Threshold violations:

database-sql-query:

  • read_retry_attempts: Value 0.01 > warning max 0

Generated by ydb-slo-action

@github-actions github-actions Bot removed the SLO label Apr 22, 2026
@asmyasnikov asmyasnikov merged commit 25dcff4 into master Apr 22, 2026
74 of 78 checks passed
@asmyasnikov asmyasnikov deleted the withCommit_fix branch April 22, 2026 15:17
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.

4 participants