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

opt: avoid looking up MultiregionConfig for non-multiregion tables #89590

Merged
merged 1 commit into from
Nov 8, 2022

Conversation

msirek
Copy link
Contributor

@msirek msirek commented Oct 7, 2022

This avoids expensive lookups of the regions in a table's parent database for non-multiregion tables.

Epic: CRDB-18645

Release note: None

@msirek msirek requested a review from a team as a code owner October 7, 2022 22:12
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@msirek msirek marked this pull request as draft October 7, 2022 22:12
@msirek
Copy link
Contributor Author

msirek commented Oct 7, 2022

Avoid expensive assertions in MultiRegionEnumID:
image

@msirek msirek force-pushed the avoidMultiregionConfigLookups branch 2 times, most recently from f99a10f to fe1580c Compare October 8, 2022 00:24
@DrewKimball
Copy link
Collaborator

DrewKimball commented Oct 9, 2022

Nice find! I know this is a draft, but probably worth mentioning anyway that you could solve this more simply by making the error global like Yahor did here, since the error is always the same. Do you think any of the other assertions in that file are worth optimizing?

@msirek msirek mentioned this pull request Oct 13, 2022
6 tasks
Copy link
Contributor Author

@msirek msirek left a comment

Choose a reason for hiding this comment

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

Thanks. The observation here is that there is no point in attempting to look up the multiregion config if we know ahead of time a table is not a multiregion table because none will ever be found. This would apply even if the error were made global.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained

@msirek msirek marked this pull request as ready for review November 5, 2022 18:39
Copy link
Collaborator

@rytaft rytaft 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 6 of 6 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @msirek and @yuzefovich)


pkg/sql/opt/table_meta.go line 515 at r1 (raw file):

	}()
	if dbID == 0 || !tm.Table.IsMultiregion() {
		return descpb.SurvivalGoal_ZONE_FAILURE /* regionNames */, false

regionNames -> survivalGoal (or just get rid of this comment -- doesn't seem necessary)

@msirek msirek force-pushed the avoidMultiregionConfigLookups branch from fe1580c to 0a31ada Compare November 7, 2022 16:14
Copy link
Contributor Author

@msirek msirek 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=rytaft

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @rytaft and @yuzefovich)


pkg/sql/opt/table_meta.go line 515 at r1 (raw file):

Previously, rytaft (Rebecca Taft) wrote…

regionNames -> survivalGoal (or just get rid of this comment -- doesn't seem necessary)

Removed the comment

@craig
Copy link
Contributor

craig bot commented Nov 7, 2022

Build failed (retrying...):

Copy link
Contributor Author

@msirek msirek left a comment

Choose a reason for hiding this comment

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

bors r-

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @rytaft and @yuzefovich)

@craig
Copy link
Contributor

craig bot commented Nov 7, 2022

Canceled.

@msirek msirek force-pushed the avoidMultiregionConfigLookups branch from 0a31ada to c6779df Compare November 7, 2022 17:22
This avoids expensive lookups of the regions in a table's parent
database for non-multiregion tables.

Release note: None
@msirek msirek force-pushed the avoidMultiregionConfigLookups branch from c6779df to 030204c Compare November 8, 2022 18:06
@msirek
Copy link
Contributor Author

msirek commented Nov 8, 2022

bors r=rytaft

@craig
Copy link
Contributor

craig bot commented Nov 8, 2022

Build succeeded:

@craig craig bot merged commit 82b2519 into cockroachdb:master Nov 8, 2022
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.

4 participants