Skip to content

sql: add feature flag for CREATE STATISTICS/ANALYZE#57076

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
angelapwen:add-create-stats-feature-flag
Nov 24, 2020
Merged

sql: add feature flag for CREATE STATISTICS/ANALYZE#57076
craig[bot] merged 1 commit intocockroachdb:masterfrom
angelapwen:add-create-stats-feature-flag

Conversation

@angelapwen
Copy link
Copy Markdown

@angelapwen angelapwen commented Nov 24, 2020

See #51643 for background.

---Commit message---

This change adds a feature flag for the CREATE STATISTICS command
as well as ANALYZE, which is syntactic sugar for the former. The
feature is being added to address a CockroachCloud SRE use case:
needing to disable certain features, such as this, in case of
cluster failure.

Release note (sql change): Adds a feature flag via cluster settings
for the CREATE STATISTICS and ANALYZE feature. If a user attempts
to use the command while disabled, an error indicating that the
database administrator had disabled the feature is surfaced.

Example usage for the database administrator:
SET CLUSTER SETTING feature.stats.enabled = FALSE;
SET CLUSTER SETITNG feature.stats.enabled = TRUE;

@angelapwen angelapwen requested review from a team and otan November 24, 2020 18:52
@angelapwen angelapwen self-assigned this Nov 24, 2020
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

Copy link
Copy Markdown
Contributor

@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.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @angelapwen and @otan)


pkg/sql/create_stats.go, line 63 at r1 (raw file):

		featureStatsEnabled,
		&p.ExecCfg().Settings.SV,
		"ANALYZE/CREATE STATISTICS"); err != nil {

nit: , and new line after this one, i.e.

	if err := featureflag.CheckEnabled(
		featureStatsEnabled,
		&p.ExecCfg().Settings.SV,
		"ANALYZE/CREATE STATISTICS",
        ); err != nil {

(makes git lbame easier)

@angelapwen angelapwen force-pushed the add-create-stats-feature-flag branch from 129d720 to 3cac9bb Compare November 24, 2020 19:40
@angelapwen
Copy link
Copy Markdown
Author


pkg/sql/create_stats.go, line 63 at r1 (raw file):

Previously, otan (Oliver Tan) wrote…

nit: , and new line after this one, i.e.

	if err := featureflag.CheckEnabled(
		featureStatsEnabled,
		&p.ExecCfg().Settings.SV,
		"ANALYZE/CREATE STATISTICS",
        ); err != nil {

(makes git lbame easier)

Thanks! Addressed

This change adds a feature flag for the CREATE STATISTICS command
as well as ANALYZE, which is syntactic sugar for the former. The
feature is being added to address a CockroachCloud SRE use case:
needing to disable certain features, such as this, in case of
cluster failure.

Release note (sql change): Adds a feature flag via cluster settings
for the CREATE STATISTICS and ANALYZE feature. If a user attempts
to use the command while disabled, an error indicating that the
database administrator had disabled the feature is surfaced.

Example usage for the database administrator:
SET CLUSTER SETTING feature.stats.enabled = FALSE;
SET CLUSTER SETITNG feature.stats.enabled = TRUE;
@angelapwen angelapwen force-pushed the add-create-stats-feature-flag branch from 3cac9bb to 721af02 Compare November 24, 2020 20:42
Copy link
Copy Markdown
Contributor

@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.

lets go

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @angelapwen and @otan)

@angelapwen
Copy link
Copy Markdown
Author

bors r=otan

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Nov 24, 2020

Build succeeded:

@craig craig bot merged commit 61bd94b into cockroachdb:master Nov 24, 2020
craig bot pushed a commit that referenced this pull request Nov 25, 2020
57040: sql, featureflag: add schema change feature flag r=otan a=angelapwen

The following features have been tested and act as expected:

- [x] ALTER DATABASE OWNER
- [x] ALTER DATABASE ADD REGION
- [x] ALTER DATABASE DROP REGION
- [x] ALTER DATABASE SURVIVE
- [x] ALTER TABLE REGIONAL AFFINITY
- [x] ALTER TABLE SET SCHEMA
- [x] ALTER SCHEMA
- [x] ALTER TYPE
- [x] ALTER SEQUENCE RENAME
- [x] ALTER SEQUENCE SET SCHEMA 
- [x] CREATE DATABASE
- [x] CREATE INDEX
- [x] CREATE SCHEMA
- [x] CREATE TABLE
- [x] CREATE TYPE
- [x] CREATE VIEW
- [x] CREATE SEQUENCE
- [x] DROP DATABASE
- [x] DROP INDEX
- [x] DROP TABLE
- [x] DROP VIEW
- [x] DROP SEQUENCE
- [x] DROP TYPE
- [x] DROP SCHEMA
- [x] REASSIGN OWNED BY
- [x] DROP OWNED BY
- [x] RENAME DATABASE
- [x] REPARENT DATABASE
- [x] RENAME INDEX
- [x] RENAME TABLE
- [x] RENAME COLUMN 
- [x] COMMENT ON COLUMN 
- [x] COMMENT ON DATABASE
- [x] COMMENT ON INDEX
- [x] COMMENT ON TABLE
- [x] ALTER INDEX CONFIGURE ZONE
- [x] ALTER TABLE CONFIGURE ZONE

See #51643 for background.

ANALYZE/CREATE STATISTICS will not be considered a schema change and were added in a separate PR, #57076 
The SPLIT/UNSPLIT features will also be resolved in a separate PR, as the execution path is different from the schema changes addressed in this PR. 

---Commit message---

This change adds a feature flag via cluster setting for all
designated features that perform schema changes or DDLs. The
feature is being introduced to address a Cockroach Cloud SRE use
case: needing to disable certain categories of features, such as
schema changes, in case of cluster failure.

Release note (sql change): Adds a feature flag via cluster
setting for all schema change-related features. If a user attempts
to use these features while they are disabled, an error indicating
that the database administrator has disabled the feature is
surfaced.

Example usage for the database administrator:
SET CLUSTER SETTING feature.schemachange.enabled = FALSE;
SET CLUSTER SETTING feature.schemachange.enabled = TRUE;

Co-authored-by: angelapwen <angelaw@cockroachlabs.com>
@angelapwen angelapwen deleted the add-create-stats-feature-flag branch February 5, 2021 00:16
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.

3 participants