Skip to content

Prevent MERGE replay after ambiguous commit - #256

Closed
KirillKurdyukov wants to merge 1 commit into
ydb-platform:mainfrom
KirillKurdyukov:codex/m01-merge-commit-no-replay
Closed

Prevent MERGE replay after ambiguous commit#256
KirillKurdyukov wants to merge 1 commit into
ydb-platform:mainfrom
KirillKurdyukov:codex/m01-merge-commit-no-replay

Conversation

@KirillKurdyukov

Copy link
Copy Markdown
Collaborator

Pull request type

  • Bug fix

What is the current behavior?

If Connection.commit() throws a normally retryable YDB error, YdbMergeSink treats the transaction as uncommitted and can replay the buffered MERGE on a new connection even though the commit outcome is ambiguous.

What is the new behavior?

  • Mark the commit boundary immediately before invoking Connection.commit().
  • Never replay a MERGE after commit has been invoked, regardless of retry classification.
  • Preserve the original SQL exception as the cause of the unknown-outcome error.
  • Add one focused fault-injection unit test that executes a batch, throws retryable ABORTED from commit, and verifies one connection, batch execution, and commit invocation.

Validation

  • JDK 25 compile passed: mvn -f ydb-trino-adapter/pom.xml -DskipTests compile.
  • Focused unit passed: mvn -f ydb-trino-adapter/pom.xml -Dtest=TestYdbMergeSink test — 1 run, 0 failures, 0 errors, 0 skipped.
  • Independent review found no findings on head 599332520f9ec08edf57634fa18266a1c3fda83a.
  • Local Docker-backed inherited testMerge*, smoke testMerge, and full suite were not run because the existing Colima runtime is broken (colima status: error retrieving current runtime: empty value; Docker socket unavailable). The full GitHub Actions suite is required for this PR.

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.

1 participant