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

sql/catalog/tabledesc: fixed a bug in maybeAddConstraintIDs #85778

Conversation

Xiang-Gu
Copy link
Contributor

@Xiang-Gu Xiang-Gu commented Aug 8, 2022

Previously, when we RunPostDeserializationChanges, one of the step is
to fill in constraint IDs if they are not already set, which is done
in function maybeAddConstraintIDs. That function however is buggy
in that, if there is constraint mutation on the table descriptor, we
directly go assign a constraint ID (from tbl.nextConstraintID) to it,
without checking whether it already has a non-zero constraint ID or not.
This PR fixes that.

Release note: None

@cockroach-teamcity
Copy link
Member

This change is Reviewable

Previously, when we RunPostDeserializationChanges, one of the step is
to fill in constraint IDs if they are not already set, which is done
in function `maybeAddConstraintIDs`. That function however is buggy
in that, if there is constraint mutation on the table descriptor, we
directly go assign a constraint ID (from `tbl.nextConstraintID`) to it,
without checking whether it already has a non-zero constraint ID or not.
This PR fixes that.

Release note (bug fix): Fixed a bug in post deserialization changes
where we might incorrectly change constraint ID of a constraint that
lives in the mutation slice of a table descriptor.
@Xiang-Gu Xiang-Gu force-pushed the fix_maybe_add_constraint_IDs_during_post_deserialization_change branch from 00f0991 to be2ddb2 Compare August 10, 2022 21:05
Copy link
Contributor

@ajwerner ajwerner left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 2 of 7 files at r1.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @ajwerner and @Xiang-Gu)


-- commits line 12 at r1:
I don't think this needs a release note because we never released this bug.

Copy link
Contributor Author

@Xiang-Gu Xiang-Gu left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @ajwerner)


-- commits line 12 at r1:

Previously, ajwerner wrote…

I don't think this needs a release note because we never released this bug.

removed.

@Xiang-Gu Xiang-Gu marked this pull request as ready for review August 10, 2022 21:47
@Xiang-Gu Xiang-Gu requested a review from a team August 10, 2022 21:47
@Xiang-Gu
Copy link
Contributor Author

TFTR!

bors r+

@craig
Copy link
Contributor

craig bot commented Aug 10, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Aug 11, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Aug 11, 2022

Build failed:

@Xiang-Gu
Copy link
Contributor Author

The merge failed due to a flaky test, retrying

bors r+

@craig
Copy link
Contributor

craig bot commented Aug 11, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Aug 11, 2022

Build failed:

@Xiang-Gu
Copy link
Contributor Author

It's sad to see merge failure again but it seems unrelated to this change, retrying again,
bors r+

@craig
Copy link
Contributor

craig bot commented Aug 11, 2022

Build succeeded:

@craig craig bot merged commit 9fb8d36 into cockroachdb:master Aug 11, 2022
@Xiang-Gu Xiang-Gu deleted the fix_maybe_add_constraint_IDs_during_post_deserialization_change branch August 11, 2022 19:47
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.

3 participants