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: set locality to GLOBAL for materialized views #62122

Merged
merged 2 commits into from
Mar 18, 2021

Conversation

otan
Copy link
Contributor

@otan otan commented Mar 17, 2021

Only last two commits matter.
See individual commits for details.

Refs: #61382

@otan otan requested review from ajstorm, a team and miretskiy and removed request for a team March 17, 2021 02:29
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@awoods187
Copy link
Contributor

Nice speedy work!

Copy link
Collaborator

@ajstorm ajstorm left a comment

Choose a reason for hiding this comment

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

Reviewed 13 of 13 files at r1, 3 of 3 files at r2, 2 of 2 files at r3.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @miretskiy and @otan)


pkg/sql/catalog/tabledesc/validate.go, line 1253 at r2 (raw file):

	// Check non-table items have a correctly set locality.
	if desc.IsSequence() {
		if !desc.IsLocalityRegionalByTable() {

Nit: Does it make sense here to create IsDefaultLocalitySequence and tree.DefaultLocalitySequence, so that we only have to change this in one place down the road?

Copy link
Collaborator

@arulajmani arulajmani 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! 0 of 0 LGTMs obtained (waiting on @miretskiy and @otan)


pkg/sql/create_sequence.go, line 91 at r1 (raw file):

func doCreateSequence(
	params runParams,
	context string,

mind removing this context? Looks greyed out


pkg/sql/create_sequence.go, line 98 at r1 (raw file):

	opts tree.SequenceOptions,
	jobDesc string,
	isMultiRegion bool,

nit: you can get rid of this param and construct isMultiRegion in this function as opposed to funnelling it through to here.


pkg/sql/create_table.go, line 2419 at r1 (raw file):

	}

	_, dbDesc, err := params.p.Descriptors().GetImmutableDatabaseByID(

Don't you need an AvoidCached version here?

Copy link
Contributor Author

@otan otan left a comment

Choose a reason for hiding this comment

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

suggestions changed on base PR

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @ajstorm, @arulajmani, and @miretskiy)


pkg/sql/create_sequence.go, line 91 at r1 (raw file):

Previously, arulajmani (Arul Ajmani) wrote…

mind removing this context? Looks greyed out

Done.


pkg/sql/create_table.go, line 2419 at r1 (raw file):

Previously, arulajmani (Arul Ajmani) wrote…

Don't you need an AvoidCached version here?

Done.


pkg/sql/catalog/tabledesc/validate.go, line 1253 at r2 (raw file):

Previously, ajstorm (Adam Storm) wrote…

Nit: Does it make sense here to create IsDefaultLocalitySequence and tree.DefaultLocalitySequence, so that we only have to change this in one place down the road?

hmm, i don't see the value of it so much right now as i imagine the way we go forwards from here is allowing users to configure it.
depends how strongly you feel. happy to do this in a follow up.

@otan otan force-pushed the materialised_views_mr branch from dd1f652 to 45757fb Compare March 17, 2021 22:36
otan added 2 commits March 18, 2021 10:18
Release note (sql change): Materialized views in multi-region databases
will now have a GLOBAL locality.
Release note (sql change): Materialized views which are in a database
before the first ADD REGION will become GLOBAL on ADD REGION, in line
with the behavior of CREATE MATERIALIZED VIEW on a multi-region
database.
@otan otan force-pushed the materialised_views_mr branch from 45757fb to f7bf627 Compare March 17, 2021 23:25
@otan
Copy link
Contributor Author

otan commented Mar 18, 2021

bors r=ajstorm

@craig
Copy link
Contributor

craig bot commented Mar 18, 2021

Build succeeded:

@craig craig bot merged commit 3d3a60f into cockroachdb:master Mar 18, 2021
@rafiss rafiss added this to the 21.1 milestone Apr 22, 2021
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.

6 participants