Skip to content

Conversation

fqazi
Copy link
Collaborator

@fqazi fqazi commented Oct 3, 2025

Previously, we adjusted the schema changer rules to ensure that
old secondary indexes are only dropped when the new secondary index is
usable. Unfortunately, one of the rules had an incorrect filter. To
address this, this patch fixes the filter to expect the new secondary
index, which will have the new flag. Additionally, the index recreation
logic for ALTER PRIMARY KEY was delaying when the new secondary indexes
could be made public.

Fixes: #154751

Release note: None

@fqazi fqazi added the backport-25.4.x Flags PRs that need to be backported to 25.4 label Oct 3, 2025
Copy link

blathers-crl bot commented Oct 3, 2025

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

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

@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link

blathers-crl bot commented Oct 6, 2025

Your pull request contains more than 1000 changes. It is strongly encouraged to split big PRs into smaller chunks.

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

@fqazi fqazi marked this pull request as ready for review October 6, 2025 15:28
@fqazi fqazi requested a review from a team as a code owner October 6, 2025 15:28
Copy link
Contributor

@spilchen spilchen left a comment

Choose a reason for hiding this comment

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

LGTM! I am wondering if a dml injection would have caught this sooner? Maybe by scanning the secondary index at each stage of an ALTER PK.

Previously, we adjusted the schema changer rules to ensure that
old secondary indexes are only dropped when the new secondary index is
usable. Unfortunately, one of the rules had an incorrect filter. To
address this, this patch fixes the filter to expect the new secondary
index, which will have the new flag. Additionally, the index recreation
logic for ALTER PRIMARY KEY was delaying when the new secondary indexes
could be made public.

Fixes: cockroachdb#154751

Release note: None
@fqazi
Copy link
Collaborator Author

fqazi commented Oct 6, 2025

@spilchen TFTR!

bors r+

craig bot pushed a commit that referenced this pull request Oct 6, 2025
154684: backup: split up the multiregion datadriven test r=jeffswenson a=jeffswenson

This splits up the multiregion datadriven test so that each test has at most 2 clusters in it. We've been seeing some stuck server shutdowns and this should make them easier to troubleshoot.

Release note: none
Informs: #145079

154687: backup: improve datadriven test cleanup r=jeffswenson a=jeffswenson

Previously, the datadriven test harness would tear down clusters in order. This makes it difficult to troubleshoot stuck tear downs because there are goroutines for a running server mixed in with goroutines for a server with a stuck shutdown.

Release note: none
Informs: #145079

154752: sql/schemachanger: fix incorrect filter for pk index swaps r=fqazi a=fqazi

Previously, we adjusted the schema changer rules to ensure that
old secondary indexes are only dropped when the new secondary index is
usable. Unfortunately, one of the rules had an incorrect filter. To
address this, this patch fixes the filter to expect the new secondary
index, which will have the new flag. Additionally, the index recreation
logic for ALTER PRIMARY KEY was delaying when the new secondary indexes
could be made public.

Fixes: #154751

Release note: None

154867: go.mod: bump datadriven r=RaduBerinde a=RaduBerinde

Bump datadriven to incorporate a fix
(cockroachdb/datadriven#60).

Epic: none
Release note: None

154870: changefeedccl: make bulk delivery of rangefeed events optional r=aerfrei a=asg0451

This is a temporary opt-out until we can properly test the performance
impact of bulk delivery.

Epic: none

Release note (general change): The changefeed bulk
delivery setting was made optional.


Co-authored-by: Jeff Swenson <jeffswenson@betterthannull.com>
Co-authored-by: Faizan Qazi <faizan@cockroachlabs.com>
Co-authored-by: Radu Berinde <radu@cockroachlabs.com>
Co-authored-by: Miles Frankel <miles.frankel@cockroachlabs.com>
@craig
Copy link
Contributor

craig bot commented Oct 6, 2025

This PR was included in a batch that was canceled, it will be automatically retried

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-25.4.x Flags PRs that need to be backported to 25.4
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sql/schemachanger: fix incorrect filter for secondary index recreation during a pk swap
3 participants