Skip to content
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

schemachanger: deflate primary index chain logic include UWI constraint #118291

Merged
merged 1 commit into from Feb 5, 2024

Conversation

Xiang-Gu
Copy link
Contributor

Previously, stmts like ADD COLUMN j INT, ADD UNIQUE WIHOUT INDEX (j) will fail with an internal error because we forget to process those unique-without-index in the DSC if the primary index chain has been inflated and needs to be deflated.

Fixes #118246
Release note (bug fix): Fix a bug where stmts like ADD COLUMN j INT, ADD UNIQUE WIHOUT INDEX (j) would fail with an internal error.

Previously, stmts like `ADD COLUMN j INT, ADD UNIQUE WIHOUT INDEX (j)`
will fail with an internal error because we forget to process those
unique-without-index in the DSC if the primary index chain has been
inflated and needs to be deflated.

Release note (bug fix): Fix a bug where stmts like `ADD COLUMN j INT, ADD UNIQUE WIHOUT INDEX (j)`
would fail with an internal error.
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@Xiang-Gu Xiang-Gu marked this pull request as ready for review January 25, 2024 16:03
@Xiang-Gu Xiang-Gu requested a review from a team as a code owner January 25, 2024 16:03
Copy link
Collaborator

@fqazi fqazi left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @Xiang-Gu)


pkg/sql/schemachanger/scbuild/internal/scbuildstmt/helpers.go line 1229 at r1 (raw file):

				e.IndexIDForValidation = new
			}
		case *scpb.UniqueWithoutIndexConstraint:

Should we add an end to end test with coverage of these scenarios? It could be a separate PR?

@Xiang-Gu
Copy link
Contributor Author

Xiang-Gu commented Feb 5, 2024

I don't think we need a end-to-end test for this case -- IMO end-to-end tests are probably most useful when we support new DDLs in DSC and we need to see/understand more about the transitions. This particular case's transition is well charactered by existing add column, add check test, so, I think adding a logic test for this particular problematic stmt is enough.

bors r+

@craig
Copy link
Contributor

craig bot commented Feb 5, 2024

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Feb 5, 2024

Build succeeded:

@craig craig bot merged commit 44e0ab0 into cockroachdb:master Feb 5, 2024
7 of 9 checks passed
@Xiang-Gu Xiang-Gu deleted the bug/add-column-add-uwi branch February 6, 2024 16:12
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.

schemachanger: add column + add unique without index in one stmt failed
3 participants