Skip to content

release-25.3.1-rc: kvcoord: fix txnWriteBuffer for batches with limits and Dels #151901

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: release-25.3.1-rc
Choose a base branch
from

Conversation

yuzefovich
Copy link
Member

@yuzefovich yuzefovich commented Aug 14, 2025

Backport 1/1 commits from #151559 on behalf of @yuzefovich.


Previously, the txnWriteBuffer was oblivious to the fact that some transformed requests might be returned incomplete due to limits set on the BatchRequest (either TargetBytes or MaxSpanRequestKeys), so it would incorrectly think that it has acquired locks on some keys when it hasn't. Usage from SQL was only exposed to the bug via special delete-range fast-path where we used point Dels (i.e. a stmt of the form DELETE FROM t WHERE k IN (<ids>) where there are gaps between ids) since it always sets a key limit of 600. This commit fixes this particular issue for Dels transformed into Gets and adds a couple of assertions that we don't see batches with CPuts and/or Puts with the limits set.

Additionally, it adjusts the comment to indicate which requests are allowed in batches with limits.

Given that this feature is disabled by default and in the private preview AND it's limited to the DELETE fast-path when more than 600 keys are deleted, I decided to omit the release note.

Fixes: #151294.
Fixes: #151649.

Release note: None


Release justification: low-risk bug fix to a new feature.

Previously, the txnWriteBuffer was oblivious to the fact that some
transformed requests might be returned incomplete due to limits set on
the BatchRequest (either TargetBytes or MaxSpanRequestKeys), so it would
incorrectly think that it has acquired locks on some keys when it
hasn't. Usage from SQL was only exposed to the bug via special delete-range
fast-path where we used point Dels (i.e. a stmt of the form
`DELETE FROM t WHERE k IN (<ids>)` where there are gaps between `id`s)
since it always sets a key limit of 600. This commit fixes this
particular issue for Dels transformed into Gets and adds a couple of
assertions that we don't see batches with CPuts and/or Puts with the
limits set.

Additionally, it adjusts the comment to indicate which requests are
allowed in batches with limits.

Given that this feature is disabled by default and in the private
preview AND it's limited to the DELETE fast-path when more than 600 keys
are deleted, I decided to omit the release note.

Release note: None
@yuzefovich yuzefovich requested a review from a team as a code owner August 14, 2025 22:42
@blathers-crl blathers-crl bot added blathers-backport This is a backport that Blathers created automatically. O-robot Originated from a bot. labels Aug 14, 2025
Copy link

blathers-crl bot commented Aug 14, 2025

Thanks for opening a backport.

Before merging, please confirm that the change does not break backwards compatibility and otherwise complies with the backport policy. Include a brief release justification in the PR description explaining why the backport is appropriate. All backports must be reviewed by the TL for the owning area. While the stricter LTS policy does not yet apply, please exercise judgment and consider gating non-critical changes behind a disabled-by-default feature flag when appropriate.

@blathers-crl blathers-crl bot added backport Label PR's that are backports to older release branches T-sql-queries SQL Queries Team labels Aug 14, 2025
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport Label PR's that are backports to older release branches blathers-backport This is a backport that Blathers created automatically. O-robot Originated from a bot. T-sql-queries SQL Queries Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants