-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
111387: sql: introduce tenant RO setting to allow full access to zone configs r=yuzefovich a=yuzefovich TLDR: this commit introduces another cluster setting that controls whether the virtual clusters have unrestricted ability to modify zone configs. Previously, we already had `sql.zone_configs.allow_for_secondary_tenant.enabled` setting (which controls whether VCs can modify zone configs at all), but even if that was enabled, VCs could not modify constraints and lease preferences other than locality (and only regions and zones). However, this restriction can be too cumbersome in UA, so this commit introduces another cluster setting `sql.virtual_cluster.feature_access.zone_configs_unrestricted.enabled` that controls whether VCs have full access to zone config modification (note that region and zone validation is still preserved, and retrieval of that information is made lazy). The new setting is disabled by default, but it's overridden in the config profiles `virtual+noapp`, `virtual+noapp+repl`, `virtual+app+sharedservice`, and `virtual+app+sharedservice+repl`. Fixes: #75569. Fixes: #111358. Epic: CRDB-26686 Release note: None Co-authored-by: Yahor Yuzefovich <[email protected]>
- Loading branch information
Showing
13 changed files
with
154 additions
and
44 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
pkg/ccl/logictestccl/testdata/logic_test/zone_configs_secondary_tenants_restricted
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# LogicTest: 3node-tenant | ||
|
||
# 'sql.zone_configs.allow_for_secondary_tenant.enabled' is enabled, but | ||
# 'sql.virtual_cluster.feature_access.zone_configs_unrestricted.enabled' is not, | ||
# so we should be able to modify zone configs except when modifying constraints | ||
# other than regions and zones. | ||
|
||
statement ok | ||
CREATE TABLE t (k INT PRIMARY KEY); | ||
|
||
statement ok | ||
ALTER TABLE t CONFIGURE ZONE USING num_replicas = 5; | ||
|
||
# This statement was correctly allowed, but it failed during validation because | ||
# 3node-tenant config doesn't define locality information. | ||
statement error region "us-east1" not found | ||
ALTER TABLE t CONFIGURE ZONE USING constraints = '[+region=us-east1]'; | ||
|
||
statement error operation is disabled within a virtual cluster | ||
ALTER TABLE t CONFIGURE ZONE USING constraints = '[+ssd]'; |
21 changes: 21 additions & 0 deletions
21
pkg/ccl/logictestccl/testdata/logic_test/zone_configs_secondary_tenants_unrestricted
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# LogicTest: 3node-tenant | ||
# tenant-cluster-setting-override-opt: sql.virtual_cluster.feature_access.zone_configs_unrestricted.enabled=true | ||
|
||
# Both 'sql.zone_configs.allow_for_secondary_tenant.enabled' and | ||
# 'sql.virtual_cluster.feature_access.zone_configs_unrestricted.enabled' are | ||
# enabled, so we should be able to modify zone configs in unlimited fashion | ||
# (regions and zones are still subject to validation). | ||
|
||
statement ok | ||
CREATE TABLE t (k INT PRIMARY KEY); | ||
|
||
statement ok | ||
ALTER TABLE t CONFIGURE ZONE USING num_replicas = 5; | ||
|
||
# This statement was correctly allowed, but it failed during validation because | ||
# 3node-tenant config doesn't define locality information. | ||
statement error region "us-east1" not found | ||
ALTER TABLE t CONFIGURE ZONE USING constraints = '[+region=us-east1]'; | ||
|
||
statement ok | ||
ALTER TABLE t CONFIGURE ZONE USING constraints = '[+ssd]'; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters