Skip to content

sql: add cluster setting to gate PLACEMENT operations#69005

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
pawalt:placement_cluster_setting
Aug 20, 2021
Merged

sql: add cluster setting to gate PLACEMENT operations#69005
craig[bot] merged 1 commit intocockroachdb:masterfrom
pawalt:placement_cluster_setting

Conversation

@pawalt
Copy link
Copy Markdown
Contributor

@pawalt pawalt commented Aug 16, 2021

Previously, PLACEMENT operations were allowed by default. We want to
hide these unless the user explicitly enables them, however, so this PR
adds the sql.defaults.experimental_domiciling cluster setting to gate
them.

Release note: None

Resolves #68598

@pawalt pawalt requested review from a team, arulajmani and otan August 16, 2021 18:38
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@pawalt pawalt force-pushed the placement_cluster_setting branch 2 times, most recently from 7ce0d50 to 4be32a0 Compare August 16, 2021 18:52
Copy link
Copy Markdown
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 @otan and @pawalt)


pkg/sql/create_database.go, line 100 at r1 (raw file):

		if !p.EvalContext().SessionData.PlacementEnabled {
			return nil, pgerror.New(
				pgcode.InvalidDatabaseDefinition,

Feature not supported instead, maybe?


pkg/sql/create_database.go, line 101 at r1 (raw file):

			return nil, pgerror.New(
				pgcode.InvalidDatabaseDefinition,

extra line?


pkg/sql/create_database.go, line 102 at r1 (raw file):

				pgcode.InvalidDatabaseDefinition,

				"PLACEMENT requires that the cluster setting sql.defaults.experimental_placement "+

Should we be referencing the session setting here instead as the cluster setting only serves as a default?

Also, let's put the exact session setting that the user might need to change in the HINT message. It's nice to have these things copy-paste-able.


pkg/sql/exec_util.go, line 236 at r1 (raw file):

var placementEnabledClusterMode = settings.RegisterBoolSetting(
	"sql.defaults.experimental_placement.enabled",

Let's call this sql.defaults.multiregion_placement_policy.enabled?

Last I heard we were moving away from "experimental" in cluster settings/syntax etc.


pkg/sql/vars.go, line 1258 at r1 (raw file):

	// CockroachDB extension.
	`experimental_enable_placement`: {

Same as above, instead of experimental_enable_placement, let's call this enable_multiregion_placement_policy instead.


pkg/sql/sessiondatapb/local_only_session_data.proto, line 170 at r1 (raw file):

  // PlacementEnabled indicates whether PLACEMENT can be used or not.
  bool placement_enabled = 44;

Why do we need this?

@pawalt pawalt force-pushed the placement_cluster_setting branch 2 times, most recently from 7952fef to 77c6806 Compare August 17, 2021 17:37
@pawalt pawalt requested a review from arulajmani August 17, 2021 17:37
Copy link
Copy Markdown
Contributor Author

@pawalt pawalt 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 @arulajmani and @otan)


pkg/sql/create_database.go, line 100 at r1 (raw file):

Previously, arulajmani (Arul Ajmani) wrote…

Feature not supported instead, maybe?

Done.


pkg/sql/create_database.go, line 101 at r1 (raw file):

Previously, arulajmani (Arul Ajmani) wrote…

extra line?

Done.


pkg/sql/create_database.go, line 102 at r1 (raw file):

Previously, arulajmani (Arul Ajmani) wrote…

Should we be referencing the session setting here instead as the cluster setting only serves as a default?

Also, let's put the exact session setting that the user might need to change in the HINT message. It's nice to have these things copy-paste-able.

I'll put the session setting in the main error and cluster setting in the hint so they know where to go for long-term changes.


pkg/sql/exec_util.go, line 236 at r1 (raw file):

Previously, arulajmani (Arul Ajmani) wrote…

Let's call this sql.defaults.multiregion_placement_policy.enabled?

Last I heard we were moving away from "experimental" in cluster settings/syntax etc.

Done.


pkg/sql/vars.go, line 1258 at r1 (raw file):

Previously, arulajmani (Arul Ajmani) wrote…

Same as above, instead of experimental_enable_placement, let's call this enable_multiregion_placement_policy instead.

Done.


pkg/sql/sessiondatapb/local_only_session_data.proto, line 170 at r1 (raw file):

Previously, arulajmani (Arul Ajmani) wrote…

Why do we need this?

@otan moved our session setting from an enum to proto, so we've gotta add this here.

Copy link
Copy Markdown
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.

:lgtm: once the commit message is updated

Reviewed 1 of 13 files at r1, 1 of 1 files at r2, 11 of 11 files at r3, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @otan and @pawalt)


-- commits, line 6 at r3 ([raw file](https://github.com/cockroachdb/cockroach/blob/77c6806264161af6dddd888948e3239d82748e82/-- commits#L6)):
I think your commit message needs an update with the new session/cluster settings in.

Also, add a nod to the fact that you're intentionally skipping on the release note here and why.


pkg/sql/create_database.go, line 102 at r1 (raw file):

Previously, pawalt (Peyton Walters) wrote…

I'll put the session setting in the main error and cluster setting in the hint so they know where to go for long-term changes.

Maybe I'm lazy, but I really like when I can just copy paste the exact session setting I need to change instead of deciphering a hint message. Maybe something like "you can enable multi-region placement policy by running SET enable_multiregion_placement_policy = true in the hint.

Your call!


pkg/sql/sessiondatapb/local_only_session_data.proto, line 170 at r1 (raw file):

Previously, pawalt (Peyton Walters) wrote…

@otan moved our session setting from an enum to proto, so we've gotta add this here.

TIL!

@pawalt pawalt force-pushed the placement_cluster_setting branch from 77c6806 to f7c144b Compare August 18, 2021 15:03
@pawalt pawalt requested a review from arulajmani August 18, 2021 15:03
Copy link
Copy Markdown
Contributor Author

@pawalt pawalt 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 (and 1 stale) (waiting on @arulajmani and @otan)


-- commits, line 6 at r3 ([raw file](https://github.com/cockroachdb/cockroach/blob/77c6806264161af6dddd888948e3239d82748e82/-- commits#L6)):

Previously, arulajmani (Arul Ajmani) wrote…

I think your commit message needs an update with the new session/cluster settings in.

Also, add a nod to the fact that you're intentionally skipping on the release note here and why.

Done.


pkg/sql/create_database.go, line 102 at r1 (raw file):

Previously, arulajmani (Arul Ajmani) wrote…

Maybe I'm lazy, but I really like when I can just copy paste the exact session setting I need to change instead of deciphering a hint message. Maybe something like "you can enable multi-region placement policy by running SET enable_multiregion_placement_policy = true in the hint.

Your call!

Makes sense!

@postamar postamar removed the request for review from a team August 18, 2021 20:33
@pawalt pawalt force-pushed the placement_cluster_setting branch 2 times, most recently from 4570f06 to c91de7d Compare August 19, 2021 20:50
@arulajmani
Copy link
Copy Markdown
Collaborator

I think one of your tests is failing because you need to now turn on this cluster setting for it. That, and this needs a rebase. Should be good to go in after!

@pawalt pawalt force-pushed the placement_cluster_setting branch 2 times, most recently from 35f1b5c to 9c79113 Compare August 20, 2021 16:24
@pawalt pawalt requested a review from a team as a code owner August 20, 2021 16:24
Previously, PLACEMENT operations were allowed by default. We want to
hide these unless the user explicitly enables them, however, so this PR
adds the a cluster setting to gate them.

Session setting: enable_multiregion_placement_policy
Cluster setting: sql.defaults.multiregion_placement_policy.enabled

We have no release note for this commit because we intend to hide
PLACEMENT operations from users unless they explicitly ask for them.

Release note: None
@pawalt pawalt force-pushed the placement_cluster_setting branch from 9c79113 to 56f3fb6 Compare August 20, 2021 18:05
@pawalt
Copy link
Copy Markdown
Contributor Author

pawalt commented Aug 20, 2021

bors r=arulajmani

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Aug 20, 2021

Build succeeded:

@craig craig bot merged commit 2c51f70 into cockroachdb:master Aug 20, 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.

sql: add cluster setting for PLACEMENT operations

3 participants