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/schemachanger: remove DROP INDEX fallbacks for regional by row #137989

Merged
merged 3 commits into from
Dec 30, 2024

Conversation

rafiss
Copy link
Collaborator

@rafiss rafiss commented Dec 26, 2024

catalog/multiregion: move SynthesizeMultiregionConfig function

This commit moves function and type definitions to a smaller package so
the declarative schema changer can use it.

sql/regions: extract SynthesizeRegionConfig into interface

This adds SynthesizeRegionConfig to the RegionProvider interface so that
the scbuild package can use it.

sql/schemachanger: remove DROP INDEX fallbacks for regional by row

This commit introduces a new function that will fail a schema change if
the table is regional by row and if any of the regions for the database
are currently being modified. With this new check, we no longer need to
fallback to the legacy schema changer for DROP INDEX. Previously we had
to, since this check was only implemented there.

This check was also added for ALTER PRIMARY KEY, CREATE INDEX, ADD COLUMN,
and DROP COLUMN, but the regional-by-row fallback still exists for those
operations.

fixes #136320
Release note: None

Copy link

blathers-crl bot commented Dec 26, 2024

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

@rafiss rafiss force-pushed the dsc-check-region-change-underway branch from 7050ed7 to 0f7112b Compare December 26, 2024 17:16
@rafiss rafiss changed the title sql/schemachanger: remove fallbacks for regional by row sql/schemachanger: remove some fallbacks for regional by row Dec 26, 2024
@rafiss rafiss force-pushed the dsc-check-region-change-underway branch from 0f7112b to bfb23e4 Compare December 28, 2024 04:27
@rafiss rafiss changed the title sql/schemachanger: remove some fallbacks for regional by row sql/schemachanger: remove DROP INDEX fallbacks for regional by row Dec 28, 2024
@rafiss rafiss force-pushed the dsc-check-region-change-underway branch from bfb23e4 to 70bd5e6 Compare December 28, 2024 15:26
@rafiss rafiss marked this pull request as ready for review December 30, 2024 17:04
@rafiss rafiss requested review from a team as code owners December 30, 2024 17:04
@rafiss rafiss requested review from kev-cao and annrpom and removed request for a team December 30, 2024 17:04
Copy link
Contributor

@annrpom annrpom left a comment

Choose a reason for hiding this comment

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

thank you for doing this!

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @kev-cao and @rafiss)


pkg/sql/catalog/multiregion/region_util.go line 90 at r2 (raw file):

	o SynthesizeRegionConfigOptions,
) (RegionConfig, error) {
	// move below stuff to multiregion/region_util.go

leftover comment

This commit moves function and type definitions to a smaller package so
the declarative schema changer can use it.

Release note: None
This adds SynthesizeRegionConfig to the RegionProvider interface so that
the scbuild package can use it.

Release note: None
This commit introduces a new function that will fail a schema change if
the table is regional by row and if any of the regions for the database
are currently being modified. With this new check, we no longer need to
fallback to the legacy schema changer for DROP INDEX. Previously we had
to, since this check was only implemented there.

This check was also added for ALTER PRIMARY KEY, CREATE INDEX, ADD COLUMN,
and DROP COLUMN, but the regional-by-row fallback still exists for those
operations.

Release note: None
@rafiss rafiss force-pushed the dsc-check-region-change-underway branch from 70bd5e6 to 42b9060 Compare December 30, 2024 17:20
Copy link
Collaborator Author

@rafiss rafiss left a comment

Choose a reason for hiding this comment

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

tftr!

bors r+

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @annrpom and @kev-cao)


pkg/sql/catalog/multiregion/region_util.go line 90 at r2 (raw file):

Previously, annrpom (annie pompa) wrote…

leftover comment

fixed

@craig craig bot merged commit 8735d91 into cockroachdb:master Dec 30, 2024
22 checks passed
@rafiss rafiss deleted the dsc-check-region-change-underway branch December 30, 2024 18:42
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 checkNoRegionChangeUnderway checks
3 participants