-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
release-25.1: sql: concurrent DML can prevent PK swaps from succeeding #141383
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72eb3f3
to
91d29fa
Compare
Thanks for opening a backport. Please check the backport criteria before merging:
If your backport adds new functionality, please ensure that the following additional criteria are satisfied:
Also, please add a brief release justification to the body of your PR to justify this |
Previously, we added an optimization to skip re-resolving object metadata if no leased descriptors had changed. This change also leased descriptors to ensure schema changes couldn't progress, as otherwise we could corrupt data by writing incompatible information. While this resolved most failures associated with concurrent DML/DDL execution by leasing required descriptors, intermittent failures still occur if a primary key change happens. This is because we can end up using an old descriptor version, which results in DML not writing information into the temporary indexes. While there's no risk of generating a corrupt index because validation catches the missing rows, this bug can cause these schema changes to fail. To address this, this patch adds logic to ensure descriptor versions match; otherwise, the memo will be re-planned. Fixes: #140475 Release note (bug fix): Addresses a bug that could cause concurrent DML to prevent primary key changes from succeeding
91d29fa
to
a63d74e
Compare
rafiss
approved these changes
Feb 16, 2025
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.
target-release-25.1.1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport 1/1 commits from #141189 on behalf of @fqazi.
/cc @cockroachdb/release
fixes #141528
Previously, we added an optimization to skip re-resolving object metadata if no leased descriptors had changed. This change also leased descriptors to ensure schema changes couldn't progress, as otherwise we could corrupt data by writing incompatible information. While this resolved most failures associated with concurrent DML/DDL execution by leasing required descriptors, intermittent failures still occur if a primary key change happens. This is because we can end up using an old descriptor version, which results in DML not writing information into the temporary indexes. While there's no risk of generating a corrupt index because validation catches the missing rows, this bug can cause these schema changes to fail. To address this, this patch adds logic to ensure descriptor versions match; otherwise, the memo will be re-planned.
Fixes: #140475
Fixes: #140954
Release note (bug fix): Addresses a bug that could cause concurrent DML to prevent primary key changes from succeeding
Release justification: low risk fix to address intermittent failures that can cause schema changes to fail