diff --git a/docs/RFCS/20211106_multitenant_cluster_settings.md b/docs/RFCS/20211106_multitenant_cluster_settings.md index 1f49449f434b..e04af7393a95 100644 --- a/docs/RFCS/20211106_multitenant_cluster_settings.md +++ b/docs/RFCS/20211106_multitenant_cluster_settings.md @@ -76,7 +76,7 @@ We propose splitting the cluster settings into three *classes*: single command; the value applies to all tenants that don't have their own specific value, including future tenants. - Examples: `kv.bulk_ingest.batch_size`, `tenant_cpu_usage_allowance`. + Examples: `kv.bulk_ingest.batch_size`, `tenant_cost_control.cpu_usage_allowance`. 3. Tenant writable (`tenant-rw`) diff --git a/docs/generated/settings/settings.html b/docs/generated/settings/settings.html index 718bb974a185..ee827f260966 100644 --- a/docs/generated/settings/settings.html +++ b/docs/generated/settings/settings.html @@ -7,8 +7,6 @@
admission.epoch_lifo.epoch_duration
duration100msthe duration of an epoch, for epoch-LIFO admission control orderingServerless/Dedicated/Self-Hosted
admission.epoch_lifo.queue_delay_threshold_to_switch_to_lifo
duration105msthe queue delay encountered by a (tenant,priority) for switching to epoch-LIFO orderingServerless/Dedicated/Self-Hosted
admission.kv.enabled
booleantruewhen true, work performed by the KV layer is subject to admission controlDedicated/Self-Hosted -
admission.kv.stores.tenant_weights.enabled
booleanfalsewhen true, tenant weights are enabled for KV-stores admission controlDedicated/Self-Hosted -
admission.kv.tenant_weights.enabled
booleanfalsewhen true, tenant weights are enabled for KV admission controlDedicated/Self-Hosted
admission.sql_kv_response.enabled
booleantruewhen true, work performed by the SQL layer when receiving a KV response is subject to admission controlServerless/Dedicated/Self-Hosted
admission.sql_sql_response.enabled
booleantruewhen true, work performed by the SQL layer when receiving a DistSQL response is subject to admission controlServerless/Dedicated/Self-Hosted
bulkio.backup.deprecated_full_backup_with_subdir.enabled
booleanfalsewhen true, a backup command with a user specified subdirectory will create a full backup at the subdirectory if no backup already exists at that subdirectoryServerless/Dedicated/Self-Hosted @@ -92,7 +90,6 @@
server.clock.forward_jump_check.enabled
booleanfalseif enabled, forward clock jumps > max_offset/2 will cause a panicServerless/Dedicated/Self-Hosted
server.clock.persist_upper_bound_interval
duration0sthe interval between persisting the wall time upper bound of the clock. The clock does not generate a wall time greater than the persisted timestamp and will panic if it sees a wall time greater than this value. When cockroach starts, it waits for the wall time to catch-up till this persisted timestamp. This guarantees monotonic wall time across server restarts. Not setting this or setting a value of 0 disables this feature.Serverless/Dedicated/Self-Hosted
server.consistency_check.max_rate
byte size8.0 MiBthe rate limit (bytes/sec) to use for consistency checks; used in conjunction with server.consistency_check.interval to control the frequency of consistency checks. Note that setting this too high can negatively impact performance.Dedicated/Self-Hosted -
server.controller.default_tenant
stringsystemname of the tenant to use to serve requests when clients don't specify a tenantDedicated/Self-Hosted
server.eventlog.enabled
booleantrueif set, logged notable events are also stored in the table system.eventlogServerless/Dedicated/Self-Hosted
server.eventlog.ttl
duration2160h0m0sif nonzero, entries in system.eventlog older than this duration are periodically purgedServerless/Dedicated/Self-Hosted
server.host_based_authentication.configuration
stringhost-based authentication configuration to use during connection authenticationServerless/Dedicated/Self-Hosted @@ -113,7 +110,6 @@
server.oidc_authentication.redirect_url
stringhttps://localhost:8080/oidc/v1/callbacksets OIDC redirect URL via a URL string or a JSON string containing a required `redirect_urls` key with an object that maps from region keys to URL strings (URLs should point to your load balancer and must route to the path /oidc/v1/callback)Serverless/Dedicated/Self-Hosted
server.oidc_authentication.scopes
stringopenidsets OIDC scopes to include with authentication request (space delimited list of strings, required to start with `openid`)Serverless/Dedicated/Self-Hosted
server.rangelog.ttl
duration720h0m0sif nonzero, entries in system.rangelog older than this duration are periodically purgedServerless/Dedicated/Self-Hosted -
server.secondary_tenants.redact_trace.enabled
booleantruecontrols if server side traces are redacted for tenant operationsDedicated/Self-Hosted
server.shutdown.connection_wait
duration0sthe maximum amount of time a server waits for all SQL connections to be closed before proceeding with a drain. (note that the --drain-wait parameter for cockroach node drain may need adjustment after changing this setting)Serverless/Dedicated/Self-Hosted
server.shutdown.drain_wait
duration0sthe amount of time a server waits in an unready state before proceeding with a drain (note that the --drain-wait parameter for cockroach node drain may need adjustment after changing this setting. --drain-wait is to specify the duration of the whole draining process, while server.shutdown.drain_wait is to set the wait time for health probes to notice that the node is not ready.)Serverless/Dedicated/Self-Hosted
server.shutdown.jobs_wait
duration10sthe maximum amount of time a server waits for all currently executing jobs to notice drain request and to perform orderly shutdownServerless/Dedicated/Self-Hosted @@ -132,8 +128,8 @@
server.web_session.purge.ttl
duration1h0m0sif nonzero, entries in system.web_sessions older than this duration are periodically purgedServerless/Dedicated/Self-Hosted
server.web_session.timeout
duration168h0m0sthe duration that a newly created web session will be validServerless/Dedicated/Self-Hosted
spanconfig.bounds.enabled
booleantruedictates whether span config bounds are consulted when serving span configs for secondary tenantsDedicated/Self-Hosted -
spanconfig.storage_coalesce_adjacent.enabled
booleantruecollapse adjacent ranges with the same span configs, for the ranges specific to the system tenantDedicated/Self-Hosted -
spanconfig.tenant_coalesce_adjacent.enabled
booleantruecollapse adjacent ranges with the same span configs across all secondary tenant keyspacesDedicated/Self-Hosted +
spanconfig.range_coalescing.system.enabled
booleantruecollapse adjacent ranges with the same span configs, for the ranges specific to the system tenantDedicated/Self-Hosted +
spanconfig.range_coalescing.application.enabled
booleantruecollapse adjacent ranges with the same span configs across all secondary tenant keyspacesDedicated/Self-Hosted
sql.auth.change_own_password.enabled
booleanfalsecontrols whether a user is allowed to change their own password, even if they have no other privilegesServerless/Dedicated/Self-Hosted
sql.auth.public_schema_create_privilege.enabled
booleantruedetermines whether to grant all users the CREATE privileges on the public schema when it is createdServerless/Dedicated/Self-Hosted
sql.auth.resolve_membership_single_scan.enabled
booleantruedetermines whether to populate the role membership cache with a single scanServerless/Dedicated/Self-Hosted diff --git a/pkg/bench/foreachdb.go b/pkg/bench/foreachdb.go index b9617ac8c24d..ad45ec93321c 100644 --- a/pkg/bench/foreachdb.go +++ b/pkg/bench/foreachdb.go @@ -127,7 +127,7 @@ func benchmarkSepProcessTenantCockroach(b *testing.B, f BenchmarkFn) { // The benchmarks sometime hit the default span limit, so we increase it. // NOTE(andrei): Benchmarks drop the tables they're creating, so I'm not sure // if hitting this limit is expected. - _, err := db.Exec(`ALTER TENANT ALL SET CLUSTER SETTING "spanconfig.tenant_limit" = 10000000`) + _, err := db.Exec(`ALTER TENANT ALL SET CLUSTER SETTING "spanconfig.virtual_cluster.max_spans" = 10000000`) require.NoError(b, err) _, err = tenantDB.Exec(`CREATE DATABASE bench`) diff --git a/pkg/ccl/backupccl/backup_tenant_test.go b/pkg/ccl/backupccl/backup_tenant_test.go index c727bdb02513..c26c63c41571 100644 --- a/pkg/ccl/backupccl/backup_tenant_test.go +++ b/pkg/ccl/backupccl/backup_tenant_test.go @@ -126,7 +126,7 @@ func TestBackupTenantImportingTable(t *testing.T) { // TestTenantBackupMultiRegionDatabases ensures secondary tenants restoring // MR databases respect the -// sql.multi_region.allow_abstractions_for_secondary_tenants.enabled cluster +// sql.virtual_cluster.feature_access.multiregion.enabled cluster // setting. func TestTenantBackupMultiRegionDatabases(t *testing.T) { defer leaktest.AfterTest(t)() diff --git a/pkg/ccl/kvccl/kvfollowerreadsccl/followerreads_test.go b/pkg/ccl/kvccl/kvfollowerreadsccl/followerreads_test.go index 10621aac8d80..c251126ac643 100644 --- a/pkg/ccl/kvccl/kvfollowerreadsccl/followerreads_test.go +++ b/pkg/ccl/kvccl/kvfollowerreadsccl/followerreads_test.go @@ -970,7 +970,7 @@ func TestSecondaryTenantFollowerReadsRouting(t *testing.T) { systemSQL.Exec(t, `ALTER TENANT ALL SET CLUSTER SETTING kv.closed_timestamp.propagation_slack = '0.1s'`) // We're making assertions on traces collected by the tenant using log lines // in KV so we must ensure they're not redacted. - systemSQL.Exec(t, `SET CLUSTER SETTING server.secondary_tenants.redact_trace.enabled = 'false'`) + systemSQL.Exec(t, `SET CLUSTER SETTING trace.redact_at_virtual_cluster_boundary.enabled = 'false'`) dbs := make([]*gosql.DB, numNodes) for i := 0; i < numNodes; i++ { diff --git a/pkg/ccl/logictestccl/testdata/logic_test/alter_table_locality b/pkg/ccl/logictestccl/testdata/logic_test/alter_table_locality index 86089e6fc02d..280ee0089c48 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/alter_table_locality +++ b/pkg/ccl/logictestccl/testdata/logic_test/alter_table_locality @@ -1,4 +1,4 @@ -# tenant-cluster-setting-override-opt: sql.zone_configs.allow_for_secondary_tenant.enabled=true sql.multi_region.allow_abstractions_for_secondary_tenants.enabled=true +# tenant-cluster-setting-override-opt: sql.virtual_cluster.feature_access.zone_configs.enabled=true sql.virtual_cluster.feature_access.multiregion.enabled=true # LogicTest: multiregion-9node-3region-3azs multiregion-9node-3region-3azs-no-los statement ok diff --git a/pkg/ccl/logictestccl/testdata/logic_test/auto_rehoming b/pkg/ccl/logictestccl/testdata/logic_test/auto_rehoming index da84edfc58f7..503531ce3de0 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/auto_rehoming +++ b/pkg/ccl/logictestccl/testdata/logic_test/auto_rehoming @@ -1,4 +1,4 @@ -# tenant-cluster-setting-override-opt: sql.multi_region.allow_abstractions_for_secondary_tenants.enabled=true +# tenant-cluster-setting-override-opt: sql.virtual_cluster.feature_access.multiregion.enabled=true # LogicTest: local statement ok diff --git a/pkg/ccl/logictestccl/testdata/logic_test/crdb_internal_tenant b/pkg/ccl/logictestccl/testdata/logic_test/crdb_internal_tenant index dcc6a71d0ca7..30a568e14280 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/crdb_internal_tenant +++ b/pkg/ccl/logictestccl/testdata/logic_test/crdb_internal_tenant @@ -440,7 +440,7 @@ test {} statement ok CREATE TABLE foo (a INT PRIMARY KEY, INDEX idx(a)); INSERT INTO foo VALUES(1) -statement error tenant cluster setting sql.split_at.allow_for_secondary_tenant.enabled disabled +statement error tenant cluster setting sql.virtual_cluster.feature_access.manual_range_split.enabled disabled ALTER TABLE foo SPLIT AT VALUES(2) # Make sure that the cluster id isn't unset. diff --git a/pkg/ccl/logictestccl/testdata/logic_test/global_placement_restricted b/pkg/ccl/logictestccl/testdata/logic_test/global_placement_restricted index d89af9daef28..95d5b5255cb5 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/global_placement_restricted +++ b/pkg/ccl/logictestccl/testdata/logic_test/global_placement_restricted @@ -1,4 +1,4 @@ -# tenant-cluster-setting-override-opt: sql.multi_region.allow_abstractions_for_secondary_tenants.enabled=true +# tenant-cluster-setting-override-opt: sql.virtual_cluster.feature_access.multiregion.enabled=true # LogicTest: multiregion-9node-3region-3azs multiregion-9node-3region-3azs-vec-off multiregion-9node-3region-3azs-no-los statement ok diff --git a/pkg/ccl/logictestccl/testdata/logic_test/multi_region b/pkg/ccl/logictestccl/testdata/logic_test/multi_region index f5075f837859..c7e88e0c62d6 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/multi_region +++ b/pkg/ccl/logictestccl/testdata/logic_test/multi_region @@ -1,4 +1,4 @@ -# tenant-cluster-setting-override-opt: sql.multi_region.allow_abstractions_for_secondary_tenants.enabled=true +# tenant-cluster-setting-override-opt: sql.virtual_cluster.feature_access.multiregion.enabled=true # knob-opt: sync-event-log # LogicTest: multiregion-9node-3region-3azs multiregion-9node-3region-3azs-tenant multiregion-9node-3region-3azs-no-los diff --git a/pkg/ccl/logictestccl/testdata/logic_test/multi_region_alter_table_regional_by_row b/pkg/ccl/logictestccl/testdata/logic_test/multi_region_alter_table_regional_by_row index 08ac6779905c..5fd188be42bb 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/multi_region_alter_table_regional_by_row +++ b/pkg/ccl/logictestccl/testdata/logic_test/multi_region_alter_table_regional_by_row @@ -1,4 +1,4 @@ -# tenant-cluster-setting-override-opt: sql.multi_region.allow_abstractions_for_secondary_tenants.enabled=true +# tenant-cluster-setting-override-opt: sql.virtual_cluster.feature_access.multiregion.enabled=true # LogicTest: multiregion-9node-3region-3azs # This file contains a regression test for ALTER TABLE ... REGIONAL BY ROW diff --git a/pkg/ccl/logictestccl/testdata/logic_test/multi_region_backup b/pkg/ccl/logictestccl/testdata/logic_test/multi_region_backup index 7f74b0528a89..a33290bb7b3e 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/multi_region_backup +++ b/pkg/ccl/logictestccl/testdata/logic_test/multi_region_backup @@ -1,4 +1,4 @@ -# tenant-cluster-setting-override-opt: sql.zone_configs.allow_for_secondary_tenant.enabled=true sql.multi_region.allow_abstractions_for_secondary_tenants.enabled=true +# tenant-cluster-setting-override-opt: sql.virtual_cluster.feature_access.zone_configs.enabled=true sql.virtual_cluster.feature_access.multiregion.enabled=true # LogicTest: multiregion-9node-3region-3azs multiregion-9node-3region-3azs-no-los # Tests in this file assume no multi-region tenant setup as tenants have no diff --git a/pkg/ccl/logictestccl/testdata/logic_test/multi_region_default_primary_region b/pkg/ccl/logictestccl/testdata/logic_test/multi_region_default_primary_region index 43abdb4acb29..d65edd9994f6 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/multi_region_default_primary_region +++ b/pkg/ccl/logictestccl/testdata/logic_test/multi_region_default_primary_region @@ -1,4 +1,4 @@ -# tenant-cluster-setting-override-opt: sql.multi_region.allow_abstractions_for_secondary_tenants.enabled=true +# tenant-cluster-setting-override-opt: sql.virtual_cluster.feature_access.multiregion.enabled=true # LogicTest: multiregion-9node-3region-3azs multiregion-9node-3region-3azs-tenant multiregion-9node-3region-3azs-no-los statement ok diff --git a/pkg/ccl/logictestccl/testdata/logic_test/multi_region_drop_region b/pkg/ccl/logictestccl/testdata/logic_test/multi_region_drop_region index d6b4dbba2189..d1f467f64845 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/multi_region_drop_region +++ b/pkg/ccl/logictestccl/testdata/logic_test/multi_region_drop_region @@ -1,4 +1,4 @@ -# tenant-cluster-setting-override-opt: sql.multi_region.allow_abstractions_for_secondary_tenants.enabled=true +# tenant-cluster-setting-override-opt: sql.virtual_cluster.feature_access.multiregion.enabled=true # LogicTest: multiregion-9node-3region-3azs multiregion-9node-3region-3azs-tenant multiregion-9node-3region-3azs-no-los query TTTTT rowsort diff --git a/pkg/ccl/logictestccl/testdata/logic_test/multi_region_foreign_key_lookup_join b/pkg/ccl/logictestccl/testdata/logic_test/multi_region_foreign_key_lookup_join index d4f2b0eb7c23..ab3d92a4b175 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/multi_region_foreign_key_lookup_join +++ b/pkg/ccl/logictestccl/testdata/logic_test/multi_region_foreign_key_lookup_join @@ -1,4 +1,4 @@ -# tenant-cluster-setting-override-opt: sql.multi_region.allow_abstractions_for_secondary_tenants.enabled=true +# tenant-cluster-setting-override-opt: sql.virtual_cluster.feature_access.multiregion.enabled=true # LogicTest: multiregion-9node-3region-3azs !metamorphic-batch-sizes # Set the closed timestamp interval to be short to shorten the amount of time diff --git a/pkg/ccl/logictestccl/testdata/logic_test/multi_region_import_export b/pkg/ccl/logictestccl/testdata/logic_test/multi_region_import_export index 75c0e83ee320..ff2e522ea8ba 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/multi_region_import_export +++ b/pkg/ccl/logictestccl/testdata/logic_test/multi_region_import_export @@ -1,4 +1,4 @@ -# tenant-cluster-setting-override-opt: sql.multi_region.allow_abstractions_for_secondary_tenants.enabled=true +# tenant-cluster-setting-override-opt: sql.virtual_cluster.feature_access.multiregion.enabled=true # LogicTest: multiregion-9node-3region-3azs multiregion-9node-3region-3azs-vec-off multiregion-9node-3region-3azs-no-los # Tests in this file assume no multi-region tenant setup as tenants have no diff --git a/pkg/ccl/logictestccl/testdata/logic_test/multi_region_locality_optimized_search_query_behavior b/pkg/ccl/logictestccl/testdata/logic_test/multi_region_locality_optimized_search_query_behavior index 38c1c717ecb9..7d75151b17a8 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/multi_region_locality_optimized_search_query_behavior +++ b/pkg/ccl/logictestccl/testdata/logic_test/multi_region_locality_optimized_search_query_behavior @@ -1,4 +1,4 @@ -# tenant-cluster-setting-override-opt: sql.multi_region.allow_abstractions_for_secondary_tenants.enabled=true +# tenant-cluster-setting-override-opt: sql.virtual_cluster.feature_access.multiregion.enabled=true # LogicTest: multiregion-9node-3region-3azs # TODO(#75864): enable multiregion-9node-3region-3azs-tenant. diff --git a/pkg/ccl/logictestccl/testdata/logic_test/multi_region_privileges b/pkg/ccl/logictestccl/testdata/logic_test/multi_region_privileges index 219db639ffd0..e0dec2670d60 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/multi_region_privileges +++ b/pkg/ccl/logictestccl/testdata/logic_test/multi_region_privileges @@ -1,4 +1,4 @@ -# tenant-cluster-setting-override-opt: sql.multi_region.allow_abstractions_for_secondary_tenants.enabled=true +# tenant-cluster-setting-override-opt: sql.virtual_cluster.feature_access.multiregion.enabled=true # LogicTest: multiregion-9node-3region-3azs multiregion-9node-3region-3azs-tenant multiregion-9node-3region-3azs-no-los user root diff --git a/pkg/ccl/logictestccl/testdata/logic_test/multi_region_query_behavior b/pkg/ccl/logictestccl/testdata/logic_test/multi_region_query_behavior index aee07b6f85be..7378bc1dcf17 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/multi_region_query_behavior +++ b/pkg/ccl/logictestccl/testdata/logic_test/multi_region_query_behavior @@ -1,4 +1,4 @@ -# tenant-cluster-setting-override-opt: sql.multi_region.allow_abstractions_for_secondary_tenants.enabled=true +# tenant-cluster-setting-override-opt: sql.virtual_cluster.feature_access.multiregion.enabled=true # LogicTest: multiregion-9node-3region-3azs multiregion-9node-3region-3azs-no-los # TODO(#75864): enable multiregion-9node-3region-3azs-tenant. diff --git a/pkg/ccl/logictestccl/testdata/logic_test/multi_region_remote_access_error b/pkg/ccl/logictestccl/testdata/logic_test/multi_region_remote_access_error index ce323d817541..b7a487abaf02 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/multi_region_remote_access_error +++ b/pkg/ccl/logictestccl/testdata/logic_test/multi_region_remote_access_error @@ -1,4 +1,4 @@ -# tenant-cluster-setting-override-opt: sql.multi_region.allow_abstractions_for_secondary_tenants.enabled=true +# tenant-cluster-setting-override-opt: sql.virtual_cluster.feature_access.multiregion.enabled=true # LogicTest: multiregion-9node-3region-3azs multiregion-9node-3region-3azs-vec-off !metamorphic-batch-sizes # Currently this test and other multiregion tests may flake often when run # under the multiregion-9node-3region-3azs-vec-off config, and less often diff --git a/pkg/ccl/logictestccl/testdata/logic_test/multi_region_secondary_tenants_abstractions_disallowed b/pkg/ccl/logictestccl/testdata/logic_test/multi_region_secondary_tenants_abstractions_disallowed index 26cd9c8bf802..3e534b6e8212 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/multi_region_secondary_tenants_abstractions_disallowed +++ b/pkg/ccl/logictestccl/testdata/logic_test/multi_region_secondary_tenants_abstractions_disallowed @@ -1,10 +1,10 @@ # LogicTest: multiregion-9node-3region-3azs-tenant -statement error pq: setting sql.multi_region.allow_abstractions_for_secondary_tenants.enabled disallows use of multi-region abstractions +statement error pq: setting sql.virtual_cluster.feature_access.multiregion.enabled disallows use of multi-region abstractions CREATE DATABASE db PRIMARY REGION "us-east1" statement ok CREATE DATABASE db -statement error pq: setting sql.multi_region.allow_abstractions_for_secondary_tenants.enabled disallows use of multi-region abstractions +statement error pq: setting sql.virtual_cluster.feature_access.multiregion.enabled disallows use of multi-region abstractions ALTER DATABASE db SET PRIMARY REGION "us-east-1" diff --git a/pkg/ccl/logictestccl/testdata/logic_test/multi_region_show b/pkg/ccl/logictestccl/testdata/logic_test/multi_region_show index 63e667c50afc..bd4f71fe161e 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/multi_region_show +++ b/pkg/ccl/logictestccl/testdata/logic_test/multi_region_show @@ -1,4 +1,4 @@ -# tenant-cluster-setting-override-opt: sql.multi_region.allow_abstractions_for_secondary_tenants.enabled=true +# tenant-cluster-setting-override-opt: sql.virtual_cluster.feature_access.multiregion.enabled=true # LogicTest: multiregion-9node-3region-3azs multiregion-9node-3region-3azs-tenant multiregion-9node-3region-3azs-no-los statement ok diff --git a/pkg/ccl/logictestccl/testdata/logic_test/multi_region_survival_goal b/pkg/ccl/logictestccl/testdata/logic_test/multi_region_survival_goal index d973fb5d09db..97c89880927f 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/multi_region_survival_goal +++ b/pkg/ccl/logictestccl/testdata/logic_test/multi_region_survival_goal @@ -1,4 +1,4 @@ -# tenant-cluster-setting-override-opt: sql.multi_region.allow_abstractions_for_secondary_tenants.enabled=true +# tenant-cluster-setting-override-opt: sql.virtual_cluster.feature_access.multiregion.enabled=true # knob-opt: sync-event-log # LogicTest: multiregion-9node-3region-3azs-tenant diff --git a/pkg/ccl/logictestccl/testdata/logic_test/multi_region_system_database b/pkg/ccl/logictestccl/testdata/logic_test/multi_region_system_database index ab613f7355fd..e3d04ae4a13f 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/multi_region_system_database +++ b/pkg/ccl/logictestccl/testdata/logic_test/multi_region_system_database @@ -1,5 +1,5 @@ # LogicTest: 3node-tenant-multiregion -# tenant-cluster-setting-override-opt: sql.multi_region.allow_abstractions_for_secondary_tenants.enabled=true +# tenant-cluster-setting-override-opt: sql.virtual_cluster.feature_access.multiregion.enabled=true # Only the root user can modify the system database's regions. user root diff --git a/pkg/ccl/logictestccl/testdata/logic_test/multi_region_zone_config_extensions b/pkg/ccl/logictestccl/testdata/logic_test/multi_region_zone_config_extensions index 25878e1f60f1..0b513555f76a 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/multi_region_zone_config_extensions +++ b/pkg/ccl/logictestccl/testdata/logic_test/multi_region_zone_config_extensions @@ -1,4 +1,4 @@ -# tenant-cluster-setting-override-opt: sql.multi_region.allow_abstractions_for_secondary_tenants.enabled=true +# tenant-cluster-setting-override-opt: sql.virtual_cluster.feature_access.multiregion.enabled=true # LogicTest: multiregion-9node-3region-3azs multiregion-9node-3region-3azs-tenant query TTTTT rowsort diff --git a/pkg/ccl/logictestccl/testdata/logic_test/multi_region_zone_configs b/pkg/ccl/logictestccl/testdata/logic_test/multi_region_zone_configs index e2f6ae89d7d5..036b6b277d10 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/multi_region_zone_configs +++ b/pkg/ccl/logictestccl/testdata/logic_test/multi_region_zone_configs @@ -1,4 +1,4 @@ -# tenant-cluster-setting-override-opt: sql.zone_configs.allow_for_secondary_tenant.enabled=true sql.multi_region.allow_abstractions_for_secondary_tenants.enabled=true +# tenant-cluster-setting-override-opt: sql.virtual_cluster.feature_access.zone_configs.enabled=true sql.virtual_cluster.feature_access.multiregion.enabled=true # LogicTest: multiregion-9node-3region-3azs multiregion-9node-3region-3azs-tenant multiregion-9node-3region-3azs-no-los query TTTTT rowsort diff --git a/pkg/ccl/logictestccl/testdata/logic_test/multi_region_zone_configs_long_regions b/pkg/ccl/logictestccl/testdata/logic_test/multi_region_zone_configs_long_regions index bd0b28b5937b..b9228bdb12fb 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/multi_region_zone_configs_long_regions +++ b/pkg/ccl/logictestccl/testdata/logic_test/multi_region_zone_configs_long_regions @@ -1,4 +1,4 @@ -# tenant-cluster-setting-override-opt: sql.multi_region.allow_abstractions_for_secondary_tenants.enabled=true +# tenant-cluster-setting-override-opt: sql.virtual_cluster.feature_access.multiregion.enabled=true # LogicTest: multiregion-3node-3superlongregions query TTTTT rowsort diff --git a/pkg/ccl/logictestccl/testdata/logic_test/partitioning b/pkg/ccl/logictestccl/testdata/logic_test/partitioning index 2aa6fc04c4e1..3647e9882ed0 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/partitioning +++ b/pkg/ccl/logictestccl/testdata/logic_test/partitioning @@ -1,4 +1,4 @@ -# tenant-cluster-setting-override-opt: sql.zone_configs.allow_for_secondary_tenant.enabled=true +# tenant-cluster-setting-override-opt: sql.virtual_cluster.feature_access.zone_configs.enabled=true # LogicTest: local statement error syntax diff --git a/pkg/ccl/logictestccl/testdata/logic_test/partitioning_hash_sharded_index_mr b/pkg/ccl/logictestccl/testdata/logic_test/partitioning_hash_sharded_index_mr index f0d6924a4f4a..be7066ff63ea 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/partitioning_hash_sharded_index_mr +++ b/pkg/ccl/logictestccl/testdata/logic_test/partitioning_hash_sharded_index_mr @@ -1,4 +1,4 @@ -# tenant-cluster-setting-override-opt: sql.multi_region.allow_abstractions_for_secondary_tenants.enabled=true +# tenant-cluster-setting-override-opt: sql.virtual_cluster.feature_access.multiregion.enabled=true # LogicTest: multiregion-9node-3region-3azs multiregion-9node-3region-3azs-tenant multiregion-9node-3region-3azs-no-los statement ok diff --git a/pkg/ccl/logictestccl/testdata/logic_test/placement b/pkg/ccl/logictestccl/testdata/logic_test/placement index ae033c54dd06..b50fc4306b78 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/placement +++ b/pkg/ccl/logictestccl/testdata/logic_test/placement @@ -1,4 +1,4 @@ -# tenant-cluster-setting-override-opt: sql.multi_region.allow_abstractions_for_secondary_tenants.enabled=true +# tenant-cluster-setting-override-opt: sql.virtual_cluster.feature_access.multiregion.enabled=true # LogicTest: multiregion-9node-3region-3azs multiregion-9node-3region-3azs-vec-off multiregion-9node-3region-3azs-no-los statement error PLACEMENT requires that the session setting enable_multiregion_placement_policy is enabled diff --git a/pkg/ccl/logictestccl/testdata/logic_test/regional_by_row b/pkg/ccl/logictestccl/testdata/logic_test/regional_by_row index a8a4b9eb2df1..88dd525b7040 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/regional_by_row +++ b/pkg/ccl/logictestccl/testdata/logic_test/regional_by_row @@ -1,4 +1,4 @@ -# tenant-cluster-setting-override-opt: sql.zone_configs.allow_for_secondary_tenant.enabled=true sql.multi_region.allow_abstractions_for_secondary_tenants.enabled=true +# tenant-cluster-setting-override-opt: sql.virtual_cluster.feature_access.zone_configs.enabled=true sql.virtual_cluster.feature_access.multiregion.enabled=true # LogicTest: multiregion-9node-3region-3azs multiregion-9node-3region-3azs-vec-off multiregion-9node-3region-3azs-tenant multiregion-9node-3region-3azs-no-los statement ok diff --git a/pkg/ccl/logictestccl/testdata/logic_test/regional_by_row_auto_rehoming b/pkg/ccl/logictestccl/testdata/logic_test/regional_by_row_auto_rehoming index a1ad9464bd06..17c8ae1fdc23 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/regional_by_row_auto_rehoming +++ b/pkg/ccl/logictestccl/testdata/logic_test/regional_by_row_auto_rehoming @@ -1,4 +1,4 @@ -# tenant-cluster-setting-override-opt: sql.multi_region.allow_abstractions_for_secondary_tenants.enabled=true +# tenant-cluster-setting-override-opt: sql.virtual_cluster.feature_access.multiregion.enabled=true # LogicTest: multiregion-9node-3region-3azs multiregion-9node-3region-3azs-tenant multiregion-9node-3region-3azs-no-los statement ok diff --git a/pkg/ccl/logictestccl/testdata/logic_test/regional_by_row_hash_sharded_index b/pkg/ccl/logictestccl/testdata/logic_test/regional_by_row_hash_sharded_index index b4b6d2af579f..f60d0562021b 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/regional_by_row_hash_sharded_index +++ b/pkg/ccl/logictestccl/testdata/logic_test/regional_by_row_hash_sharded_index @@ -1,4 +1,4 @@ -# tenant-cluster-setting-override-opt: sql.multi_region.allow_abstractions_for_secondary_tenants.enabled=true +# tenant-cluster-setting-override-opt: sql.virtual_cluster.feature_access.multiregion.enabled=true # LogicTest: multiregion-9node-3region-3azs multiregion-9node-3region-3azs-no-los statement ok diff --git a/pkg/ccl/logictestccl/testdata/logic_test/regional_by_row_hash_sharded_index_query_plan b/pkg/ccl/logictestccl/testdata/logic_test/regional_by_row_hash_sharded_index_query_plan index 3dc879817114..bb67d55bd57e 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/regional_by_row_hash_sharded_index_query_plan +++ b/pkg/ccl/logictestccl/testdata/logic_test/regional_by_row_hash_sharded_index_query_plan @@ -1,4 +1,4 @@ -# tenant-cluster-setting-override-opt: sql.multi_region.allow_abstractions_for_secondary_tenants.enabled=true +# tenant-cluster-setting-override-opt: sql.virtual_cluster.feature_access.multiregion.enabled=true # LogicTest: multiregion-9node-3region-3azs !metamorphic-batch-sizes # TODO(#75864): enable multiregion-9node-3region-3azs-tenant diff --git a/pkg/ccl/logictestccl/testdata/logic_test/regional_by_row_placement_restricted b/pkg/ccl/logictestccl/testdata/logic_test/regional_by_row_placement_restricted index fe6b5e66d2ca..70e369ba79a0 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/regional_by_row_placement_restricted +++ b/pkg/ccl/logictestccl/testdata/logic_test/regional_by_row_placement_restricted @@ -1,4 +1,4 @@ -# tenant-cluster-setting-override-opt: sql.multi_region.allow_abstractions_for_secondary_tenants.enabled=true +# tenant-cluster-setting-override-opt: sql.virtual_cluster.feature_access.multiregion.enabled=true # LogicTest: multiregion-9node-3region-3azs multiregion-9node-3region-3azs-vec-off multiregion-9node-3region-3azs-tenant multiregion-9node-3region-3azs-no-los statement ok diff --git a/pkg/ccl/logictestccl/testdata/logic_test/regional_by_row_query_behavior b/pkg/ccl/logictestccl/testdata/logic_test/regional_by_row_query_behavior index 61a09ca2659c..187ebf7834c6 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/regional_by_row_query_behavior +++ b/pkg/ccl/logictestccl/testdata/logic_test/regional_by_row_query_behavior @@ -1,4 +1,4 @@ -# tenant-cluster-setting-override-opt: sql.multi_region.allow_abstractions_for_secondary_tenants.enabled=true +# tenant-cluster-setting-override-opt: sql.virtual_cluster.feature_access.multiregion.enabled=true # LogicTest: multiregion-9node-3region-3azs !metamorphic-batch-sizes # TODO(#75864): enable multiregion-9node-3region-3azs-tenant and/or revert # the commit that split these changes out. diff --git a/pkg/ccl/logictestccl/testdata/logic_test/regional_by_row_rename_column b/pkg/ccl/logictestccl/testdata/logic_test/regional_by_row_rename_column index 13d0d476e40e..299d97270cb7 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/regional_by_row_rename_column +++ b/pkg/ccl/logictestccl/testdata/logic_test/regional_by_row_rename_column @@ -1,4 +1,4 @@ -# tenant-cluster-setting-override-opt: sql.multi_region.allow_abstractions_for_secondary_tenants.enabled=true +# tenant-cluster-setting-override-opt: sql.virtual_cluster.feature_access.multiregion.enabled=true # LogicTest: multiregion-9node-3region-3azs multiregion-9node-3region-3azs-vec-off multiregion-9node-3region-3azs-tenant multiregion-9node-3region-3azs-no-los # This test seems to flake (#60717). diff --git a/pkg/ccl/logictestccl/testdata/logic_test/regional_by_table_placement_restricted b/pkg/ccl/logictestccl/testdata/logic_test/regional_by_table_placement_restricted index 38720002d760..ba196ef3426f 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/regional_by_table_placement_restricted +++ b/pkg/ccl/logictestccl/testdata/logic_test/regional_by_table_placement_restricted @@ -1,4 +1,4 @@ -# tenant-cluster-setting-override-opt: sql.multi_region.allow_abstractions_for_secondary_tenants.enabled=true +# tenant-cluster-setting-override-opt: sql.virtual_cluster.feature_access.multiregion.enabled=true # LogicTest: multiregion-9node-3region-3azs multiregion-9node-3region-3azs-vec-off multiregion-9node-3region-3azs-tenant multiregion-9node-3region-3azs-no-los statement ok diff --git a/pkg/ccl/logictestccl/testdata/logic_test/secondary_region b/pkg/ccl/logictestccl/testdata/logic_test/secondary_region index ff5311d8b846..1c79b165b4bb 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/secondary_region +++ b/pkg/ccl/logictestccl/testdata/logic_test/secondary_region @@ -1,4 +1,4 @@ -# tenant-cluster-setting-override-opt: sql.multi_region.allow_abstractions_for_secondary_tenants.enabled=true +# tenant-cluster-setting-override-opt: sql.virtual_cluster.feature_access.multiregion.enabled=true # LogicTest: multiregion-15node-5region-3azs query TTTTT colnames,rowsort diff --git a/pkg/ccl/logictestccl/testdata/logic_test/super_regions b/pkg/ccl/logictestccl/testdata/logic_test/super_regions index fb8438e00bbb..00377182d1eb 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/super_regions +++ b/pkg/ccl/logictestccl/testdata/logic_test/super_regions @@ -1,4 +1,4 @@ -# tenant-cluster-setting-override-opt: sql.multi_region.allow_abstractions_for_secondary_tenants.enabled=true +# tenant-cluster-setting-override-opt: sql.virtual_cluster.feature_access.multiregion.enabled=true # LogicTest: multiregion-15node-5region-3azs statement ok diff --git a/pkg/ccl/logictestccl/testdata/logic_test/super_regions_backup b/pkg/ccl/logictestccl/testdata/logic_test/super_regions_backup index 084b56f29cd4..8cdabef73276 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/super_regions_backup +++ b/pkg/ccl/logictestccl/testdata/logic_test/super_regions_backup @@ -1,4 +1,4 @@ -# tenant-cluster-setting-override-opt: sql.multi_region.allow_abstractions_for_secondary_tenants.enabled=true +# tenant-cluster-setting-override-opt: sql.virtual_cluster.feature_access.multiregion.enabled=true # LogicTest: multiregion-15node-5region-3azs statement ok diff --git a/pkg/ccl/logictestccl/testdata/logic_test/super_regions_cluster_settings b/pkg/ccl/logictestccl/testdata/logic_test/super_regions_cluster_settings index 8b5d8ee7bf43..01427d38891c 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/super_regions_cluster_settings +++ b/pkg/ccl/logictestccl/testdata/logic_test/super_regions_cluster_settings @@ -1,4 +1,4 @@ -# tenant-cluster-setting-override-opt: sql.multi_region.allow_abstractions_for_secondary_tenants.enabled=true +# tenant-cluster-setting-override-opt: sql.virtual_cluster.feature_access.multiregion.enabled=true # LogicTest: multiregion-15node-5region-3azs statement ok diff --git a/pkg/ccl/logictestccl/testdata/logic_test/zone_config_secondary_tenants b/pkg/ccl/logictestccl/testdata/logic_test/zone_config_secondary_tenants index 1fad9ed8391f..ebe755100b28 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/zone_config_secondary_tenants +++ b/pkg/ccl/logictestccl/testdata/logic_test/zone_config_secondary_tenants @@ -1,5 +1,5 @@ # LogicTest: 3node-tenant -# tenant-cluster-setting-override-opt: sql.zone_configs.allow_for_secondary_tenant.enabled=true +# tenant-cluster-setting-override-opt: sql.virtual_cluster.feature_access.zone_configs.enabled=true # Zone config logic tests that are only meant to work for secondary tenants. statement ok diff --git a/pkg/ccl/logictestccl/testdata/logic_test/zone_config_secondary_tenants_disallowed b/pkg/ccl/logictestccl/testdata/logic_test/zone_config_secondary_tenants_disallowed index 432604971004..5c6e7ce107c3 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/zone_config_secondary_tenants_disallowed +++ b/pkg/ccl/logictestccl/testdata/logic_test/zone_config_secondary_tenants_disallowed @@ -6,5 +6,5 @@ statement error pq: unimplemented: operation is unsupported in multi-tenancy mode ALTER TABLE t CONFIGURE ZONE USING num_replicas = 5; -statement error setting sql.zone_configs.allow_for_secondary_tenant.enabled is only settable by the operator -SET CLUSTER SETTING sql.zone_configs.allow_for_secondary_tenant.enabled = true +statement error setting sql.virtual_cluster.feature_access.zone_configs.enabled is only settable by the operator +SET CLUSTER SETTING sql.virtual_cluster.feature_access.zone_configs.enabled = true diff --git a/pkg/ccl/multiregionccl/cold_start_latency_test.go b/pkg/ccl/multiregionccl/cold_start_latency_test.go index 53a01d0e100f..88e412205b3b 100644 --- a/pkg/ccl/multiregionccl/cold_start_latency_test.go +++ b/pkg/ccl/multiregionccl/cold_start_latency_test.go @@ -164,8 +164,8 @@ func TestColdStartLatency(t *testing.T) { var stmts []string if !isTenant { stmts = []string{ - "ALTER TENANT ALL SET CLUSTER SETTING sql.zone_configs.allow_for_secondary_tenant.enabled = true", - "ALTER TENANT ALL SET CLUSTER SETTING sql.multi_region.allow_abstractions_for_secondary_tenants.enabled = true", + "ALTER TENANT ALL SET CLUSTER SETTING sql.virtual_cluster.feature_access.zone_configs.enabled = true", + "ALTER TENANT ALL SET CLUSTER SETTING sql.virtual_cluster.feature_access.multiregion.enabled = true", `alter range meta configure zone using constraints = '{"+region=us-east1": 1, "+region=us-west1": 1, "+region=europe-west1": 1}';`, } } else { diff --git a/pkg/ccl/multiregionccl/regional_by_row_system_database_test.go b/pkg/ccl/multiregionccl/regional_by_row_system_database_test.go index 0c8c52953ec1..7835d3db8cb3 100644 --- a/pkg/ccl/multiregionccl/regional_by_row_system_database_test.go +++ b/pkg/ccl/multiregionccl/regional_by_row_system_database_test.go @@ -36,7 +36,7 @@ func TestRegionalByRowTablesInTheSystemDatabase(t *testing.T) { sqlutils.MakeSQLRunner(sqlDB).Exec(t, ` ALTER TENANT ALL SET CLUSTER SETTING -sql.multi_region.allow_abstractions_for_secondary_tenants.enabled = true;`) +sql.virtual_cluster.feature_access.multiregion.enabled = true;`) tenant, tenantDB := serverutils.StartTenant(t, tc.Server(0), base.TestTenantArgs{ TenantName: "test", TenantID: serverutils.TestTenantID(), diff --git a/pkg/ccl/multitenantccl/tenantcostclient/BUILD.bazel b/pkg/ccl/multitenantccl/tenantcostclient/BUILD.bazel index 507449e87e93..83358e311ecd 100644 --- a/pkg/ccl/multitenantccl/tenantcostclient/BUILD.bazel +++ b/pkg/ccl/multitenantccl/tenantcostclient/BUILD.bazel @@ -20,6 +20,7 @@ go_library( "//pkg/server", "//pkg/settings", "//pkg/settings/cluster", + "//pkg/sql/execinfra", "//pkg/sql/sqlliveness", "//pkg/util/log", "//pkg/util/quotapool", diff --git a/pkg/ccl/multitenantccl/tenantcostclient/tenant_side.go b/pkg/ccl/multitenantccl/tenantcostclient/tenant_side.go index ba59326fe415..dbc9dbb78594 100644 --- a/pkg/ccl/multitenantccl/tenantcostclient/tenant_side.go +++ b/pkg/ccl/multitenantccl/tenantcostclient/tenant_side.go @@ -22,6 +22,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/server" "github.com/cockroachdb/cockroach/pkg/settings" "github.com/cockroachdb/cockroach/pkg/settings/cluster" + "github.com/cockroachdb/cockroach/pkg/sql/execinfra" "github.com/cockroachdb/cockroach/pkg/sql/sqlliveness" "github.com/cockroachdb/cockroach/pkg/util/log" "github.com/cockroachdb/cockroach/pkg/util/stop" @@ -37,8 +38,9 @@ import ( var TargetPeriodSetting = settings.RegisterDurationSetting( settings.TenantReadOnly, "tenant_cost_control_period", - "target duration between token bucket requests from tenants (requires restart)", + "target duration between token bucket requests (requires restart)", 10*time.Second, + settings.WithName("tenant_cost_control.token_request_period"), settings.DurationInRange(5*time.Second, 120*time.Second), ) @@ -50,6 +52,7 @@ var CPUUsageAllowance = settings.RegisterDurationSetting( "doesn't contribute to consumption; for example, if it is set to 10ms, "+ "that corresponds to 1% of a CPU", 10*time.Millisecond, + settings.WithName("tenant_cost_control.cpu_usage_allowance"), settings.DurationInRange(0, 1000*time.Millisecond), ) @@ -62,6 +65,7 @@ var ExternalIORUAccountingMode = *settings.RegisterStringSetting( "'nowait' (external IO RUs are accounted for but callers do not wait for RUs), "+ "and 'off' (no external IO RU accounting)", "on", + settings.WithName("tenant_cost_control.external_io.ru_accounting_mode"), settings.WithValidateString(func(_ *settings.Values, s string) error { switch s { case "on", "off", "nowait": @@ -787,7 +791,7 @@ func (c *tenantSideCostController) OnResponseWait( } // Record the number of RUs consumed by the IO request. - if multitenant.TenantRUEstimateEnabled.Get(&c.settings.SV) { + if execinfra.IncludeRUEstimateInExplainAnalyze.Get(&c.settings.SV) { if sp := tracing.SpanFromContext(ctx); sp != nil && sp.RecordingType() != tracingpb.RecordingOff { sp.RecordStructured(&kvpb.TenantConsumption{ diff --git a/pkg/ccl/multitenantccl/tenantcostclient/tenant_side_test.go b/pkg/ccl/multitenantccl/tenantcostclient/tenant_side_test.go index a1c53c56dabf..73f64e50e900 100644 --- a/pkg/ccl/multitenantccl/tenantcostclient/tenant_side_test.go +++ b/pkg/ccl/multitenantccl/tenantcostclient/tenant_side_test.go @@ -1301,11 +1301,10 @@ func BenchmarkExternalIOAccounting(b *testing.B) { nullsink.NullRequiresExternalIOAccounting = true setRUAccountingMode := func(b *testing.B, mode string) { - _, err := hostSQL.Exec(fmt.Sprintf("SET CLUSTER SETTING tenant_external_io_ru_accounting_mode = '%s'", mode)) + _, err := hostSQL.Exec(fmt.Sprintf("SET CLUSTER SETTING tenant_cost_control.external_io.ru_accounting_mode = '%s'", mode)) require.NoError(b, err) - _, err = hostSQL.Exec(`UPSERT INTO system.tenant_settings (tenant_id, name, value, value_type) VALUES ($1, $2, $3, $4)`, - 0, "tenant_external_io_ru_accounting_mode", mode, "s") + _, err = hostSQL.Exec(fmt.Sprintf("ALTER TENANT ALL SET CLUSTER SETTING tenant_cost_control.external_io.ru_accounting_mode = '%s'", mode)) require.NoError(b, err) } diff --git a/pkg/ccl/multitenantccl/tenantcostserver/server.go b/pkg/ccl/multitenantccl/tenantcostserver/server.go index 3a4911e90013..d53f110ac87c 100644 --- a/pkg/ccl/multitenantccl/tenantcostserver/server.go +++ b/pkg/ccl/multitenantccl/tenantcostserver/server.go @@ -35,9 +35,11 @@ type instance struct { var instanceInactivity = settings.RegisterDurationSetting( settings.TenantWritable, "tenant_usage_instance_inactivity", - "instances that have not reported consumption for longer than this value are cleaned up; "+ - "should be at least four times higher than the tenant_cost_control_period of any tenant", - 1*time.Minute, settings.PositiveDuration, + "server instances that have not reported consumption for longer than this value are cleaned up; "+ + "should be at least four times higher than the tenant_cost_control.token_request_period of any tenant", + 1*time.Minute, + settings.PositiveDuration, + settings.WithName("tenant_cost_control.instance_inactivity.timeout"), ) func newInstance( diff --git a/pkg/ccl/serverccl/admin_test.go b/pkg/ccl/serverccl/admin_test.go index 0027bde0f4ca..b8f3a4c55dca 100644 --- a/pkg/ccl/serverccl/admin_test.go +++ b/pkg/ccl/serverccl/admin_test.go @@ -63,7 +63,7 @@ func TestAdminAPIDataDistributionPartitioning(t *testing.T) { // Enable zone configs for secondary tenants. systemSqlDb := firstServer.SystemLayer().SQLConn(t, "system") - _, err := systemSqlDb.Exec("ALTER TENANT ALL SET CLUSTER SETTING sql.zone_configs.allow_for_secondary_tenant.enabled = true") + _, err := systemSqlDb.Exec("ALTER TENANT ALL SET CLUSTER SETTING sql.virtual_cluster.feature_access.zone_configs.enabled = true") require.NoError(t, err) sqlDB := sqlutils.MakeSQLRunner(testCluster.ServerConn(0)) diff --git a/pkg/ccl/serverccl/shared_process_tenant_test.go b/pkg/ccl/serverccl/shared_process_tenant_test.go index 56a8a727617a..29fbea4cbb97 100644 --- a/pkg/ccl/serverccl/shared_process_tenant_test.go +++ b/pkg/ccl/serverccl/shared_process_tenant_test.go @@ -37,7 +37,7 @@ func TestSharedProcessTenantNoSpanLimit(t *testing.T) { _, err := db.Exec("CREATE TENANT hello; ALTER TENANT hello START SERVICE SHARED") require.NoError(t, err) - _, err = db.Exec("ALTER TENANT ALL SET CLUSTER SETTING spanconfig.tenant_limit = 1000") + _, err = db.Exec("ALTER TENANT ALL SET CLUSTER SETTING spanconfig.virtual_cluster.max_spans = 1000") require.NoError(t, err) var tenantDB *gosql.DB diff --git a/pkg/ccl/spanconfigccl/spanconfiglimiterccl/datadriven_test.go b/pkg/ccl/spanconfigccl/spanconfiglimiterccl/datadriven_test.go index 8f2e8332ab57..f8765b3be6ed 100644 --- a/pkg/ccl/spanconfigccl/spanconfiglimiterccl/datadriven_test.go +++ b/pkg/ccl/spanconfigccl/spanconfiglimiterccl/datadriven_test.go @@ -60,7 +60,7 @@ func TestDataDriven(t *testing.T) { // TODO(irfansharif): This is a stop-gap for tenant read-only cluster // settings. See https://github.com/cockroachdb/cockroach/pull/76929. Once // that's done, this test should be updated to use: - // SET CLUSTER SETTING spanconfig.tenant_limit = + // SET CLUSTER SETTING spanconfig.virtual_cluster.max_spans = limitOverride := 50 scKnobs := &spanconfig.TestingKnobs{ // Instead of relying on the GC job to wait out TTLs and clear out diff --git a/pkg/ccl/streamingccl/replicationtestutils/testutils.go b/pkg/ccl/streamingccl/replicationtestutils/testutils.go index 4b565b278253..4b6ed8c8bd9e 100644 --- a/pkg/ccl/streamingccl/replicationtestutils/testutils.go +++ b/pkg/ccl/streamingccl/replicationtestutils/testutils.go @@ -130,8 +130,8 @@ func (c *TenantStreamingClusters) setupSrcTenant() { func (c *TenantStreamingClusters) init() { c.SrcSysSQL.ExecMultiple(c.T, ConfigureClusterSettings(c.Args.SrcClusterSettings)...) - c.SrcSysSQL.Exec(c.T, `ALTER TENANT $1 SET CLUSTER SETTING sql.split_at.allow_for_secondary_tenant.enabled=true`, c.Args.SrcTenantName) - c.SrcSysSQL.Exec(c.T, `ALTER TENANT $1 SET CLUSTER SETTING sql.scatter.allow_for_secondary_tenant.enabled=true`, c.Args.SrcTenantName) + c.SrcSysSQL.Exec(c.T, `ALTER TENANT $1 SET CLUSTER SETTING sql.virtual_cluster.feature_access.manual_range_split.enabled=true`, c.Args.SrcTenantName) + c.SrcSysSQL.Exec(c.T, `ALTER TENANT $1 SET CLUSTER SETTING sql.virtual_cluster.feature_access.manual_range_scatter.enabled=true`, c.Args.SrcTenantName) if c.Args.SrcInitFunc != nil { c.Args.SrcInitFunc(c.T, c.SrcSysSQL, c.SrcTenantSQL) } diff --git a/pkg/ccl/testccl/sqlstatsccl/sql_stats_test.go b/pkg/ccl/testccl/sqlstatsccl/sql_stats_test.go index 4f33f82b018e..47de04fa7dc9 100644 --- a/pkg/ccl/testccl/sqlstatsccl/sql_stats_test.go +++ b/pkg/ccl/testccl/sqlstatsccl/sql_stats_test.go @@ -110,8 +110,8 @@ func TestSQLStatsRegions(t *testing.T) { tdb.Exec(t, `SET CLUSTER SETTING kv.closed_timestamp.lead_for_global_reads_override = '500ms'`) tdb.Exec(t, `ALTER TENANT ALL SET CLUSTER SETTING spanconfig.reconciliation_job.checkpoint_interval = '500ms'`) - tdb.Exec(t, "ALTER TENANT ALL SET CLUSTER SETTING sql.zone_configs.allow_for_secondary_tenant.enabled = true") - tdb.Exec(t, "ALTER TENANT ALL SET CLUSTER SETTING sql.multi_region.allow_abstractions_for_secondary_tenants.enabled = true") + tdb.Exec(t, "ALTER TENANT ALL SET CLUSTER SETTING sql.virtual_cluster.feature_access.zone_configs.enabled = true") + tdb.Exec(t, "ALTER TENANT ALL SET CLUSTER SETTING sql.virtual_cluster.feature_access.multiregion.enabled = true") tdb.Exec(t, `ALTER RANGE meta configure zone using constraints = '{"+region=gcp-us-west1": 1, "+region=gcp-us-central1": 1, "+region=gcp-us-east1": 1}';`) // Create secondary tenants diff --git a/pkg/cli/democluster/demo_cluster.go b/pkg/cli/democluster/demo_cluster.go index d8e7ebe8d728..55aefd8622b2 100644 --- a/pkg/cli/democluster/demo_cluster.go +++ b/pkg/cli/democluster/demo_cluster.go @@ -447,7 +447,7 @@ func (c *transientCluster) Start(ctx context.Context) (err error) { // Choose the tenant to use when no tenant is specified on a // connection or web URL. if _, err := ie.Exec(ctx, "default-tenant", nil, - `SET CLUSTER SETTING `+multitenant.DefaultTenantSelectSettingName+` = $1`, + `SET CLUSTER SETTING `+multitenant.DefaultClusterSelectSettingName+` = $1`, demoTenantName); err != nil { return err } diff --git a/pkg/configprofiles/profiles.go b/pkg/configprofiles/profiles.go index 4ba768432343..45bf773d60ff 100644 --- a/pkg/configprofiles/profiles.go +++ b/pkg/configprofiles/profiles.go @@ -83,15 +83,15 @@ var virtClusterInitTasks = []autoconfigpb.Task{ makeTask("initial cluster config", /* nonTxnSQL */ []string{ // Disable trace redaction (this ought to be configurable per-tenant, but is not possible yet in v23.1). - "SET CLUSTER SETTING server.secondary_tenants.redact_trace.enabled = false", + "SET CLUSTER SETTING trace.redact_at_virtual_cluster_boundary.enabled = false", // Enable zone config changes in secondary tenants (this ought to be configurable per-tenant, but is not possible yet in v23.1). - "SET CLUSTER SETTING sql.zone_configs.allow_for_secondary_tenant.enabled = true", + "SET CLUSTER SETTING sql.virtual_cluster.feature_access.zone_configs.enabled = true", // Enable multi-region abstractions in secondary tenants. - "SET CLUSTER SETTING sql.multi_region.allow_abstractions_for_secondary_tenants.enabled = true", + "SET CLUSTER SETTING sql.virtual_cluster.feature_access.multiregion.enabled = true", // Disable range coalescing (as long as the problems related // to range coalescing have not been solved yet). - "SET CLUSTER SETTING spanconfig.storage_coalesce_adjacent.enabled = false", - "SET CLUSTER SETTING spanconfig.tenant_coalesce_adjacent.enabled = false", + "SET CLUSTER SETTING spanconfig.range_coalescing.system.enabled = false", + "SET CLUSTER SETTING spanconfig.range_coalescing.application.enabled = false", // Make the operator double-check virtual cluster deletions. "SET CLUSTER SETTING sql.drop_virtual_cluster.enabled = false", }, @@ -106,14 +106,14 @@ var virtClusterInitTasks = []autoconfigpb.Task{ "ALTER VIRTUAL CLUSTER template GRANT ALL CAPABILITIES", // Enable admin scatter/split in tenant SQL. // TODO(knz): Move this to in-tenant config task. - "ALTER VIRTUAL CLUSTER template SET CLUSTER SETTING sql.scatter.allow_for_secondary_tenant.enabled = true", - "ALTER VIRTUAL CLUSTER template SET CLUSTER SETTING sql.split_at.allow_for_secondary_tenant.enabled = true", + "ALTER VIRTUAL CLUSTER template SET CLUSTER SETTING sql.virtual_cluster.feature_access.manual_range_scatter.enabled = true", + "ALTER VIRTUAL CLUSTER template SET CLUSTER SETTING sql.virtual_cluster.feature_access.manual_range_split.enabled = true", }, ), // Finally. makeTask("use the application virtual cluster template by default in CREATE VIRTUAL CLSUTER", /* nonTxnSQL */ []string{ - "SET CLUSTER SETTING sql.create_tenant.default_template = 'template'", + "SET CLUSTER SETTING sql.create_virtual_cluster.default_template = 'template'", }, nil, /* txnSQL */ ), @@ -133,7 +133,7 @@ var virtClusterWithAppServiceInitTasks = append( makeTask("activate application virtual cluster", /* nonTxnSQL */ []string{ // Make the app tenant receive SQL connections by default. - "SET CLUSTER SETTING server.controller.default_tenant = 'application'", + "SET CLUSTER SETTING server.controller.default_target_cluster = 'application'", }, nil, /* txnSQL */ ), diff --git a/pkg/configprofiles/testdata/virtual-app b/pkg/configprofiles/testdata/virtual-app index b4b09dcf2c76..a501446e2a87 100644 --- a/pkg/configprofiles/testdata/virtual-app +++ b/pkg/configprofiles/testdata/virtual-app @@ -12,15 +12,14 @@ ok system-sql SELECT variable, value FROM [SHOW ALL CLUSTER SETTINGS] WHERE variable IN ( -'server.secondary_tenants.redact_trace.enabled', -'sql.zone_configs.allow_for_secondary_tenant.enabled', -'sql.multi_region.allow_abstractions_for_secondary_tenants.enabled', -'sql.multi_region.allow_abstractions_for_secondary_tenants.enabled', -'spanconfig.storage_coalesce_adjacent.enabled', -'spanconfig.tenant_coalesce_adjacent.enabled', +'trace.redact_at_virtual_cluster_boundary.enabled', +'sql.virtual_cluster.feature_access.zone_configs.enabled', +'sql.virtual_cluster.feature_access.multiregion.enabled', +'spanconfig.range_coalescing.system.enabled', +'spanconfig.range_coalescing.application.enabled', 'sql.drop_virtual_cluster.enabled', -'sql.create_tenant.default_template', -'server.controller.default_tenant', +'sql.create_virtual_cluster.default_template', +'server.controller.default_target_cluster', 'kv.rangefeed.enabled', 'cross_cluster_replication.enabled' ) @@ -28,14 +27,14 @@ ORDER BY variable ---- cross_cluster_replication.enabled false kv.rangefeed.enabled false -server.controller.default_tenant application -server.secondary_tenants.redact_trace.enabled false -spanconfig.storage_coalesce_adjacent.enabled false -spanconfig.tenant_coalesce_adjacent.enabled false -sql.create_tenant.default_template template +server.controller.default_target_cluster application +spanconfig.range_coalescing.application.enabled false +spanconfig.range_coalescing.system.enabled false +sql.create_virtual_cluster.default_template template sql.drop_virtual_cluster.enabled false -sql.multi_region.allow_abstractions_for_secondary_tenants.enabled true -sql.zone_configs.allow_for_secondary_tenant.enabled true +sql.virtual_cluster.feature_access.multiregion.enabled true +sql.virtual_cluster.feature_access.zone_configs.enabled true +trace.redact_at_virtual_cluster_boundary.enabled false system-sql SELECT tenant_id, name, value FROM system.tenant_settings diff --git a/pkg/configprofiles/testdata/virtual-app-repl b/pkg/configprofiles/testdata/virtual-app-repl index 1bde64d99dae..197111832b43 100644 --- a/pkg/configprofiles/testdata/virtual-app-repl +++ b/pkg/configprofiles/testdata/virtual-app-repl @@ -12,15 +12,15 @@ ok system-sql SELECT variable, value FROM [SHOW ALL CLUSTER SETTINGS] WHERE variable IN ( -'server.secondary_tenants.redact_trace.enabled', -'sql.zone_configs.allow_for_secondary_tenant.enabled', -'sql.multi_region.allow_abstractions_for_secondary_tenants.enabled', -'sql.multi_region.allow_abstractions_for_secondary_tenants.enabled', -'spanconfig.storage_coalesce_adjacent.enabled', -'spanconfig.tenant_coalesce_adjacent.enabled', +'trace.redact_at_virtual_cluster_boundary.enabled', +'sql.virtual_cluster.feature_access.zone_configs.enabled', +'sql.virtual_cluster.feature_access.multiregion.enabled', +'sql.virtual_cluster.feature_access.multiregion.enabled', +'spanconfig.range_coalescing.system.enabled', +'spanconfig.range_coalescing.application.enabled', 'sql.drop_virtual_cluster.enabled', -'sql.create_tenant.default_template', -'server.controller.default_tenant', +'sql.create_virtual_cluster.default_template', +'server.controller.default_target_cluster', 'kv.rangefeed.enabled', 'cross_cluster_replication.enabled' ) @@ -28,14 +28,14 @@ ORDER BY variable ---- cross_cluster_replication.enabled false kv.rangefeed.enabled false -server.controller.default_tenant application -server.secondary_tenants.redact_trace.enabled false -spanconfig.storage_coalesce_adjacent.enabled false -spanconfig.tenant_coalesce_adjacent.enabled false -sql.create_tenant.default_template template +server.controller.default_target_cluster application +spanconfig.range_coalescing.application.enabled false +spanconfig.range_coalescing.system.enabled false +sql.create_virtual_cluster.default_template template sql.drop_virtual_cluster.enabled false -sql.multi_region.allow_abstractions_for_secondary_tenants.enabled true -sql.zone_configs.allow_for_secondary_tenant.enabled true +sql.virtual_cluster.feature_access.multiregion.enabled true +sql.virtual_cluster.feature_access.zone_configs.enabled true +trace.redact_at_virtual_cluster_boundary.enabled false system-sql SELECT tenant_id, name, value FROM system.tenant_settings diff --git a/pkg/configprofiles/testdata/virtual-noapp b/pkg/configprofiles/testdata/virtual-noapp index 876bb81d5abc..60622042784f 100644 --- a/pkg/configprofiles/testdata/virtual-noapp +++ b/pkg/configprofiles/testdata/virtual-noapp @@ -7,15 +7,15 @@ server started system-sql SELECT variable, value FROM [SHOW ALL CLUSTER SETTINGS] WHERE variable IN ( -'server.secondary_tenants.redact_trace.enabled', -'sql.zone_configs.allow_for_secondary_tenant.enabled', -'sql.multi_region.allow_abstractions_for_secondary_tenants.enabled', -'sql.multi_region.allow_abstractions_for_secondary_tenants.enabled', -'spanconfig.storage_coalesce_adjacent.enabled', -'spanconfig.tenant_coalesce_adjacent.enabled', +'trace.redact_at_virtual_cluster_boundary.enabled', +'sql.virtual_cluster.feature_access.zone_configs.enabled', +'sql.virtual_cluster.feature_access.multiregion.enabled', +'sql.virtual_cluster.feature_access.multiregion.enabled', +'spanconfig.range_coalescing.system.enabled', +'spanconfig.range_coalescing.application.enabled', 'sql.drop_virtual_cluster.enabled', -'sql.create_tenant.default_template', -'server.controller.default_tenant', +'sql.create_virtual_cluster.default_template', +'server.controller.default_target_cluster', 'kv.rangefeed.enabled', 'cross_cluster_replication.enabled' ) @@ -23,14 +23,14 @@ ORDER BY variable ---- cross_cluster_replication.enabled false kv.rangefeed.enabled false -server.controller.default_tenant system -server.secondary_tenants.redact_trace.enabled false -spanconfig.storage_coalesce_adjacent.enabled false -spanconfig.tenant_coalesce_adjacent.enabled false -sql.create_tenant.default_template template +server.controller.default_target_cluster system +spanconfig.range_coalescing.application.enabled false +spanconfig.range_coalescing.system.enabled false +sql.create_virtual_cluster.default_template template sql.drop_virtual_cluster.enabled false -sql.multi_region.allow_abstractions_for_secondary_tenants.enabled true -sql.zone_configs.allow_for_secondary_tenant.enabled true +sql.virtual_cluster.feature_access.multiregion.enabled true +sql.virtual_cluster.feature_access.zone_configs.enabled true +trace.redact_at_virtual_cluster_boundary.enabled false system-sql SELECT tenant_id, name, value FROM system.tenant_settings diff --git a/pkg/configprofiles/testdata/virtual-noapp-repl b/pkg/configprofiles/testdata/virtual-noapp-repl index 5101a82351b8..323a2f54d4ad 100644 --- a/pkg/configprofiles/testdata/virtual-noapp-repl +++ b/pkg/configprofiles/testdata/virtual-noapp-repl @@ -7,15 +7,15 @@ server started system-sql SELECT variable, value FROM [SHOW ALL CLUSTER SETTINGS] WHERE variable IN ( -'server.secondary_tenants.redact_trace.enabled', -'sql.zone_configs.allow_for_secondary_tenant.enabled', -'sql.multi_region.allow_abstractions_for_secondary_tenants.enabled', -'sql.multi_region.allow_abstractions_for_secondary_tenants.enabled', -'spanconfig.storage_coalesce_adjacent.enabled', -'spanconfig.tenant_coalesce_adjacent.enabled', +'trace.redact_at_virtual_cluster_boundary.enabled', +'sql.virtual_cluster.feature_access.zone_configs.enabled', +'sql.virtual_cluster.feature_access.multiregion.enabled', +'sql.virtual_cluster.feature_access.multiregion.enabled', +'spanconfig.range_coalescing.system.enabled', +'spanconfig.range_coalescing.application.enabled', 'sql.drop_virtual_cluster.enabled', -'sql.create_tenant.default_template', -'server.controller.default_tenant', +'sql.create_virtual_cluster.default_template', +'server.controller.default_target_cluster', 'kv.rangefeed.enabled', 'cross_cluster_replication.enabled' ) @@ -23,14 +23,14 @@ ORDER BY variable ---- cross_cluster_replication.enabled true kv.rangefeed.enabled true -server.controller.default_tenant system -server.secondary_tenants.redact_trace.enabled false -spanconfig.storage_coalesce_adjacent.enabled false -spanconfig.tenant_coalesce_adjacent.enabled false -sql.create_tenant.default_template template +server.controller.default_target_cluster system +spanconfig.range_coalescing.application.enabled false +spanconfig.range_coalescing.system.enabled false +sql.create_virtual_cluster.default_template template sql.drop_virtual_cluster.enabled false -sql.multi_region.allow_abstractions_for_secondary_tenants.enabled true -sql.zone_configs.allow_for_secondary_tenant.enabled true +sql.virtual_cluster.feature_access.multiregion.enabled true +sql.virtual_cluster.feature_access.zone_configs.enabled true +trace.redact_at_virtual_cluster_boundary.enabled false system-sql SELECT tenant_id, name, value FROM system.tenant_settings diff --git a/pkg/kv/kvserver/gc/gc_int_test.go b/pkg/kv/kvserver/gc/gc_int_test.go index 119f45be8273..801a29756aee 100644 --- a/pkg/kv/kvserver/gc/gc_int_test.go +++ b/pkg/kv/kvserver/gc/gc_int_test.go @@ -224,8 +224,8 @@ WHERE 'kv' IN ( execOrFatal(t, appSqlDb, `SET CLUSTER SETTING kv.protectedts.poll_interval = '5s'`) // Ensure that each table gets its own range. - execOrFatal(t, systemSqlDb, `SET CLUSTER SETTING spanconfig.tenant_coalesce_adjacent.enabled = 'false'`) - execOrFatal(t, systemSqlDb, `SET CLUSTER SETTING spanconfig.storage_coalesce_adjacent.enabled = 'false'`) + execOrFatal(t, systemSqlDb, `SET CLUSTER SETTING spanconfig.range_coalescing.application.enabled = 'false'`) + execOrFatal(t, systemSqlDb, `SET CLUSTER SETTING spanconfig.range_coalescing.system.enabled = 'false'`) if d.clearRange { execOrFatal(t, systemSqlDb, `SET CLUSTER SETTING kv.gc.clear_range_min_keys = 5`) diff --git a/pkg/multitenant/cost_controller.go b/pkg/multitenant/cost_controller.go index 4c314e33ac30..b7ebe39c17f1 100644 --- a/pkg/multitenant/cost_controller.go +++ b/pkg/multitenant/cost_controller.go @@ -15,7 +15,6 @@ import ( "github.com/cockroachdb/cockroach/pkg/base" "github.com/cockroachdb/cockroach/pkg/multitenant/tenantcostmodel" - "github.com/cockroachdb/cockroach/pkg/settings" "github.com/cockroachdb/cockroach/pkg/sql/sqlliveness" "github.com/cockroachdb/cockroach/pkg/util/stop" ) @@ -132,12 +131,3 @@ type TenantSideExternalIORecorder interface { type exemptCtxValueType struct{} var exemptCtxValue interface{} = exemptCtxValueType{} - -// TenantRUEstimateEnabled determines whether EXPLAIN ANALYZE should return an -// estimate for the number of RUs consumed by tenants. -var TenantRUEstimateEnabled = settings.RegisterBoolSetting( - settings.TenantWritable, - "sql.tenant_ru_estimation.enabled", - "determines whether explain analyze should return an estimate for the query's RU consumption", - true, -) diff --git a/pkg/multitenant/multitenantio/cost_controlling_io.go b/pkg/multitenant/multitenantio/cost_controlling_io.go index ee510898dc6f..813d7c7a1e63 100644 --- a/pkg/multitenant/multitenantio/cost_controlling_io.go +++ b/pkg/multitenant/multitenantio/cost_controlling_io.go @@ -27,8 +27,9 @@ import ( var DefaultBytesAllowedBeforeAccounting = settings.RegisterIntSetting( settings.TenantReadOnly, "tenant_external_io_default_bytes_allowed_before_accounting", - "controls how many bytes will be read/written before blocking for RUs when writing to external storage in a tenant", + "controls how many bytes will be read/written before blocking for RUs when writing to external storage", 16<<20, // 16 MB + settings.WithName("tenant_cost_control.external_io.byte_usage_allowance"), settings.PositiveInt, ) diff --git a/pkg/multitenant/tenant_config.go b/pkg/multitenant/tenant_config.go index 0db95937003c..0bb73b728897 100644 --- a/pkg/multitenant/tenant_config.go +++ b/pkg/multitenant/tenant_config.go @@ -15,19 +15,20 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/sem/catconstants" ) -// DefaultTenantSelectSettingName is the name of the setting that +// DefaultClusterSelectSettingName is the name of the setting that // configures the default tenant to use when a client does not specify // a specific tenant. -const DefaultTenantSelectSettingName = "server.controller.default_tenant" +const DefaultClusterSelectSettingName = "server.controller.default_target_cluster" // DefaultTenantSelect determines which tenant serves requests from // clients that do not specify explicitly the tenant they want to use. var DefaultTenantSelect = settings.RegisterStringSetting( settings.SystemOnly, - DefaultTenantSelectSettingName, - "name of the tenant to use to serve requests when clients don't specify a tenant", + "server.controller.default_tenant", + "name of the virtual cluster to use when SQL or HTTP clients don't specify a target cluster", catconstants.SystemTenantName, - settings.WithPublic) + settings.WithName(DefaultClusterSelectSettingName), +) // VerifyTenantService determines whether there should be an advisory // interlock between changes to the tenant service and changes to the @@ -35,6 +36,7 @@ var DefaultTenantSelect = settings.RegisterStringSetting( var VerifyTenantService = settings.RegisterBoolSetting( settings.SystemOnly, "server.controller.default_tenant.check_service.enabled", - "verify that a tenant's service is coherently set with the value of "+DefaultTenantSelectSettingName, + "verify that the service mode is coherently set with the value of "+DefaultClusterSelectSettingName, true, + settings.WithName(DefaultClusterSelectSettingName+".check_service.enabled"), ) diff --git a/pkg/multitenant/tenantcapabilities/tenantcapabilitiesauthorizer/authorizer.go b/pkg/multitenant/tenantcapabilities/tenantcapabilitiesauthorizer/authorizer.go index 9443b77fc2ea..b2ba1caddd34 100644 --- a/pkg/multitenant/tenantcapabilities/tenantcapabilitiesauthorizer/authorizer.go +++ b/pkg/multitenant/tenantcapabilities/tenantcapabilitiesauthorizer/authorizer.go @@ -42,6 +42,7 @@ var authorizerMode = settings.RegisterEnumSetting( int64(authorizerModeAllowAll): "allow-all", int64(authorizerModeV222): "v222", }, + settings.WithName("server.virtual_cluster_authorization.mode"), ) type authorizerModeType int64 diff --git a/pkg/server/application_api/storage_inspection_test.go b/pkg/server/application_api/storage_inspection_test.go index ec683469c516..2d8d7255298a 100644 --- a/pkg/server/application_api/storage_inspection_test.go +++ b/pkg/server/application_api/storage_inspection_test.go @@ -192,7 +192,7 @@ func TestAdminAPIDataDistribution(t *testing.T) { // TODO(irfansharif): The data-distribution page and underyling APIs don't // know how to deal with coalesced ranges. See #97942. - sqlDB.Exec(t, `SET CLUSTER SETTING spanconfig.storage_coalesce_adjacent.enabled = false`) + sqlDB.Exec(t, `SET CLUSTER SETTING spanconfig.range_coalescing.system.enabled = false`) // Create some tables. sqlDB.Exec(t, `CREATE DATABASE roachblog`) diff --git a/pkg/server/node.go b/pkg/server/node.go index 9425f1be8582..5b59a14d8750 100644 --- a/pkg/server/node.go +++ b/pkg/server/node.go @@ -230,6 +230,7 @@ var ( "if nonempty, push server metrics to the Graphite or Carbon server at the specified host:port", "", settings.WithPublic) + // graphiteInterval is how often metrics are pushed to Graphite, if enabled. graphiteInterval = settings.RegisterDurationSetting( settings.TenantWritable, @@ -238,12 +239,14 @@ var ( 10*time.Second, settings.NonNegativeDurationWithMaximum(maxGraphiteInterval), settings.WithPublic) + RedactServerTracesForSecondaryTenants = settings.RegisterBoolSetting( settings.SystemOnly, "server.secondary_tenants.redact_trace.enabled", - "controls if server side traces are redacted for tenant operations", + "if enabled, storage/KV trace results are redacted when returned to a virtual cluster", true, - settings.WithPublic) + settings.WithName("trace.redact_at_virtual_cluster_boundary.enabled"), + ) slowRequestHistoricalStackThreshold = settings.RegisterDurationSetting( settings.SystemOnly, diff --git a/pkg/spanconfig/spanconfiglimiter/limiter.go b/pkg/spanconfig/spanconfiglimiter/limiter.go index fa70c74b52a5..56a561d71edd 100644 --- a/pkg/spanconfig/spanconfiglimiter/limiter.go +++ b/pkg/spanconfig/spanconfiglimiter/limiter.go @@ -32,8 +32,9 @@ var _ spanconfig.Limiter = &Limiter{} var tenantLimitSetting = settings.RegisterIntSetting( settings.TenantReadOnly, "spanconfig.tenant_limit", - "limit on the number of span configs a tenant is allowed to install", + "limit on the number of span configs that can be set up by a virtual cluster", 5000, + settings.WithName("spanconfig.virtual_cluster.max_spans"), ) // Limiter is used to limit the number of span configs installed by secondary diff --git a/pkg/spanconfig/spanconfigstore/span_store.go b/pkg/spanconfig/spanconfigstore/span_store.go index 9c74977a18d3..81c61bdaf3eb 100644 --- a/pkg/spanconfig/spanconfigstore/span_store.go +++ b/pkg/spanconfig/spanconfigstore/span_store.go @@ -33,7 +33,9 @@ var tenantCoalesceAdjacentSetting = settings.RegisterBoolSetting( "spanconfig.tenant_coalesce_adjacent.enabled", `collapse adjacent ranges with the same span configs across all secondary tenant keyspaces`, true, - settings.WithPublic) + settings.WithName("spanconfig.range_coalescing.application.enabled"), + settings.WithPublic, +) // StorageCoalesceAdjacentSetting is a public cluster setting that controls // whether we coalesce adjacent ranges outside of the secondary tenant keyspaces @@ -43,7 +45,9 @@ var StorageCoalesceAdjacentSetting = settings.RegisterBoolSetting( "spanconfig.storage_coalesce_adjacent.enabled", `collapse adjacent ranges with the same span configs, for the ranges specific to the system tenant`, true, - settings.WithPublic) + settings.WithName("spanconfig.range_coalescing.system.enabled"), + settings.WithPublic, +) // spanConfigStore is an in-memory data structure to store and retrieve // SpanConfigs associated with a single span. Internally it makes use of a diff --git a/pkg/spanconfig/spanconfigtestutils/spanconfigtestcluster/cluster.go b/pkg/spanconfig/spanconfigtestutils/spanconfigtestcluster/cluster.go index 78e3dcc6f35c..2276ea0c0886 100644 --- a/pkg/spanconfig/spanconfigtestutils/spanconfigtestcluster/cluster.go +++ b/pkg/spanconfig/spanconfigtestutils/spanconfigtestcluster/cluster.go @@ -120,7 +120,7 @@ func (h *Handle) AllowSecondaryTenantToSetZoneConfigurations(t *testing.T, tenID sqlDB := sqlutils.MakeSQLRunner(h.tc.ServerConn(0)) sqlDB.Exec( t, - "ALTER TENANT [$1] SET CLUSTER SETTING sql.zone_configs.allow_for_secondary_tenant.enabled = true", + "ALTER TENANT [$1] SET CLUSTER SETTING sql.virtual_cluster.feature_access.zone_configs.enabled = true", tenID.ToUint64(), ) } @@ -132,12 +132,12 @@ func (h *Handle) EnsureTenantCanSetZoneConfigurationsOrFatal(t *testing.T, tenan testutils.SucceedsSoon(t, func() error { var val string tenant.QueryRow( - "SHOW CLUSTER SETTING sql.zone_configs.allow_for_secondary_tenant.enabled", + "SHOW CLUSTER SETTING sql.virtual_cluster.feature_access.zone_configs.enabled", ).Scan(&val) if val == "false" { return errors.New( - "waiting for sql.zone_configs.allow_for_secondary_tenant.enabled to be updated", + "waiting for sql.virtual_cluster.feature_access.zone_configs.enabled to be updated", ) } return nil diff --git a/pkg/sql/conn_executor_exec.go b/pkg/sql/conn_executor_exec.go index 80d598a1d9c9..ef18e8e6c4e1 100644 --- a/pkg/sql/conn_executor_exec.go +++ b/pkg/sql/conn_executor_exec.go @@ -23,7 +23,6 @@ import ( "github.com/cockroachdb/cockroach/pkg/kv" "github.com/cockroachdb/cockroach/pkg/kv/kvpb" "github.com/cockroachdb/cockroach/pkg/kv/kvserver/concurrency/isolation" - "github.com/cockroachdb/cockroach/pkg/multitenant" "github.com/cockroachdb/cockroach/pkg/multitenant/multitenantcpu" "github.com/cockroachdb/cockroach/pkg/roachpb" "github.com/cockroachdb/cockroach/pkg/server/telemetry" @@ -1621,7 +1620,7 @@ func (ex *connExecutor) dispatchToExecutionEngine( // https://github.com/cockroachdb/cockroach/issues/99410 ex.statsCollector.PhaseTimes().SetSessionPhaseTime(sessionphase.PlannerStartLogicalPlan, timeutil.Now()) - if multitenant.TenantRUEstimateEnabled.Get(ex.server.cfg.SV()) { + if execinfra.IncludeRUEstimateInExplainAnalyze.Get(ex.server.cfg.SV()) { if server := ex.server.cfg.DistSQLSrv; server != nil { // Begin measuring CPU usage for tenants. This is a no-op for non-tenants. ex.cpuStatsCollector.StartCollection(ctx, server.TenantCostController) @@ -1953,7 +1952,7 @@ func populateQueryLevelStats( } else { // If this query is being run by a tenant, record the RUs consumed by CPU // usage and network egress to the client. - if multitenant.TenantRUEstimateEnabled.Get(cfg.SV()) && cfg.DistSQLSrv != nil { + if execinfra.IncludeRUEstimateInExplainAnalyze.Get(cfg.SV()) && cfg.DistSQLSrv != nil { if costController := cfg.DistSQLSrv.TenantCostController; costController != nil { if costCfg := costController.GetCostConfig(); costCfg != nil { networkEgressRUEstimate := costCfg.PGWireEgressCost(topLevelStats.networkEgressEstimate) diff --git a/pkg/sql/descriptor.go b/pkg/sql/descriptor.go index 72f0e223c502..4e80c1829378 100644 --- a/pkg/sql/descriptor.go +++ b/pkg/sql/descriptor.go @@ -351,7 +351,7 @@ var DefaultPrimaryRegion = settings.RegisterStringSetting( // SecondaryTenantsMultiRegionAbstractionsEnabledSettingName is the name of the // cluster setting that governs secondary tenant multi-region abstraction usage. -const SecondaryTenantsMultiRegionAbstractionsEnabledSettingName = "sql.multi_region.allow_abstractions_for_secondary_tenants.enabled" +const SecondaryTenantsMultiRegionAbstractionsEnabledSettingName = "sql.virtual_cluster.feature_access.multiregion.enabled" // SecondaryTenantsMultiRegionAbstractionsEnabled controls if secondary tenants // are allowed to use multi-region abstractions. In particular, it controls if @@ -363,9 +363,10 @@ const SecondaryTenantsMultiRegionAbstractionsEnabledSettingName = "sql.multi_reg // databases. var SecondaryTenantsMultiRegionAbstractionsEnabled = settings.RegisterBoolSetting( settings.TenantReadOnly, - SecondaryTenantsMultiRegionAbstractionsEnabledSettingName, - "allow secondary tenants to use multi-region abstractions", + "sql.multi_region.allow_abstractions_for_secondary_tenants.enabled", // internal key, name defined above + "allow the use of multi-region abstractions and syntax in virtual clusters", false, + settings.WithName(SecondaryTenantsMultiRegionAbstractionsEnabledSettingName), ) // maybeInitializeMultiRegionMetadata initializes multi-region metadata if a diff --git a/pkg/sql/distsql_running.go b/pkg/sql/distsql_running.go index ea9cf170bbe6..72084840df56 100644 --- a/pkg/sql/distsql_running.go +++ b/pkg/sql/distsql_running.go @@ -24,7 +24,6 @@ import ( "github.com/cockroachdb/cockroach/pkg/kv" "github.com/cockroachdb/cockroach/pkg/kv/kvclient/rangecache" "github.com/cockroachdb/cockroach/pkg/kv/kvpb" - "github.com/cockroachdb/cockroach/pkg/multitenant" "github.com/cockroachdb/cockroach/pkg/roachpb" "github.com/cockroachdb/cockroach/pkg/rpc" "github.com/cockroachdb/cockroach/pkg/rpc/nodedialer" @@ -824,7 +823,7 @@ func (dsp *DistSQLPlanner) Run( defer dsp.distSQLSrv.ServerConfig.Metrics.QueryStop() recv.outputTypes = plan.GetResultTypes() - if multitenant.TenantRUEstimateEnabled.Get(&dsp.st.SV) && + if execinfra.IncludeRUEstimateInExplainAnalyze.Get(&dsp.st.SV) && dsp.distSQLSrv.TenantCostController != nil && planCtx.planner != nil { if instrumentation := planCtx.planner.curPlan.instrumentation; instrumentation != nil { // Only collect the network egress estimate for a tenant that is running diff --git a/pkg/sql/exec_util.go b/pkg/sql/exec_util.go index fa24f12b1946..77cd7abbcf8e 100644 --- a/pkg/sql/exec_util.go +++ b/pkg/sql/exec_util.go @@ -212,8 +212,9 @@ var allowCrossDatabaseSeqReferences = settings.RegisterBoolSetting( var SecondaryTenantZoneConfigsEnabled = settings.RegisterBoolSetting( settings.TenantReadOnly, "sql.zone_configs.allow_for_secondary_tenant.enabled", - "allow secondary tenants to set zone configurations; does not affect the system tenant", + "enable the use of ALTER CONFIGURE ZONE in virtual clusters", false, + settings.WithName("sql.virtual_cluster.feature_access.zone_configs.enabled"), ) // SecondaryTenantSplitAtEnabled controls if secondary tenants are allowed to @@ -222,8 +223,9 @@ var SecondaryTenantZoneConfigsEnabled = settings.RegisterBoolSetting( var SecondaryTenantSplitAtEnabled = settings.RegisterBoolSetting( settings.TenantReadOnly, "sql.split_at.allow_for_secondary_tenant.enabled", - "allow secondary tenants to run ALTER TABLE/INDEX ... SPLIT AT commands; does not affect the system tenant", + "enable the use of ALTER TABLE/INDEX ... SPLIT AT in virtual clusters", false, + settings.WithName("sql.virtual_cluster.feature_access.manual_range_split.enabled"), ) // SecondaryTenantScatterEnabled controls if secondary tenants are allowed to @@ -232,8 +234,9 @@ var SecondaryTenantSplitAtEnabled = settings.RegisterBoolSetting( var SecondaryTenantScatterEnabled = settings.RegisterBoolSetting( settings.TenantReadOnly, "sql.scatter.allow_for_secondary_tenant.enabled", - "allow secondary tenants to run ALTER TABLE/INDEX ... SCATTER commands; does not affect the system tenant", + "enable the use of ALTER TABLE/INDEX ... SCATTER in virtual clusters", false, + settings.WithName("sql.virtual_cluster.feature_access.manual_range_scatter.enabled"), ) // traceTxnThreshold can be used to log SQL transactions that take diff --git a/pkg/sql/execinfra/utils.go b/pkg/sql/execinfra/utils.go index 4adfda6935a1..8a4620fa62c8 100644 --- a/pkg/sql/execinfra/utils.go +++ b/pkg/sql/execinfra/utils.go @@ -13,6 +13,7 @@ package execinfra import ( "context" + "github.com/cockroachdb/cockroach/pkg/settings" "github.com/cockroachdb/cockroach/pkg/sql/catalog/descs" "github.com/cockroachdb/cockroach/pkg/sql/catalog/typedesc" "github.com/cockroachdb/cockroach/pkg/sql/execinfrapb" @@ -50,3 +51,17 @@ func HydrateTypesInDatumInfo( } return nil } + +// IncludeRUEstimateInExplainAnalyze determines whether EXPLAIN +// ANALYZE should return an estimate for the number of RUs consumed by +// tenants. +// +// This setting is defined here instead of in package 'sql' to avoid +// a dependency cycle. +var IncludeRUEstimateInExplainAnalyze = settings.RegisterBoolSetting( + settings.TenantWritable, + "sql.tenant_ru_estimation.enabled", + "determines whether EXPLAIN ANALYZE should return an estimate for the query's RU consumption", + true, + settings.WithName("sql.explain_analyze.include_ru_estimation.enabled"), +) diff --git a/pkg/sql/flowinfra/BUILD.bazel b/pkg/sql/flowinfra/BUILD.bazel index c50db214d92d..5d059a03e913 100644 --- a/pkg/sql/flowinfra/BUILD.bazel +++ b/pkg/sql/flowinfra/BUILD.bazel @@ -18,7 +18,6 @@ go_library( deps = [ "//pkg/base", "//pkg/kv", - "//pkg/multitenant", "//pkg/roachpb", "//pkg/settings", "//pkg/sql/catalog/catenumpb", diff --git a/pkg/sql/flowinfra/flow.go b/pkg/sql/flowinfra/flow.go index 109bd1782095..3d7bfeebc2d0 100644 --- a/pkg/sql/flowinfra/flow.go +++ b/pkg/sql/flowinfra/flow.go @@ -16,7 +16,6 @@ import ( "unsafe" "github.com/cockroachdb/cockroach/pkg/kv" - "github.com/cockroachdb/cockroach/pkg/multitenant" "github.com/cockroachdb/cockroach/pkg/roachpb" "github.com/cockroachdb/cockroach/pkg/sql/execinfra" "github.com/cockroachdb/cockroach/pkg/sql/execinfra/execopnode" @@ -488,7 +487,7 @@ func (f *FlowBase) StartInternal( f.setStatus(flowRunning) - if multitenant.TenantRUEstimateEnabled.Get(&f.Cfg.Settings.SV) && + if execinfra.IncludeRUEstimateInExplainAnalyze.Get(&f.Cfg.Settings.SV) && !f.Gateway && f.CollectStats { // Remote flows begin collecting CPU usage here, and finish when the last // outbox finishes. Gateway flows are handled by the connExecutor. diff --git a/pkg/sql/generate_objects_test.go b/pkg/sql/generate_objects_test.go index 4212d83f97b7..47c22a29135c 100644 --- a/pkg/sql/generate_objects_test.go +++ b/pkg/sql/generate_objects_test.go @@ -46,7 +46,7 @@ func BenchmarkGenerateObjects(b *testing.B) { // Disable auto stats and range splits, which introduce noise. db.Exec(b, `SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false`) - db.Exec(b, `SET CLUSTER SETTING spanconfig.storage_coalesce_adjacent.enabled = true`) + db.Exec(b, `SET CLUSTER SETTING spanconfig.range_coalescing.system.enabled = true`) for _, bench := range benches { b.Run(bench.name, func(b *testing.B) { diff --git a/pkg/sql/instrumentation.go b/pkg/sql/instrumentation.go index af04bc6801bd..f3956584185d 100644 --- a/pkg/sql/instrumentation.go +++ b/pkg/sql/instrumentation.go @@ -19,13 +19,13 @@ import ( "github.com/cockroachdb/cockroach/pkg/keys" "github.com/cockroachdb/cockroach/pkg/kv/kvserver/concurrency/isolation" - "github.com/cockroachdb/cockroach/pkg/multitenant" "github.com/cockroachdb/cockroach/pkg/roachpb" "github.com/cockroachdb/cockroach/pkg/server/telemetry" "github.com/cockroachdb/cockroach/pkg/settings" "github.com/cockroachdb/cockroach/pkg/sql/appstatspb" "github.com/cockroachdb/cockroach/pkg/sql/catalog/colinfo" "github.com/cockroachdb/cockroach/pkg/sql/catalog/descpb" + "github.com/cockroachdb/cockroach/pkg/sql/execinfra" "github.com/cockroachdb/cockroach/pkg/sql/execinfrapb" "github.com/cockroachdb/cockroach/pkg/sql/execstats" "github.com/cockroachdb/cockroach/pkg/sql/idxrecommendations" @@ -290,7 +290,7 @@ func (ih *instrumentationHelper) Setup( ih.codec = cfg.Codec ih.origCtx = ctx ih.evalCtx = p.EvalContext() - ih.isTenant = multitenant.TenantRUEstimateEnabled.Get(cfg.SV()) && cfg.DistSQLSrv != nil && + ih.isTenant = execinfra.IncludeRUEstimateInExplainAnalyze.Get(cfg.SV()) && cfg.DistSQLSrv != nil && cfg.DistSQLSrv.TenantCostController != nil switch ih.outputMode { diff --git a/pkg/sql/logictest/testdata/logic_test/distsql_tenant_locality b/pkg/sql/logictest/testdata/logic_test/distsql_tenant_locality index 4f21408ab4df..58fa330f0897 100644 --- a/pkg/sql/logictest/testdata/logic_test/distsql_tenant_locality +++ b/pkg/sql/logictest/testdata/logic_test/distsql_tenant_locality @@ -1,5 +1,5 @@ # LogicTest: 3node-tenant-multiregion -# tenant-cluster-setting-override-opt: sql.split_at.allow_for_secondary_tenant.enabled=true sql.zone_configs.allow_for_secondary_tenant.enabled=true sql.multi_region.allow_abstractions_for_secondary_tenants.enabled=true +# tenant-cluster-setting-override-opt: sql.virtual_cluster.feature_access.manual_range_split.enabled=true sql.virtual_cluster.feature_access.zone_configs.enabled=true sql.virtual_cluster.feature_access.multiregion.enabled=true # Create a table on the secondary tenant. statement ok diff --git a/pkg/sql/logictest/testdata/logic_test/sql_keys b/pkg/sql/logictest/testdata/logic_test/sql_keys index 8153b1ac8207..54930e28d641 100644 --- a/pkg/sql/logictest/testdata/logic_test/sql_keys +++ b/pkg/sql/logictest/testdata/logic_test/sql_keys @@ -1,5 +1,5 @@ # LogicTest: local 3node-tenant -# tenant-cluster-setting-override-opt: sql.split_at.allow_for_secondary_tenant.enabled=true +# tenant-cluster-setting-override-opt: sql.virtual_cluster.feature_access.manual_range_split.enabled=true # This test depends on table ID's being stable, so add new tests at the bottom # of the file. diff --git a/pkg/sql/logictest/testdata/logic_test/tenant b/pkg/sql/logictest/testdata/logic_test/tenant index c741d7f39bd9..5ea7d84b973e 100644 --- a/pkg/sql/logictest/testdata/logic_test/tenant +++ b/pkg/sql/logictest/testdata/logic_test/tenant @@ -366,7 +366,7 @@ DROP TENANT 'tenant-one' subtest tenant_templates query T -SHOW CLUSTER SETTING sql.create_tenant.default_template +SHOW CLUSTER SETTING sql.create_virtual_cluster.default_template ---- ยท @@ -436,13 +436,13 @@ DROP TENANT othertenant # Now set the default template and try again. statement ok -SET CLUSTER SETTING sql.create_tenant.default_template = 'nonexistent'; +SET CLUSTER SETTING sql.create_virtual_cluster.default_template = 'nonexistent'; statement error retrieving default tenant configuration template.*tenant "nonexistent" does not exist CREATE TENANT othertenant statement ok -SET CLUSTER SETTING sql.create_tenant.default_template = 'tmpl'; +SET CLUSTER SETTING sql.create_virtual_cluster.default_template = 'tmpl'; # Create a new tenant - this should use the template implicitly now. statement ok @@ -485,7 +485,7 @@ ALTER TENANT tmpl STOP SERVICE; DROP TENANT tmpl statement ok -RESET CLUSTER SETTING sql.create_tenant.default_template +RESET CLUSTER SETTING sql.create_virtual_cluster.default_template subtest block_drop_virtual_cluster @@ -510,19 +510,19 @@ statement ok CREATE TENANT noservice statement error shared service not enabled for tenant "noservice" -SET CLUSTER SETTING server.controller.default_tenant = noservice +SET CLUSTER SETTING server.controller.default_target_cluster = noservice statement ok -SET CLUSTER SETTING server.controller.default_tenant.check_service.enabled = false +SET CLUSTER SETTING server.controller.default_target_cluster.check_service.enabled = false statement ok -SET CLUSTER SETTING server.controller.default_tenant = noservice +SET CLUSTER SETTING server.controller.default_target_cluster = noservice statement ok -RESET CLUSTER SETTING server.controller.default_tenant.check_service.enabled +RESET CLUSTER SETTING server.controller.default_target_cluster.check_service.enabled statement ok -RESET CLUSTER SETTING server.controller.default_tenant +RESET CLUSTER SETTING server.controller.default_target_cluster statement ok DROP TENANT noservice; @@ -530,23 +530,23 @@ CREATE TENANT withservice; ALTER TENANT withservice START SERVICE SHARED statement ok -SET CLUSTER SETTING server.controller.default_tenant = withservice +SET CLUSTER SETTING server.controller.default_target_cluster = withservice statement error cannot stop service while tenant is selected as default ALTER TENANT withservice STOP SERVICE statement ok -SET CLUSTER SETTING server.controller.default_tenant.check_service.enabled = false +SET CLUSTER SETTING server.controller.default_target_cluster.check_service.enabled = false statement ok ALTER TENANT withservice STOP SERVICE # clean up statement ok -RESET CLUSTER SETTING server.controller.default_tenant.check_service.enabled +RESET CLUSTER SETTING server.controller.default_target_cluster.check_service.enabled statement ok -RESET CLUSTER SETTING server.controller.default_tenant +RESET CLUSTER SETTING server.controller.default_target_cluster statement ok DROP TENANT withservice diff --git a/pkg/sql/logictest/testdata/logic_test/zone_config b/pkg/sql/logictest/testdata/logic_test/zone_config index 5f3dce3673ad..051e41e53aaa 100644 --- a/pkg/sql/logictest/testdata/logic_test/zone_config +++ b/pkg/sql/logictest/testdata/logic_test/zone_config @@ -1,6 +1,6 @@ # As these tests are run for both the system tenant and secondary tenants, we # turn on the setting that gates setting zone configs for system tenants. -# tenant-cluster-setting-override-opt: sql.zone_configs.allow_for_secondary_tenant.enabled=true +# tenant-cluster-setting-override-opt: sql.virtual_cluster.feature_access.zone_configs.enabled=true # Check that we can alter the default zone config. statement ok diff --git a/pkg/sql/logictest/testdata/logic_test/zone_config_system_tenant b/pkg/sql/logictest/testdata/logic_test/zone_config_system_tenant index f656fc31547f..603a1e4cd542 100644 --- a/pkg/sql/logictest/testdata/logic_test/zone_config_system_tenant +++ b/pkg/sql/logictest/testdata/logic_test/zone_config_system_tenant @@ -9,7 +9,7 @@ ALTER TABLE t CONFIGURE ZONE USING num_replicas = 5; # Should have no effect on the system tenant. statement ok -SET CLUSTER SETTING sql.zone_configs.allow_for_secondary_tenant.enabled = false +SET CLUSTER SETTING sql.virtual_cluster.feature_access.zone_configs.enabled = false statement ok ALTER TABLE t CONFIGURE ZONE USING num_replicas = 3; diff --git a/pkg/sql/multitenant_admin_function_test.go b/pkg/sql/multitenant_admin_function_test.go index c26e951a06c6..5efbb72c8f63 100644 --- a/pkg/sql/multitenant_admin_function_test.go +++ b/pkg/sql/multitenant_admin_function_test.go @@ -463,7 +463,7 @@ func TestMultiTenantAdminFunction(t *testing.T) { result: [][]string{{ignore, "/1", maxTimestamp}}, }, secondaryWithoutClusterSetting: tenantExpected{ - errorMessage: "tenant cluster setting sql.split_at.allow_for_secondary_tenant.enabled disabled", + errorMessage: "tenant cluster setting sql.virtual_cluster.feature_access.manual_range_split.enabled disabled", }, queryClusterSetting: sql.SecondaryTenantSplitAtEnabled, setupCapability: bcap(tenantcapabilities.CanAdminSplit, false), @@ -477,7 +477,7 @@ func TestMultiTenantAdminFunction(t *testing.T) { result: [][]string{{"\xf0\x8a\x89", "/1", maxTimestamp}}, }, secondaryWithoutClusterSetting: tenantExpected{ - errorMessage: "tenant cluster setting sql.split_at.allow_for_secondary_tenant.enabled disabled", + errorMessage: "tenant cluster setting sql.virtual_cluster.feature_access.manual_range_split.enabled disabled", }, queryClusterSetting: sql.SecondaryTenantSplitAtEnabled, setupCapability: bcap(tenantcapabilities.CanAdminSplit, false), @@ -564,7 +564,7 @@ func TestMultiTenantAdminFunction(t *testing.T) { result: [][]string{{ignore, ignore}}, }, secondaryWithoutClusterSetting: tenantExpected{ - errorMessage: "tenant cluster setting sql.scatter.allow_for_secondary_tenant.enabled disabled", + errorMessage: "tenant cluster setting sql.virtual_cluster.feature_access.manual_range_scatter.enabled disabled", }, secondaryWithoutCapability: tenantExpected{ errorMessage: `does not have capability "can_admin_scatter"`, @@ -581,7 +581,7 @@ func TestMultiTenantAdminFunction(t *testing.T) { result: [][]string{{"\xf0\x8a", "/Table/104/2"}}, }, secondaryWithoutClusterSetting: tenantExpected{ - errorMessage: "tenant cluster setting sql.scatter.allow_for_secondary_tenant.enabled disabled", + errorMessage: "tenant cluster setting sql.virtual_cluster.feature_access.manual_range_scatter.enabled disabled", }, queryClusterSetting: sql.SecondaryTenantScatterEnabled, setupCapability: bcap(tenantcapabilities.CanAdminScatter, false), diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_tenant b/pkg/sql/opt/exec/execbuilder/testdata/distsql_tenant index 3e77144339bf..ffc705d42b4b 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_tenant +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_tenant @@ -1,5 +1,5 @@ # LogicTest: 3node-tenant -# tenant-cluster-setting-override-opt: sql.zone_configs.allow_for_secondary_tenant.enabled=true sql.multi_region.allow_abstractions_for_secondary_tenants.enabled=true sql.split_at.allow_for_secondary_tenant.enabled=true +# tenant-cluster-setting-override-opt: sql.virtual_cluster.feature_access.zone_configs.enabled=true sql.virtual_cluster.feature_access.multiregion.enabled=true sql.virtual_cluster.feature_access.manual_range_split.enabled=true statement ok CREATE TABLE tbl1 (a INT PRIMARY KEY, b INT) diff --git a/pkg/sql/opt/exec/execbuilder/testdata/distsql_tenant_locality b/pkg/sql/opt/exec/execbuilder/testdata/distsql_tenant_locality index 2acdb0f08b00..5dc1605102e0 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/distsql_tenant_locality +++ b/pkg/sql/opt/exec/execbuilder/testdata/distsql_tenant_locality @@ -1,5 +1,5 @@ # LogicTest: 3node-tenant-multiregion -# tenant-cluster-setting-override-opt: sql.split_at.allow_for_secondary_tenant.enabled=true sql.zone_configs.allow_for_secondary_tenant.enabled=true sql.multi_region.allow_abstractions_for_secondary_tenants.enabled=true +# tenant-cluster-setting-override-opt: sql.virtual_cluster.feature_access.manual_range_split.enabled=true sql.virtual_cluster.feature_access.zone_configs.enabled=true sql.virtual_cluster.feature_access.multiregion.enabled=true # Create a table on the secondary tenant. statement ok diff --git a/pkg/sql/set_cluster_setting.go b/pkg/sql/set_cluster_setting.go index ebc5aea39a50..69a8321be503 100644 --- a/pkg/sql/set_cluster_setting.go +++ b/pkg/sql/set_cluster_setting.go @@ -308,7 +308,7 @@ func (n *setClusterSettingNode) startExec(params runParams) error { // Report tracked cluster settings via telemetry. // TODO(justin): implement a more general mechanism for tracking these. switch n.name { - case multitenant.DefaultTenantSelectSettingName: + case multitenant.DefaultClusterSelectSettingName: if multitenant.VerifyTenantService.Get(&n.st.SV) && expectedEncodedValue != "" { tr, err := GetTenantRecordByName(params.ctx, n.st, params.p.InternalSQLTxn(), roachpb.TenantName(expectedEncodedValue)) if err != nil { diff --git a/pkg/sql/tenant_accessors.go b/pkg/sql/tenant_accessors.go index 910f5255ba30..264eba4dc60d 100644 --- a/pkg/sql/tenant_accessors.go +++ b/pkg/sql/tenant_accessors.go @@ -203,6 +203,7 @@ var defaultTenantConfigTemplate = settings.RegisterStringSetting( // We use the empty string so that no template is used by default // (i.e. empty proto, no setting overrides). "", + settings.WithName("sql.create_virtual_cluster.default_template"), settings.WithReportable(true), ) diff --git a/pkg/sql/tenant_update.go b/pkg/sql/tenant_update.go index 85f9692a9775..70e6a55f5f91 100644 --- a/pkg/sql/tenant_update.go +++ b/pkg/sql/tenant_update.go @@ -126,7 +126,7 @@ func validateTenantInfo( pgerror.Newf(pgcode.ObjectNotInPrerequisiteState, "cannot stop service while tenant is selected as default"), "Update the cluster setting %q to a different value.", - multitenant.DefaultTenantSelectSettingName) + multitenant.DefaultClusterSelectSettingName) } return nil diff --git a/pkg/ui/workspaces/db-console/src/views/cluster/containers/dataDistribution/index.tsx b/pkg/ui/workspaces/db-console/src/views/cluster/containers/dataDistribution/index.tsx index 937e833e2e70..f62a37d67352 100644 --- a/pkg/ui/workspaces/db-console/src/views/cluster/containers/dataDistribution/index.tsx +++ b/pkg/ui/workspaces/db-console/src/views/cluster/containers/dataDistribution/index.tsx @@ -57,6 +57,18 @@ const ZONE_CONFIG_TEXT = ( ); +const RANGE_COALESCING_ADVICE = ( +
+
+      SET CLUSTER SETTING spanconfig.range_coalescing.system.enabled = false;
+    
+
+      SET CLUSTER SETTING spanconfig.range_coalescing.application.enabled =
+      false;
+    
+
+); + interface DataDistributionProps { dataDistribution: CachedDataReducerState; localityTree: LocalityTree; @@ -187,10 +199,7 @@ export class DataDistributionPage extends React.Component< ranges. To disable coalesced ranges (would increase range count), run the following SQL statement:

-
-            SET CLUSTER SETTING spanconfig.storage_coalesce_adjacent.enabled =
-            false;
-          
+ {RANGE_COALESCING_ADVICE}