Skip to content

Conversation

@yuzefovich
Copy link
Member

Currently, we have an issue with COPY FROM command if it runs within the txn which had just been rolled back to a savepoint - we'd hit an assertion error in the KV layer. This commit fixes the oversight by stepping the txn, similar to what we do on the main query path.

Additionally, this commit explicitly prohibits running COPY FROM via the internal executor (previously it could lead to undefined behavior or internal errors) and adds a test with savepoints for COPY TO (which works because it uses different execution machinery than COPY FROM).

Fixes: #144383.

Release note (bug fix): Previously, CockroachDB could encounter an internal error when evaluating COPY FROM command in a transaction after it's been rolled back to a savepoint. The bug has been present since before 23.2 version and is now fixed.

@yuzefovich yuzefovich requested a review from a team as a code owner November 5, 2025 20:12
@yuzefovich yuzefovich added backport-25.3.x Flags PRs that need to be backported to 25.3 backport-25.4.x Flags PRs that need to be backported to 25.4 labels Nov 5, 2025
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Currently, we have an issue with COPY FROM command if it runs within the
txn which had just been rolled back to a savepoint - we'd hit an
assertion error in the KV layer. This commit fixes the oversight by
stepping the txn, similar to what we do on the main query path.

Additionally, this commit explicitly prohibits running COPY FROM via the
internal executor (previously it could lead to undefined behavior or
internal errors) and adds a test with savepoints for COPY TO (which
works because it uses different execution machinery than COPY FROM).

Release note (bug fix): Previously, CockroachDB could encounter an
internal error when evaluating COPY FROM command in a transaction after
it's been rolled back to a savepoint. The bug has been present since
before 23.2 version and is now fixed.
Copy link
Collaborator

@michae2 michae2 left a comment

Choose a reason for hiding this comment

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

:lgtm: Nice fix!

@michae2 reviewed 5 of 5 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @DrewKimball)

@yuzefovich
Copy link
Member Author

TFTR!

bors r+

@craig
Copy link
Contributor

craig bot commented Nov 7, 2025

@craig craig bot merged commit c482610 into cockroachdb:master Nov 7, 2025
23 of 24 checks passed
@blathers-crl
Copy link

blathers-crl bot commented Nov 7, 2025

Based on the specified backports for this PR, I applied new labels to the following linked issue(s). Please adjust the labels as needed to match the branches actually affected by the issue(s), including adding any known older branches.


Issue #144383: branch-release-25.3, branch-release-25.4.


🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@blathers-crl
Copy link

blathers-crl bot commented Nov 7, 2025

Encountered an error creating backports. Some common things that can go wrong:

  1. The backport branch might have already existed.
  2. There was a merge conflict.
  3. The backport branch contained merge commits.

You might need to create your backport manually using the backport tool.


error creating merge commit from b320b51 to blathers/backport-release-25.3-156959: POST https://api.github.com/repos/yuzefovich/cockroach/merges: 409 Merge conflict []

you may need to manually resolve merge conflicts with the backport tool.

Backport to branch 25.3.x failed. See errors above.


🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@yuzefovich yuzefovich deleted the fix-copy-step branch November 7, 2025 02:04
@yuzefovich
Copy link
Member Author

blathers backport release-25.3

@blathers-crl
Copy link

blathers-crl bot commented Nov 7, 2025

Encountered an error creating backports. Some common things that can go wrong:

  1. The backport branch might have already existed.
  2. There was a merge conflict.
  3. The backport branch contained merge commits.

You might need to create your backport manually using the backport tool.


error creating merge commit from b320b51 to blathers/backport-release-25.3-156959: POST https://api.github.com/repos/yuzefovich/cockroach/merges: 409 Merge conflict []

you may need to manually resolve merge conflicts with the backport tool.

Backport to branch release-25.3 failed. See errors above.


🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-25.3.x Flags PRs that need to be backported to 25.3 backport-25.4.x Flags PRs that need to be backported to 25.4 backport-failed target-release-26.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

copy: v24.3.7: read sequence number 0 but sequence number is ignored [{0 0}] after savepoint rollback

3 participants