diff --git a/docs/generated/settings/settings-for-tenants.txt b/docs/generated/settings/settings-for-tenants.txt index d051be575d07..fa94521e72e2 100644 --- a/docs/generated/settings/settings-for-tenants.txt +++ b/docs/generated/settings/settings-for-tenants.txt @@ -144,4 +144,4 @@ trace.datadog.project string CockroachDB the project under which traces will be trace.debug.enable boolean false if set, traces for recent requests can be seen at https:///debug/requests trace.lightstep.token string if set, traces go to Lightstep using this token trace.zipkin.collector string if set, traces go to the given Zipkin instance (example: '127.0.0.1:9411'). Only one tracer can be configured at a time. -version version 21.1-118 set the active cluster version in the format '.' +version version 21.1-120 set the active cluster version in the format '.' diff --git a/docs/generated/settings/settings.html b/docs/generated/settings/settings.html index 485517fef82c..dcb646366245 100644 --- a/docs/generated/settings/settings.html +++ b/docs/generated/settings/settings.html @@ -148,6 +148,6 @@ trace.debug.enablebooleanfalseif set, traces for recent requests can be seen at https:///debug/requests trace.lightstep.tokenstringif set, traces go to Lightstep using this token trace.zipkin.collectorstringif set, traces go to the given Zipkin instance (example: '127.0.0.1:9411'). Only one tracer can be configured at a time. -versionversion21.1-118set the active cluster version in the format '.' +versionversion21.1-120set the active cluster version in the format '.' diff --git a/pkg/ccl/backupccl/system_schema.go b/pkg/ccl/backupccl/system_schema.go index baa3880569f6..8680e30dbbbe 100644 --- a/pkg/ccl/backupccl/system_schema.go +++ b/pkg/ccl/backupccl/system_schema.go @@ -346,6 +346,9 @@ var systemTableBackupConfiguration = map[string]systemBackupConfiguration{ systemschema.DatabaseRoleSettingsTable.GetName(): { shouldIncludeInClusterBackup: optInToClusterBackup, }, + systemschema.TenantUsageTable.GetName(): { + shouldIncludeInClusterBackup: optOutOfClusterBackup, + }, } // GetSystemTablesToIncludeInClusterBackup returns a set of system table names that diff --git a/pkg/cli/testdata/doctor/test_examine_cluster b/pkg/cli/testdata/doctor/test_examine_cluster index 8cadb5ccbcf1..c61d66b54006 100644 --- a/pkg/cli/testdata/doctor/test_examine_cluster +++ b/pkg/cli/testdata/doctor/test_examine_cluster @@ -1,7 +1,7 @@ debug doctor examine cluster ---- debug doctor examine cluster -Examining 38 descriptors and 39 namespace entries... +Examining 39 descriptors and 40 namespace entries... ParentID 50, ParentSchemaID 29: relation "foo" (53): expected matching namespace entry, found none Examining 3 jobs... ERROR: validation failed diff --git a/pkg/cli/testdata/zip/partial1 b/pkg/cli/testdata/zip/partial1 index 85ce79df3a98..90036423f077 100644 --- a/pkg/cli/testdata/zip/partial1 +++ b/pkg/cli/testdata/zip/partial1 @@ -66,7 +66,7 @@ debug zip --concurrency=1 --cpu-profile-duration=0s /dev/null [node 1] 1 log file ... [node 1] [log file ... [node 1] requesting ranges... received response... done -[node 1] 40 ranges found +[node 1] 41 ranges found [node 1] writing range 1... converting to JSON... writing binary output: debug/nodes/1/ranges/1.json... done [node 1] writing range 2... converting to JSON... writing binary output: debug/nodes/1/ranges/2.json... done [node 1] writing range 3... converting to JSON... writing binary output: debug/nodes/1/ranges/3.json... done @@ -107,6 +107,7 @@ debug zip --concurrency=1 --cpu-profile-duration=0s /dev/null [node 1] writing range 38... converting to JSON... writing binary output: debug/nodes/1/ranges/38.json... done [node 1] writing range 39... converting to JSON... writing binary output: debug/nodes/1/ranges/39.json... done [node 1] writing range 40... converting to JSON... writing binary output: debug/nodes/1/ranges/40.json... done +[node 1] writing range 41... converting to JSON... writing binary output: debug/nodes/1/ranges/41.json... done [node 2] node status... converting to JSON... writing binary output: debug/nodes/2/status.json... done [node 2] using SQL connection URL: postgresql://... [node 2] retrieving SQL data for crdb_internal.feature_usage... writing output: debug/nodes/2/crdb_internal.feature_usage.txt... @@ -225,7 +226,7 @@ debug zip --concurrency=1 --cpu-profile-duration=0s /dev/null [node 3] 1 log file ... [node 3] [log file ... [node 3] requesting ranges... received response... done -[node 3] 40 ranges found +[node 3] 41 ranges found [node 3] writing range 1... converting to JSON... writing binary output: debug/nodes/3/ranges/1.json... done [node 3] writing range 2... converting to JSON... writing binary output: debug/nodes/3/ranges/2.json... done [node 3] writing range 3... converting to JSON... writing binary output: debug/nodes/3/ranges/3.json... done @@ -266,6 +267,7 @@ debug zip --concurrency=1 --cpu-profile-duration=0s /dev/null [node 3] writing range 38... converting to JSON... writing binary output: debug/nodes/3/ranges/38.json... done [node 3] writing range 39... converting to JSON... writing binary output: debug/nodes/3/ranges/39.json... done [node 3] writing range 40... converting to JSON... writing binary output: debug/nodes/3/ranges/40.json... done +[node 3] writing range 41... converting to JSON... writing binary output: debug/nodes/3/ranges/41.json... done [cluster] doctor examining cluster...... writing binary output: debug/reports/doctor.txt... done [cluster] requesting list of SQL databases... received response... done [cluster] 3 databases found @@ -274,7 +276,7 @@ debug zip --concurrency=1 --cpu-profile-duration=0s /dev/null [cluster] [database: postgres] requesting database details... received response... converting to JSON... writing binary output: debug/schema/postgres@details.json... done [cluster] [database: postgres] 0 tables found [cluster] [database: system] requesting database details... received response... converting to JSON... writing binary output: debug/schema/system@details.json... done -[cluster] [database: system] 33 tables found +[cluster] [database: system] 34 tables found [cluster] [database: system] [table: public.comments] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system/public_comments.json... done [cluster] [database: system] [table: public.database_role_settings] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system/public_database_role_settings.json... done [cluster] [database: system] [table: public.descriptor] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system/public_descriptor.json... done @@ -302,6 +304,7 @@ debug zip --concurrency=1 --cpu-profile-duration=0s /dev/null [cluster] [database: system] [table: public.statement_diagnostics_requests] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system/public_statement_diagnostics_requests.json... done [cluster] [database: system] [table: public.statement_statistics] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system/public_statement_statistics.json... done [cluster] [database: system] [table: public.table_statistics] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system/public_table_statistics.json... done +[cluster] [database: system] [table: public.tenant_usage] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system/public_tenant_usage.json... done [cluster] [database: system] [table: public.tenants] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system/public_tenants.json... done [cluster] [database: system] [table: public.transaction_statistics] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system/public_transaction_statistics.json... done [cluster] [database: system] [table: public.ui] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system/public_ui.json... done diff --git a/pkg/cli/testdata/zip/partial1_excluded b/pkg/cli/testdata/zip/partial1_excluded index c8081f6f253c..34d1bcf664d8 100644 --- a/pkg/cli/testdata/zip/partial1_excluded +++ b/pkg/cli/testdata/zip/partial1_excluded @@ -66,7 +66,7 @@ debug zip /dev/null --concurrency=1 --exclude-nodes=2 --cpu-profile-duration=0 [node 1] 1 log file ... [node 1] [log file ... [node 1] requesting ranges... received response... done -[node 1] 40 ranges found +[node 1] 41 ranges found [node 1] writing range 1... converting to JSON... writing binary output: debug/nodes/1/ranges/1.json... done [node 1] writing range 2... converting to JSON... writing binary output: debug/nodes/1/ranges/2.json... done [node 1] writing range 3... converting to JSON... writing binary output: debug/nodes/1/ranges/3.json... done @@ -107,6 +107,7 @@ debug zip /dev/null --concurrency=1 --exclude-nodes=2 --cpu-profile-duration=0 [node 1] writing range 38... converting to JSON... writing binary output: debug/nodes/1/ranges/38.json... done [node 1] writing range 39... converting to JSON... writing binary output: debug/nodes/1/ranges/39.json... done [node 1] writing range 40... converting to JSON... writing binary output: debug/nodes/1/ranges/40.json... done +[node 1] writing range 41... converting to JSON... writing binary output: debug/nodes/1/ranges/41.json... done [node 2] skipping node... writing binary output: debug/nodes/2.skipped... done [node 3] node status... converting to JSON... writing binary output: debug/nodes/3/status.json... done [node 3] using SQL connection URL: postgresql://... @@ -143,7 +144,7 @@ debug zip /dev/null --concurrency=1 --exclude-nodes=2 --cpu-profile-duration=0 [node 3] 1 log file ... [node 3] [log file ... [node 3] requesting ranges... received response... done -[node 3] 40 ranges found +[node 3] 41 ranges found [node 3] writing range 1... converting to JSON... writing binary output: debug/nodes/3/ranges/1.json... done [node 3] writing range 2... converting to JSON... writing binary output: debug/nodes/3/ranges/2.json... done [node 3] writing range 3... converting to JSON... writing binary output: debug/nodes/3/ranges/3.json... done @@ -184,6 +185,7 @@ debug zip /dev/null --concurrency=1 --exclude-nodes=2 --cpu-profile-duration=0 [node 3] writing range 38... converting to JSON... writing binary output: debug/nodes/3/ranges/38.json... done [node 3] writing range 39... converting to JSON... writing binary output: debug/nodes/3/ranges/39.json... done [node 3] writing range 40... converting to JSON... writing binary output: debug/nodes/3/ranges/40.json... done +[node 3] writing range 41... converting to JSON... writing binary output: debug/nodes/3/ranges/41.json... done [cluster] doctor examining cluster...... writing binary output: debug/reports/doctor.txt... done [cluster] requesting list of SQL databases... received response... done [cluster] 3 databases found @@ -192,7 +194,7 @@ debug zip /dev/null --concurrency=1 --exclude-nodes=2 --cpu-profile-duration=0 [cluster] [database: postgres] requesting database details... received response... converting to JSON... writing binary output: debug/schema/postgres@details.json... done [cluster] [database: postgres] 0 tables found [cluster] [database: system] requesting database details... received response... converting to JSON... writing binary output: debug/schema/system@details.json... done -[cluster] [database: system] 33 tables found +[cluster] [database: system] 34 tables found [cluster] [database: system] [table: public.comments] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system/public_comments.json... done [cluster] [database: system] [table: public.database_role_settings] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system/public_database_role_settings.json... done [cluster] [database: system] [table: public.descriptor] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system/public_descriptor.json... done @@ -220,6 +222,7 @@ debug zip /dev/null --concurrency=1 --exclude-nodes=2 --cpu-profile-duration=0 [cluster] [database: system] [table: public.statement_diagnostics_requests] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system/public_statement_diagnostics_requests.json... done [cluster] [database: system] [table: public.statement_statistics] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system/public_statement_statistics.json... done [cluster] [database: system] [table: public.table_statistics] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system/public_table_statistics.json... done +[cluster] [database: system] [table: public.tenant_usage] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system/public_tenant_usage.json... done [cluster] [database: system] [table: public.tenants] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system/public_tenants.json... done [cluster] [database: system] [table: public.transaction_statistics] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system/public_transaction_statistics.json... done [cluster] [database: system] [table: public.ui] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system/public_ui.json... done diff --git a/pkg/cli/testdata/zip/partial2 b/pkg/cli/testdata/zip/partial2 index 2b59dac7a74c..ddc1533ba0f5 100644 --- a/pkg/cli/testdata/zip/partial2 +++ b/pkg/cli/testdata/zip/partial2 @@ -66,7 +66,7 @@ debug zip --concurrency=1 --cpu-profile-duration=0 /dev/null [node 1] 1 log file ... [node 1] [log file ... [node 1] requesting ranges... received response... done -[node 1] 40 ranges found +[node 1] 41 ranges found [node 1] writing range 1... converting to JSON... writing binary output: debug/nodes/1/ranges/1.json... done [node 1] writing range 2... converting to JSON... writing binary output: debug/nodes/1/ranges/2.json... done [node 1] writing range 3... converting to JSON... writing binary output: debug/nodes/1/ranges/3.json... done @@ -107,6 +107,7 @@ debug zip --concurrency=1 --cpu-profile-duration=0 /dev/null [node 1] writing range 38... converting to JSON... writing binary output: debug/nodes/1/ranges/38.json... done [node 1] writing range 39... converting to JSON... writing binary output: debug/nodes/1/ranges/39.json... done [node 1] writing range 40... converting to JSON... writing binary output: debug/nodes/1/ranges/40.json... done +[node 1] writing range 41... converting to JSON... writing binary output: debug/nodes/1/ranges/41.json... done [node 3] node status... converting to JSON... writing binary output: debug/nodes/3/status.json... done [node 3] using SQL connection URL: postgresql://... [node 3] retrieving SQL data for crdb_internal.feature_usage... writing output: debug/nodes/3/crdb_internal.feature_usage.txt... done @@ -142,7 +143,7 @@ debug zip --concurrency=1 --cpu-profile-duration=0 /dev/null [node 3] 1 log file ... [node 3] [log file ... [node 3] requesting ranges... received response... done -[node 3] 40 ranges found +[node 3] 41 ranges found [node 3] writing range 1... converting to JSON... writing binary output: debug/nodes/3/ranges/1.json... done [node 3] writing range 2... converting to JSON... writing binary output: debug/nodes/3/ranges/2.json... done [node 3] writing range 3... converting to JSON... writing binary output: debug/nodes/3/ranges/3.json... done @@ -183,6 +184,7 @@ debug zip --concurrency=1 --cpu-profile-duration=0 /dev/null [node 3] writing range 38... converting to JSON... writing binary output: debug/nodes/3/ranges/38.json... done [node 3] writing range 39... converting to JSON... writing binary output: debug/nodes/3/ranges/39.json... done [node 3] writing range 40... converting to JSON... writing binary output: debug/nodes/3/ranges/40.json... done +[node 3] writing range 41... converting to JSON... writing binary output: debug/nodes/3/ranges/41.json... done [cluster] doctor examining cluster...... writing binary output: debug/reports/doctor.txt... done [cluster] requesting list of SQL databases... received response... done [cluster] 3 databases found @@ -191,7 +193,7 @@ debug zip --concurrency=1 --cpu-profile-duration=0 /dev/null [cluster] [database: postgres] requesting database details... received response... converting to JSON... writing binary output: debug/schema/postgres@details.json... done [cluster] [database: postgres] 0 tables found [cluster] [database: system] requesting database details... received response... converting to JSON... writing binary output: debug/schema/system@details.json... done -[cluster] [database: system] 33 tables found +[cluster] [database: system] 34 tables found [cluster] [database: system] [table: public.comments] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system/public_comments.json... done [cluster] [database: system] [table: public.database_role_settings] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system/public_database_role_settings.json... done [cluster] [database: system] [table: public.descriptor] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system/public_descriptor.json... done @@ -219,6 +221,7 @@ debug zip --concurrency=1 --cpu-profile-duration=0 /dev/null [cluster] [database: system] [table: public.statement_diagnostics_requests] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system/public_statement_diagnostics_requests.json... done [cluster] [database: system] [table: public.statement_statistics] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system/public_statement_statistics.json... done [cluster] [database: system] [table: public.table_statistics] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system/public_table_statistics.json... done +[cluster] [database: system] [table: public.tenant_usage] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system/public_tenant_usage.json... done [cluster] [database: system] [table: public.tenants] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system/public_tenants.json... done [cluster] [database: system] [table: public.transaction_statistics] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system/public_transaction_statistics.json... done [cluster] [database: system] [table: public.ui] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system/public_ui.json... done diff --git a/pkg/cli/testdata/zip/specialnames b/pkg/cli/testdata/zip/specialnames index 91bab7c75f95..a979be0655fb 100644 --- a/pkg/cli/testdata/zip/specialnames +++ b/pkg/cli/testdata/zip/specialnames @@ -23,7 +23,7 @@ zip [cluster] [database: postgres] requesting database details... received response... converting to JSON... writing binary output: debug/schema/postgres@details.json... done [cluster] [database: postgres] 0 tables found [cluster] [database: system] requesting database details... received response... converting to JSON... writing binary output: debug/schema/system-1@details.json... done -[cluster] [database: system] 33 tables found +[cluster] [database: system] 34 tables found [cluster] [database: system] [table: public.comments] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system-1/public_comments.json... done [cluster] [database: system] [table: public.database_role_settings] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system-1/public_database_role_settings.json... done [cluster] [database: system] [table: public.descriptor] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system-1/public_descriptor.json... done @@ -51,6 +51,7 @@ zip [cluster] [database: system] [table: public.statement_diagnostics_requests] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system-1/public_statement_diagnostics_requests.json... done [cluster] [database: system] [table: public.statement_statistics] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system-1/public_statement_statistics.json... done [cluster] [database: system] [table: public.table_statistics] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system-1/public_table_statistics.json... done +[cluster] [database: system] [table: public.tenant_usage] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system-1/public_tenant_usage.json... done [cluster] [database: system] [table: public.tenants] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system-1/public_tenants.json... done [cluster] [database: system] [table: public.transaction_statistics] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system-1/public_transaction_statistics.json... done [cluster] [database: system] [table: public.ui] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system-1/public_ui.json... done diff --git a/pkg/cli/testdata/zip/testzip b/pkg/cli/testdata/zip/testzip index fd9be93dab47..da5197f348b8 100644 --- a/pkg/cli/testdata/zip/testzip +++ b/pkg/cli/testdata/zip/testzip @@ -66,7 +66,7 @@ debug zip --concurrency=1 --cpu-profile-duration=1s /dev/null [node 1] requesting log file ... [node 1] 0 log file ... [node 1] requesting ranges... received response... done -[node 1] 40 ranges found +[node 1] 41 ranges found [node 1] writing range 1... converting to JSON... writing binary output: debug/nodes/1/ranges/1.json... done [node 1] writing range 2... converting to JSON... writing binary output: debug/nodes/1/ranges/2.json... done [node 1] writing range 3... converting to JSON... writing binary output: debug/nodes/1/ranges/3.json... done @@ -107,6 +107,7 @@ debug zip --concurrency=1 --cpu-profile-duration=1s /dev/null [node 1] writing range 38... converting to JSON... writing binary output: debug/nodes/1/ranges/38.json... done [node 1] writing range 39... converting to JSON... writing binary output: debug/nodes/1/ranges/39.json... done [node 1] writing range 40... converting to JSON... writing binary output: debug/nodes/1/ranges/40.json... done +[node 1] writing range 41... converting to JSON... writing binary output: debug/nodes/1/ranges/41.json... done [cluster] doctor examining cluster...... writing binary output: debug/reports/doctor.txt... done [cluster] requesting list of SQL databases... received response... done [cluster] 3 databases found @@ -115,7 +116,7 @@ debug zip --concurrency=1 --cpu-profile-duration=1s /dev/null [cluster] [database: postgres] requesting database details... received response... converting to JSON... writing binary output: debug/schema/postgres@details.json... done [cluster] [database: postgres] 0 tables found [cluster] [database: system] requesting database details... received response... converting to JSON... writing binary output: debug/schema/system@details.json... done -[cluster] [database: system] 33 tables found +[cluster] [database: system] 34 tables found [cluster] [database: system] [table: public.comments] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system/public_comments.json... done [cluster] [database: system] [table: public.database_role_settings] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system/public_database_role_settings.json... done [cluster] [database: system] [table: public.descriptor] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system/public_descriptor.json... done @@ -143,6 +144,7 @@ debug zip --concurrency=1 --cpu-profile-duration=1s /dev/null [cluster] [database: system] [table: public.statement_diagnostics_requests] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system/public_statement_diagnostics_requests.json... done [cluster] [database: system] [table: public.statement_statistics] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system/public_statement_statistics.json... done [cluster] [database: system] [table: public.table_statistics] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system/public_table_statistics.json... done +[cluster] [database: system] [table: public.tenant_usage] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system/public_tenant_usage.json... done [cluster] [database: system] [table: public.tenants] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system/public_tenants.json... done [cluster] [database: system] [table: public.transaction_statistics] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system/public_transaction_statistics.json... done [cluster] [database: system] [table: public.ui] requesting table details... received response... converting to JSON... writing binary output: debug/schema/system/public_ui.json... done diff --git a/pkg/cli/testdata/zip/testzip_concurrent b/pkg/cli/testdata/zip/testzip_concurrent index 44e90a1a5e8d..6328465446fd 100644 --- a/pkg/cli/testdata/zip/testzip_concurrent +++ b/pkg/cli/testdata/zip/testzip_concurrent @@ -13,7 +13,7 @@ zip [cluster] [database: postgres] requesting database details: done [cluster] [database: postgres] requesting database details: received response... [cluster] [database: postgres] requesting database details: writing binary output: debug/schema/postgres@details.json... -[cluster] [database: system] 33 tables found +[cluster] [database: system] 34 tables found [cluster] [database: system] [table: public.comments] requesting table details... [cluster] [database: system] [table: public.comments] requesting table details: converting to JSON... [cluster] [database: system] [table: public.comments] requesting table details: done @@ -149,6 +149,11 @@ zip [cluster] [database: system] [table: public.table_statistics] requesting table details: done [cluster] [database: system] [table: public.table_statistics] requesting table details: received response... [cluster] [database: system] [table: public.table_statistics] requesting table details: writing binary output: debug/schema/system/public_table_statistics.json... +[cluster] [database: system] [table: public.tenant_usage] requesting table details... +[cluster] [database: system] [table: public.tenant_usage] requesting table details: converting to JSON... +[cluster] [database: system] [table: public.tenant_usage] requesting table details: done +[cluster] [database: system] [table: public.tenant_usage] requesting table details: received response... +[cluster] [database: system] [table: public.tenant_usage] requesting table details: writing binary output: debug/schema/system/public_tenant_usage.json... [cluster] [database: system] [table: public.tenants] requesting table details... [cluster] [database: system] [table: public.tenants] requesting table details: converting to JSON... [cluster] [database: system] [table: public.tenants] requesting table details: done @@ -296,7 +301,7 @@ zip [cluster] using SQL address: ... [cluster] using SQL address: ... [node 1] 1 log file ... -[node 1] 40 ranges found +[node 1] 41 ranges found [node 1] [log file ... [node 1] [log file ... [node 1] [log file ... @@ -536,6 +541,10 @@ zip [node 1] writing range 40: converting to JSON... [node 1] writing range 40: done [node 1] writing range 40: writing binary output: debug/nodes/1/ranges/40.json... +[node 1] writing range 41... +[node 1] writing range 41: converting to JSON... +[node 1] writing range 41: done +[node 1] writing range 41: writing binary output: debug/nodes/1/ranges/41.json... [node 1] writing range 4: converting to JSON... [node 1] writing range 4: done [node 1] writing range 4: writing binary output: debug/nodes/1/ranges/4.json... @@ -560,7 +569,7 @@ zip [node 1] writing range 9: done [node 1] writing range 9: writing binary output: debug/nodes/1/ranges/9.json... [node 2] 1 log file ... -[node 2] 40 ranges found +[node 2] 41 ranges found [node 2] [log file ... [node 2] [log file ... [node 2] [log file ... @@ -800,6 +809,10 @@ zip [node 2] writing range 40: converting to JSON... [node 2] writing range 40: done [node 2] writing range 40: writing binary output: debug/nodes/2/ranges/40.json... +[node 2] writing range 41... +[node 2] writing range 41: converting to JSON... +[node 2] writing range 41: done +[node 2] writing range 41: writing binary output: debug/nodes/2/ranges/41.json... [node 2] writing range 4: converting to JSON... [node 2] writing range 4: done [node 2] writing range 4: writing binary output: debug/nodes/2/ranges/4.json... @@ -824,7 +837,7 @@ zip [node 2] writing range 9: done [node 2] writing range 9: writing binary output: debug/nodes/2/ranges/9.json... [node 3] 1 log file ... -[node 3] 40 ranges found +[node 3] 41 ranges found [node 3] [log file ... [node 3] [log file ... [node 3] [log file ... @@ -1064,6 +1077,10 @@ zip [node 3] writing range 40: converting to JSON... [node 3] writing range 40: done [node 3] writing range 40: writing binary output: debug/nodes/3/ranges/40.json... +[node 3] writing range 41... +[node 3] writing range 41: converting to JSON... +[node 3] writing range 41: done +[node 3] writing range 41: writing binary output: debug/nodes/3/ranges/41.json... [node 3] writing range 4: converting to JSON... [node 3] writing range 4: done [node 3] writing range 4: writing binary output: debug/nodes/3/ranges/4.json... diff --git a/pkg/clusterversion/cockroach_versions.go b/pkg/clusterversion/cockroach_versions.go index 49771b3562a9..f63b46c1231b 100644 --- a/pkg/clusterversion/cockroach_versions.go +++ b/pkg/clusterversion/cockroach_versions.go @@ -264,6 +264,8 @@ const ( // DatabaseRoleSettings adds the system table for storing per-user and // per-role default session settings. DatabaseRoleSettings + // TenantUsageTable adds the system table for tracking tenant usage. + TenantUsageTable // Step (1): Add new versions here. ) @@ -421,6 +423,10 @@ var versionsSingleton = keyedVersions{ Key: DatabaseRoleSettings, Version: roachpb.Version{Major: 21, Minor: 1, Internal: 118}, }, + { + Key: TenantUsageTable, + Version: roachpb.Version{Major: 21, Minor: 1, Internal: 120}, + }, // Step (2): Add new versions here. } diff --git a/pkg/clusterversion/key_string.go b/pkg/clusterversion/key_string.go index 8d2fdc888409..42a0a34bf6d6 100644 --- a/pkg/clusterversion/key_string.go +++ b/pkg/clusterversion/key_string.go @@ -38,11 +38,12 @@ func _() { _ = x[FixDescriptors-27] _ = x[SQLStatsTable-28] _ = x[DatabaseRoleSettings-29] + _ = x[TenantUsageTable-30] } -const _Key_name = "Start20_2NodeMembershipStatusMinPasswordLengthAbortSpanBytesCreateLoginPrivilegeHBAForNonTLSV20_2Start21_1CPutInlineReplicaVersionsreplacedTruncatedAndRangeAppliedStateMigrationreplacedPostTruncatedAndRangeAppliedStateMigrationTruncatedAndRangeAppliedStateMigrationPostTruncatedAndRangeAppliedStateMigrationSeparatedIntentsTracingVerbosityIndependentSemanticsClosedTimestampsRaftTransportPriorReadSummariesNonVotingReplicasV21_1Start21_1PLUSStart21_2JoinTokensTableAcquisitionTypeInLeaseHistorySerializeViewUDTsExpressionIndexesDeleteDeprecatedNamespaceTableDescriptorMigrationFixDescriptorsSQLStatsTableDatabaseRoleSettings" +const _Key_name = "Start20_2NodeMembershipStatusMinPasswordLengthAbortSpanBytesCreateLoginPrivilegeHBAForNonTLSV20_2Start21_1CPutInlineReplicaVersionsreplacedTruncatedAndRangeAppliedStateMigrationreplacedPostTruncatedAndRangeAppliedStateMigrationTruncatedAndRangeAppliedStateMigrationPostTruncatedAndRangeAppliedStateMigrationSeparatedIntentsTracingVerbosityIndependentSemanticsClosedTimestampsRaftTransportPriorReadSummariesNonVotingReplicasV21_1Start21_1PLUSStart21_2JoinTokensTableAcquisitionTypeInLeaseHistorySerializeViewUDTsExpressionIndexesDeleteDeprecatedNamespaceTableDescriptorMigrationFixDescriptorsSQLStatsTableDatabaseRoleSettingsTenantUsageTable" -var _Key_index = [...]uint16{0, 9, 29, 46, 60, 80, 92, 97, 106, 116, 131, 177, 227, 265, 307, 323, 359, 388, 406, 423, 428, 441, 450, 465, 494, 511, 528, 577, 591, 604, 624} +var _Key_index = [...]uint16{0, 9, 29, 46, 60, 80, 92, 97, 106, 116, 131, 177, 227, 265, 307, 323, 359, 388, 406, 423, 428, 441, 450, 465, 494, 511, 528, 577, 591, 604, 624, 640} func (i Key) String() string { if i < 0 || i >= Key(len(_Key_index)-1) { diff --git a/pkg/keys/constants.go b/pkg/keys/constants.go index a747f914e239..177e85eba05a 100644 --- a/pkg/keys/constants.go +++ b/pkg/keys/constants.go @@ -408,6 +408,7 @@ const ( StatementStatisticsTableID = 42 TransactionStatisticsTableID = 43 DatabaseRoleSettingsTableID = 44 + TenantUsageTableID = 45 // CommentType is type for system.comments DatabaseCommentType = 0 diff --git a/pkg/migration/migrations/BUILD.bazel b/pkg/migration/migrations/BUILD.bazel index ce51026c597e..cf58c748ac10 100644 --- a/pkg/migration/migrations/BUILD.bazel +++ b/pkg/migration/migrations/BUILD.bazel @@ -9,6 +9,7 @@ go_library( "join_tokens.go", "migrations.go", "sql_stats.go", + "tenant_usage.go", "truncated_state.go", ], importpath = "github.com/cockroachdb/cockroach/pkg/migration/migrations", diff --git a/pkg/migration/migrations/migrations.go b/pkg/migration/migrations/migrations.go index 640eaed8cfd2..a8adc5ae9bfa 100644 --- a/pkg/migration/migrations/migrations.go +++ b/pkg/migration/migrations/migrations.go @@ -72,6 +72,11 @@ var migrations = []migration.Migration{ toCV(clusterversion.DatabaseRoleSettings), databaseRoleSettingsTableMigration, ), + migration.NewTenantMigration( + "add the systems.tenant_usage table", + toCV(clusterversion.TenantUsageTable), + tenantUsageTableMigration, + ), } func init() { diff --git a/pkg/migration/migrations/tenant_usage.go b/pkg/migration/migrations/tenant_usage.go new file mode 100644 index 000000000000..63ce883e5592 --- /dev/null +++ b/pkg/migration/migrations/tenant_usage.go @@ -0,0 +1,32 @@ +// Copyright 2021 The Cockroach Authors. +// +// Use of this software is governed by the Business Source License +// included in the file licenses/BSL.txt. +// +// As of the Change Date specified in that file, in accordance with +// the Business Source License, use of this software will be governed +// by the Apache License, Version 2.0, included in the file +// licenses/APL.txt. + +package migrations + +import ( + "context" + + "github.com/cockroachdb/cockroach/pkg/clusterversion" + "github.com/cockroachdb/cockroach/pkg/migration" + "github.com/cockroachdb/cockroach/pkg/sql/catalog/systemschema" + "github.com/cockroachdb/cockroach/pkg/startupmigrations" +) + +func tenantUsageTableMigration( + ctx context.Context, _ clusterversion.ClusterVersion, d migration.TenantDeps, +) error { + // Only create the table on the system tenant. + if !d.Codec.ForSystemTenant() { + return nil + } + return startupmigrations.CreateSystemTable( + ctx, d.DB, d.Codec, d.Settings, systemschema.TenantUsageTable, + ) +} diff --git a/pkg/sql/catalog/bootstrap/metadata.go b/pkg/sql/catalog/bootstrap/metadata.go index 9839e9057cc9..eeec3f00394e 100644 --- a/pkg/sql/catalog/bootstrap/metadata.go +++ b/pkg/sql/catalog/bootstrap/metadata.go @@ -328,6 +328,10 @@ func addSystemDescriptorsToSchema(target *MetadataSchema) { target.AddDescriptor(keys.SystemDatabaseID, systemschema.StatementStatisticsTable) target.AddDescriptor(keys.SystemDatabaseID, systemschema.TransactionStatisticsTable) target.AddDescriptor(keys.SystemDatabaseID, systemschema.DatabaseRoleSettingsTable) + + if target.codec.ForSystemTenant() { + target.AddDescriptor(keys.SystemDatabaseID, systemschema.TenantUsageTable) + } } // addSplitIDs adds a split point for each of the PseudoTableIDs to the supplied diff --git a/pkg/sql/catalog/descpb/privilege.go b/pkg/sql/catalog/descpb/privilege.go index 5c2091b93b92..c1f27a7bc131 100644 --- a/pkg/sql/catalog/descpb/privilege.go +++ b/pkg/sql/catalog/descpb/privilege.go @@ -560,6 +560,7 @@ var SystemAllowedPrivileges = map[ID]privilege.List{ keys.StatementStatisticsTableID: privilege.ReadData, keys.TransactionStatisticsTableID: privilege.ReadData, keys.DatabaseRoleSettingsTableID: privilege.ReadWriteData, + keys.TenantUsageTableID: privilege.ReadWriteData, } // SetOwner sets the owner of the privilege descriptor to the provided string. diff --git a/pkg/sql/catalog/systemschema/system.go b/pkg/sql/catalog/systemschema/system.go index 319387f3ae3c..7ec6bc07a947 100644 --- a/pkg/sql/catalog/systemschema/system.go +++ b/pkg/sql/catalog/systemschema/system.go @@ -450,6 +450,75 @@ CREATE TABLE system.database_role_settings ( settings ) );` + + TenantUsageTableSchema = ` +CREATE TABLE system.tenant_usage ( + tenant_id INT NOT NULL, + + -- For each tenant, there is a special row with instance_id = 0 which contains + -- per-tenant stat. Each SQL instance (pod) also has its own row with + -- per-instance state. + instance_id INT NOT NULL, + + -- next_instance_id identifies the next live instance ID, with the smallest ID + -- larger than this instance_id (or 0 if there is no such ID). + -- We are overlaying a circular linked list of all live instances, with + -- instance 0 acting as a sentinel (always the head of the list). + next_instance_id INT NOT NULL, + + -- ------------------------------------------------------------------- + -- The following fields are used only for the per-tenant state, when + -- instance_id = 0. + -- ------------------------------------------------------------------- + + -- Bucket configuration. + ru_burst_limit FLOAT, + ru_refill_rate FLOAT, + + -- Current amount of RUs in the bucket. + ru_current FLOAT, + + -- Current sum of the shares values for all instances. + current_share_sum FLOAT, + + -- Cumulative usage statistics. + total_ru_usage FLOAT, + total_read_requests INT, + total_read_bytes INT, + total_write_requests INT, + total_write_bytes INT, + total_sql_pod_cpu_seconds FLOAT, -- TODO: Maybe milliseconds and INT8? + + -- ------------------------------------------------------------- + -- The following fields are used for per-instance state, when + -- instance_id != 0. + -- -------------------------------------------------------------- + + -- The lease is a unique identifier for this instance, necessary because + -- instance IDs can be reused. + instance_lease BYTES, + + -- Last request sequence number. These numbers are provided by the + -- instance and are monotonically increasing; used to detect duplicate + -- requests and provide idempotency. + instance_seq INT, + + -- Current shares value for this instance. + instance_shares FLOAT, + + -- Time when we last heard from this instance. + instance_last_update TIMESTAMP, + + FAMILY "primary" ( + tenant_id, instance_id, next_instance_id, + ru_burst_limit, ru_refill_rate, ru_current, current_share_sum, + total_ru_usage, total_read_requests, total_read_bytes, total_write_requests, + total_write_bytes, total_sql_pod_cpu_seconds, + instance_lease, instance_seq, instance_shares, instance_last_update + ), + + PRIMARY KEY (tenant_id, instance_id) +)` ) func pk(name string) descpb.IndexDescriptor { @@ -531,7 +600,7 @@ var ( {Name: "primary", ID: 0, ColumnNames: []string{"parentID", "parentSchemaID", "name"}, ColumnIDs: []descpb.ColumnID{1, 2, 3}}, {Name: "fam_4_id", ID: catconstants.NamespaceTableFamilyID, ColumnNames: []string{"id"}, ColumnIDs: []descpb.ColumnID{4}, DefaultColumnID: 4}, }, - NextFamilyID: 5, + NextFamilyID: catconstants.NamespaceTableFamilyID + 1, PrimaryIndex: descpb.IndexDescriptor{ Name: "primary", ID: catconstants.NamespaceTablePrimaryIndexID, @@ -2113,6 +2182,69 @@ var ( FormatVersion: descpb.InterleavedFormatVersion, NextMutationID: 1, }) + // TenantUsageTable is the descriptor for the tenant_usage table. It is used + // to coordinate throttling of tenant SQL pods and to track consumption. + TenantUsageTable = makeTable(descpb.TableDescriptor{ + Name: "tenant_usage", + ID: keys.TenantUsageTableID, + ParentID: keys.SystemDatabaseID, + UnexposedParentSchemaID: keys.PublicSchemaID, + Version: 1, + Columns: []descpb.ColumnDescriptor{ + {Name: "tenant_id", ID: 1, Type: types.Int, Nullable: false}, + {Name: "instance_id", ID: 2, Type: types.Int, Nullable: false}, + {Name: "next_instance_id", ID: 3, Type: types.Int, Nullable: false}, + {Name: "ru_burst_limit", ID: 4, Type: types.Float, Nullable: true}, + {Name: "ru_refill_rate", ID: 5, Type: types.Float, Nullable: true}, + {Name: "ru_current", ID: 6, Type: types.Float, Nullable: true}, + {Name: "current_share_sum", ID: 7, Type: types.Float, Nullable: true}, + {Name: "total_ru_usage", ID: 8, Type: types.Float, Nullable: true}, + {Name: "total_read_requests", ID: 9, Type: types.Int, Nullable: true}, + {Name: "total_read_bytes", ID: 10, Type: types.Int, Nullable: true}, + {Name: "total_write_requests", ID: 11, Type: types.Int, Nullable: true}, + {Name: "total_write_bytes", ID: 12, Type: types.Int, Nullable: true}, + {Name: "total_sql_pod_cpu_seconds", ID: 13, Type: types.Float, Nullable: true}, + {Name: "instance_lease", ID: 14, Type: types.Bytes, Nullable: true}, + {Name: "instance_seq", ID: 15, Type: types.Int, Nullable: true}, + {Name: "instance_shares", ID: 16, Type: types.Float, Nullable: true}, + {Name: "instance_last_update", ID: 17, Type: types.Timestamp, Nullable: true}, + }, + NextColumnID: 18, + Families: []descpb.ColumnFamilyDescriptor{ + { + Name: "primary", + ID: 0, + ColumnNames: []string{ + "tenant_id", "instance_id", "next_instance_id", + "ru_burst_limit", "ru_refill_rate", "ru_current", "current_share_sum", + "total_ru_usage", "total_read_requests", "total_read_bytes", "total_write_requests", + "total_write_bytes", "total_sql_pod_cpu_seconds", + "instance_lease", "instance_seq", "instance_shares", "instance_last_update", + }, + ColumnIDs: []descpb.ColumnID{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17}, + DefaultColumnID: 0, + }, + }, + NextFamilyID: 1, + PrimaryIndex: descpb.IndexDescriptor{ + Name: tabledesc.PrimaryKeyIndexName, + ID: 1, + Unique: true, + KeyColumnNames: []string{"tenant_id", "instance_id"}, + KeyColumnDirections: []descpb.IndexDescriptor_Direction{ + descpb.IndexDescriptor_ASC, + descpb.IndexDescriptor_ASC, + }, + KeyColumnIDs: []descpb.ColumnID{1, 2}, + Version: descpb.StrictIndexColumnIDGuaranteesVersion, + }, + NextIndexID: 2, + Privileges: descpb.NewCustomSuperuserPrivilegeDescriptor( + descpb.SystemAllowedPrivileges[keys.TenantUsageTableID], security.NodeUserName(), + ), + FormatVersion: descpb.InterleavedFormatVersion, + NextMutationID: 1, + }) ) // newCommentPrivilegeDescriptor returns a privilege descriptor for comment table diff --git a/pkg/sql/logictest/testdata/logic_test/grant_table b/pkg/sql/logictest/testdata/logic_test/grant_table index 403aa5788e80..5b234e04c3a4 100644 --- a/pkg/sql/logictest/testdata/logic_test/grant_table +++ b/pkg/sql/logictest/testdata/logic_test/grant_table @@ -912,6 +912,16 @@ system public join_tokens root GRANT system public join_tokens root INSERT system public join_tokens root SELECT system public join_tokens root UPDATE +system public tenant_usage admin DELETE +system public tenant_usage admin GRANT +system public tenant_usage admin INSERT +system public tenant_usage admin SELECT +system public tenant_usage admin UPDATE +system public tenant_usage root DELETE +system public tenant_usage root GRANT +system public tenant_usage root INSERT +system public tenant_usage root SELECT +system public tenant_usage root UPDATE system public statement_statistics admin GRANT system public statement_statistics admin SELECT system public statement_statistics root GRANT @@ -1411,6 +1421,11 @@ system public table_statistics root GRA system public table_statistics root INSERT system public table_statistics root SELECT system public table_statistics root UPDATE +system public tenant_usage root DELETE +system public tenant_usage root GRANT +system public tenant_usage root INSERT +system public tenant_usage root SELECT +system public tenant_usage root UPDATE system public tenants root GRANT system public tenants root SELECT system public transaction_statistics root GRANT diff --git a/pkg/sql/logictest/testdata/logic_test/information_schema b/pkg/sql/logictest/testdata/logic_test/information_schema index 863061ceaff0..e8248aed93eb 100644 --- a/pkg/sql/logictest/testdata/logic_test/information_schema +++ b/pkg/sql/logictest/testdata/logic_test/information_schema @@ -1347,6 +1347,7 @@ system public join_tokens BASE T system public statement_statistics BASE TABLE YES 1 system public transaction_statistics BASE TABLE YES 1 system public database_role_settings BASE TABLE YES 1 +system public tenant_usage BASE TABLE YES 1 statement ok ALTER TABLE other_db.xyz ADD COLUMN j INT @@ -1549,6 +1550,10 @@ system public 630200280_20_6_not_null system public 630200280_20_7_not_null system public table_statistics CHECK NO NO system public 630200280_20_8_not_null system public table_statistics CHECK NO NO system public primary system public table_statistics PRIMARY KEY NO NO +system public 630200280_45_1_not_null system public tenant_usage CHECK NO NO +system public 630200280_45_2_not_null system public tenant_usage CHECK NO NO +system public 630200280_45_3_not_null system public tenant_usage CHECK NO NO +system public primary system public tenant_usage PRIMARY KEY NO NO system public 630200280_8_1_not_null system public tenants CHECK NO NO system public 630200280_8_2_not_null system public tenants CHECK NO NO system public primary system public tenants PRIMARY KEY NO NO @@ -1724,6 +1729,9 @@ system public 630200280_43_8_not_null system public 630200280_44_1_not_null database_id IS NOT NULL system public 630200280_44_2_not_null role_name IS NOT NULL system public 630200280_44_3_not_null settings IS NOT NULL +system public 630200280_45_1_not_null tenant_id IS NOT NULL +system public 630200280_45_2_not_null instance_id IS NOT NULL +system public 630200280_45_3_not_null next_instance_id IS NOT NULL system public 630200280_4_1_not_null username IS NOT NULL system public 630200280_4_3_not_null isRole IS NOT NULL system public 630200280_5_1_not_null id IS NOT NULL @@ -1799,6 +1807,8 @@ system public statement_statistics node_id system public statement_statistics plan_hash system public primary system public table_statistics statisticID system public primary system public table_statistics tableID system public primary +system public tenant_usage instance_id system public primary +system public tenant_usage tenant_id system public primary system public tenants id system public primary system public transaction_statistics aggregated_ts system public primary system public transaction_statistics app_name system public primary @@ -2054,6 +2064,23 @@ system public table_statistics nullCount system public table_statistics rowCount 6 system public table_statistics statisticID 2 system public table_statistics tableID 1 +system public tenant_usage current_share_sum 7 +system public tenant_usage instance_id 2 +system public tenant_usage instance_last_update 17 +system public tenant_usage instance_lease 14 +system public tenant_usage instance_seq 15 +system public tenant_usage instance_shares 16 +system public tenant_usage next_instance_id 3 +system public tenant_usage ru_burst_limit 4 +system public tenant_usage ru_current 6 +system public tenant_usage ru_refill_rate 5 +system public tenant_usage tenant_id 1 +system public tenant_usage total_read_bytes 10 +system public tenant_usage total_read_requests 9 +system public tenant_usage total_ru_usage 8 +system public tenant_usage total_sql_pod_cpu_seconds 13 +system public tenant_usage total_write_bytes 12 +system public tenant_usage total_write_requests 11 system public tenants active 2 system public tenants id 1 system public tenants info 3 @@ -3055,6 +3082,16 @@ NULL root system public table_statistics NULL root system public table_statistics INSERT NULL NO NULL root system public table_statistics SELECT NULL YES NULL root system public table_statistics UPDATE NULL NO +NULL admin system public tenant_usage DELETE NULL NO +NULL admin system public tenant_usage GRANT NULL NO +NULL admin system public tenant_usage INSERT NULL NO +NULL admin system public tenant_usage SELECT NULL YES +NULL admin system public tenant_usage UPDATE NULL NO +NULL root system public tenant_usage DELETE NULL NO +NULL root system public tenant_usage GRANT NULL NO +NULL root system public tenant_usage INSERT NULL NO +NULL root system public tenant_usage SELECT NULL YES +NULL root system public tenant_usage UPDATE NULL NO NULL admin system public tenants GRANT NULL NO NULL admin system public tenants SELECT NULL YES NULL root system public tenants GRANT NULL NO @@ -3668,6 +3705,16 @@ NULL root system public database_role_settings NULL root system public database_role_settings INSERT NULL NO NULL root system public database_role_settings SELECT NULL YES NULL root system public database_role_settings UPDATE NULL NO +NULL admin system public tenant_usage DELETE NULL NO +NULL admin system public tenant_usage GRANT NULL NO +NULL admin system public tenant_usage INSERT NULL NO +NULL admin system public tenant_usage SELECT NULL YES +NULL admin system public tenant_usage UPDATE NULL NO +NULL root system public tenant_usage DELETE NULL NO +NULL root system public tenant_usage GRANT NULL NO +NULL root system public tenant_usage INSERT NULL NO +NULL root system public tenant_usage SELECT NULL YES +NULL root system public tenant_usage UPDATE NULL NO statement ok CREATE TABLE other_db.xyz (i INT) diff --git a/pkg/sql/logictest/testdata/logic_test/pg_catalog b/pkg/sql/logictest/testdata/logic_test/pg_catalog index 440aeeca9e6e..0bb9275b747c 100644 --- a/pkg/sql/logictest/testdata/logic_test/pg_catalog +++ b/pkg/sql/logictest/testdata/logic_test/pg_catalog @@ -1053,6 +1053,7 @@ indexrelid indrelid indnatts indisunique indisprimary indisexclusion indim 3752917847 27 2 true true false true false true false false true false 1 2 0 0 0 0 2 2 NULL NULL 2 3966258450 14 1 true true false true false true false false true false 1 3403232968 0 2 NULL NULL 1 4012654114 30 3 true true false true false true false false true false 1 2 3 0 0 3403232968 0 0 0 2 2 2 NULL NULL 3 +4133203393 45 2 true true false true false true false false true false 1 2 0 0 0 0 2 2 NULL NULL 2 4225994721 13 2 true true false true false true false false true false 1 7 0 0 0 0 2 2 NULL NULL 2 # From #26504 @@ -1145,6 +1146,8 @@ indexrelid operator_argument_type_oid operator_argument_position 4012654114 0 1 4012654114 0 2 4012654114 0 3 +4133203393 0 1 +4133203393 0 2 4225994721 0 1 4225994721 0 2 diff --git a/pkg/sql/logictest/testdata/logic_test/ranges b/pkg/sql/logictest/testdata/logic_test/ranges index a2da624e9d47..58627d6147f5 100644 --- a/pkg/sql/logictest/testdata/logic_test/ranges +++ b/pkg/sql/logictest/testdata/logic_test/ranges @@ -314,7 +314,8 @@ start_key start_pretty end_key [177] /Table/41 [178] /Table/42 system join_tokens · {1} 1 [178] /Table/42 [179] /Table/43 system statement_statistics · {1} 1 [179] /Table/43 [180] /Table/44 system transaction_statistics · {1} 1 -[180] /Table/44 [189 137] /Table/53/1 system database_role_settings · {1} 1 +[180] /Table/44 [181] /Table/45 system database_role_settings · {1} 1 +[181] /Table/45 [189 137] /Table/53/1 system tenant_usage · {1} 1 [189 137] /Table/53/1 [189 137 137] /Table/53/1/1 test t · {1} 1 [189 137 137] /Table/53/1/1 [189 137 141 137] /Table/53/1/5/1 test t · {3,4} 3 [189 137 141 137] /Table/53/1/5/1 [189 137 141 138] /Table/53/1/5/2 test t · {1,2,3} 1 @@ -377,7 +378,8 @@ start_key start_pretty end_key [177] /Table/41 [178] /Table/42 system join_tokens · {1} 1 [178] /Table/42 [179] /Table/43 system statement_statistics · {1} 1 [179] /Table/43 [180] /Table/44 system transaction_statistics · {1} 1 -[180] /Table/44 [189 137] /Table/53/1 system database_role_settings · {1} 1 +[180] /Table/44 [181] /Table/45 system database_role_settings · {1} 1 +[181] /Table/45 [189 137] /Table/53/1 system tenant_usage · {1} 1 [189 137] /Table/53/1 [189 137 137] /Table/53/1/1 test t · {1} 1 [189 137 137] /Table/53/1/1 [189 137 141 137] /Table/53/1/5/1 test t · {3,4} 3 [189 137 141 137] /Table/53/1/5/1 [189 137 141 138] /Table/53/1/5/2 test t · {1,2,3} 1 diff --git a/pkg/sql/logictest/testdata/logic_test/show_source b/pkg/sql/logictest/testdata/logic_test/show_source index 1ad62a3b9185..3c244b033dc5 100644 --- a/pkg/sql/logictest/testdata/logic_test/show_source +++ b/pkg/sql/logictest/testdata/logic_test/show_source @@ -206,6 +206,7 @@ SELECT * FROM [SHOW TABLES FROM system] ---- schema_name table_name type owner estimated_row_count locality public descriptor table NULL 0 NULL +public tenant_usage table NULL 0 NULL public database_role_settings table NULL 0 NULL public transaction_statistics table NULL 0 NULL public statement_statistics table NULL 0 NULL @@ -244,6 +245,7 @@ SELECT * FROM [SHOW TABLES FROM system WITH COMMENT] ---- schema_name table_name type owner estimated_row_count locality comment public descriptor table NULL 0 NULL · +public tenant_usage table NULL 0 NULL · public database_role_settings table NULL 0 NULL · public transaction_statistics table NULL 0 NULL · public statement_statistics table NULL 0 NULL · diff --git a/pkg/sql/logictest/testdata/logic_test/system b/pkg/sql/logictest/testdata/logic_test/system index 7d9da72541c8..a1355bacab53 100644 --- a/pkg/sql/logictest/testdata/logic_test/system +++ b/pkg/sql/logictest/testdata/logic_test/system @@ -37,6 +37,7 @@ public statement_diagnostics table NULL 0 NULL public statement_diagnostics_requests table NULL 0 NULL public statement_statistics table NULL 0 NULL public table_statistics table NULL 0 NULL +public tenant_usage table NULL 0 NULL public tenants table NULL 0 NULL public transaction_statistics table NULL 0 NULL public ui table NULL 0 NULL @@ -81,6 +82,7 @@ SELECT id FROM system.descriptor 42 43 44 +45 50 51 52 @@ -440,6 +442,16 @@ system public table_statistics root GRANT system public table_statistics root INSERT system public table_statistics root SELECT system public table_statistics root UPDATE +system public tenant_usage admin DELETE +system public tenant_usage admin GRANT +system public tenant_usage admin INSERT +system public tenant_usage admin SELECT +system public tenant_usage admin UPDATE +system public tenant_usage root DELETE +system public tenant_usage root GRANT +system public tenant_usage root INSERT +system public tenant_usage root SELECT +system public tenant_usage root UPDATE system public tenants admin GRANT system public tenants admin SELECT system public tenants root GRANT diff --git a/pkg/sql/logictest/testdata/logic_test/system_namespace b/pkg/sql/logictest/testdata/logic_test/system_namespace index 8ce993eb61fc..76904b2027d9 100644 --- a/pkg/sql/logictest/testdata/logic_test/system_namespace +++ b/pkg/sql/logictest/testdata/logic_test/system_namespace @@ -39,6 +39,7 @@ SELECT * FROM system.namespace 1 29 statement_diagnostics_requests 35 1 29 statement_statistics 42 1 29 table_statistics 20 +1 29 tenant_usage 45 1 29 tenants 8 1 29 transaction_statistics 43 1 29 ui 14 diff --git a/pkg/sql/opt/exec/execbuilder/testdata/autocommit_nonmetamorphic b/pkg/sql/opt/exec/execbuilder/testdata/autocommit_nonmetamorphic index 07bde0f6aa75..804fe1208e83 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/autocommit_nonmetamorphic +++ b/pkg/sql/opt/exec/execbuilder/testdata/autocommit_nonmetamorphic @@ -41,7 +41,7 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%PushTxn%' AND message NOT LIKE '%QueryTxn%' ---- -dist sender send r40: sending batch 1 CPut, 1 EndTxn to (n1,s1):1 +dist sender send r41: sending batch 1 CPut, 1 EndTxn to (n1,s1):1 # Multi-row insert should auto-commit. query B @@ -62,7 +62,7 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%PushTxn%' AND message NOT LIKE '%QueryTxn%' ---- -dist sender send r40: sending batch 2 CPut, 1 EndTxn to (n1,s1):1 +dist sender send r41: sending batch 2 CPut, 1 EndTxn to (n1,s1):1 # No auto-commit inside a transaction. statement ok @@ -86,7 +86,7 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%PushTxn%' AND message NOT LIKE '%QueryTxn%' ---- -dist sender send r40: sending batch 2 CPut to (n1,s1):1 +dist sender send r41: sending batch 2 CPut to (n1,s1):1 statement ok ROLLBACK @@ -110,7 +110,7 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%PushTxn%' AND message NOT LIKE '%QueryTxn%' ---- -dist sender send r40: sending batch 2 CPut, 1 EndTxn to (n1,s1):1 +dist sender send r41: sending batch 2 CPut, 1 EndTxn to (n1,s1):1 # TODO(radu): allow non-side-effecting projections. query B @@ -132,8 +132,8 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%QueryTxn%' AND operation NOT LIKE '%async%' ---- -dist sender send r40: sending batch 2 CPut to (n1,s1):1 -dist sender send r40: sending batch 1 EndTxn to (n1,s1):1 +dist sender send r41: sending batch 2 CPut to (n1,s1):1 +dist sender send r41: sending batch 1 EndTxn to (n1,s1):1 # Insert with RETURNING statement with side-effects should not auto-commit. # In this case division can (in principle) error out. @@ -156,8 +156,8 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%QueryTxn%' AND operation NOT LIKE '%async%' ---- -dist sender send r40: sending batch 2 CPut to (n1,s1):1 -dist sender send r40: sending batch 1 EndTxn to (n1,s1):1 +dist sender send r41: sending batch 2 CPut to (n1,s1):1 +dist sender send r41: sending batch 1 EndTxn to (n1,s1):1 # Another way to test the scenario above: generate an error and ensure that the # mutation was not committed. @@ -192,7 +192,7 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%PushTxn%' AND message NOT LIKE '%QueryTxn%' ---- -dist sender send r40: sending batch 1 Put, 1 EndTxn to (n1,s1):1 +dist sender send r41: sending batch 1 Put, 1 EndTxn to (n1,s1):1 # Multi-row upsert should auto-commit. query B @@ -213,7 +213,7 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%PushTxn%' AND message NOT LIKE '%QueryTxn%' ---- -dist sender send r40: sending batch 2 Put, 1 EndTxn to (n1,s1):1 +dist sender send r41: sending batch 2 Put, 1 EndTxn to (n1,s1):1 # No auto-commit inside a transaction. statement ok @@ -237,7 +237,7 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%PushTxn%' AND message NOT LIKE '%QueryTxn%' ---- -dist sender send r40: sending batch 2 Put to (n1,s1):1 +dist sender send r41: sending batch 2 Put to (n1,s1):1 statement ok ROLLBACK @@ -261,7 +261,7 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%PushTxn%' AND message NOT LIKE '%QueryTxn%' ---- -dist sender send r40: sending batch 2 Put, 1 EndTxn to (n1,s1):1 +dist sender send r41: sending batch 2 Put, 1 EndTxn to (n1,s1):1 # TODO(radu): allow non-side-effecting projections. query B @@ -283,8 +283,8 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%QueryTxn%' AND operation NOT LIKE '%async%' ---- -dist sender send r40: sending batch 2 Put to (n1,s1):1 -dist sender send r40: sending batch 1 EndTxn to (n1,s1):1 +dist sender send r41: sending batch 2 Put to (n1,s1):1 +dist sender send r41: sending batch 1 EndTxn to (n1,s1):1 # Upsert with RETURNING statement with side-effects should not auto-commit. # In this case division can (in principle) error out. @@ -307,8 +307,8 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%QueryTxn%' AND operation NOT LIKE '%async%' ---- -dist sender send r40: sending batch 2 Put to (n1,s1):1 -dist sender send r40: sending batch 1 EndTxn to (n1,s1):1 +dist sender send r41: sending batch 2 Put to (n1,s1):1 +dist sender send r41: sending batch 1 EndTxn to (n1,s1):1 # Another way to test the scenario above: generate an error and ensure that the # mutation was not committed. @@ -343,8 +343,8 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%PushTxn%' AND message NOT LIKE '%QueryTxn%' ---- -dist sender send r40: sending batch 1 Scan to (n1,s1):1 -dist sender send r40: sending batch 2 Put, 1 EndTxn to (n1,s1):1 +dist sender send r41: sending batch 1 Scan to (n1,s1):1 +dist sender send r41: sending batch 2 Put, 1 EndTxn to (n1,s1):1 # No auto-commit inside a transaction. statement ok @@ -368,8 +368,8 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%PushTxn%' AND message NOT LIKE '%QueryTxn%' ---- -dist sender send r40: sending batch 1 Scan to (n1,s1):1 -dist sender send r40: sending batch 2 Put to (n1,s1):1 +dist sender send r41: sending batch 1 Scan to (n1,s1):1 +dist sender send r41: sending batch 2 Put to (n1,s1):1 statement ok ROLLBACK @@ -393,8 +393,8 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%PushTxn%' AND message NOT LIKE '%QueryTxn%' ---- -dist sender send r40: sending batch 1 Scan to (n1,s1):1 -dist sender send r40: sending batch 2 Put, 1 EndTxn to (n1,s1):1 +dist sender send r41: sending batch 1 Scan to (n1,s1):1 +dist sender send r41: sending batch 2 Put, 1 EndTxn to (n1,s1):1 # TODO(radu): allow non-side-effecting projections. query B @@ -416,9 +416,9 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%QueryTxn%' AND operation NOT LIKE '%async%' ---- -dist sender send r40: sending batch 1 Scan to (n1,s1):1 -dist sender send r40: sending batch 2 Put to (n1,s1):1 -dist sender send r40: sending batch 1 EndTxn to (n1,s1):1 +dist sender send r41: sending batch 1 Scan to (n1,s1):1 +dist sender send r41: sending batch 2 Put to (n1,s1):1 +dist sender send r41: sending batch 1 EndTxn to (n1,s1):1 # Update with RETURNING statement with side-effects should not auto-commit. # In this case division can (in principle) error out. @@ -441,9 +441,9 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%QueryTxn%' AND operation NOT LIKE '%async%' ---- -dist sender send r40: sending batch 1 Scan to (n1,s1):1 -dist sender send r40: sending batch 2 Put to (n1,s1):1 -dist sender send r40: sending batch 1 EndTxn to (n1,s1):1 +dist sender send r41: sending batch 1 Scan to (n1,s1):1 +dist sender send r41: sending batch 2 Put to (n1,s1):1 +dist sender send r41: sending batch 1 EndTxn to (n1,s1):1 # Another way to test the scenario above: generate an error and ensure that the # mutation was not committed. @@ -478,7 +478,7 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%PushTxn%' AND message NOT LIKE '%QueryTxn%' ---- -dist sender send r40: sending batch 1 DelRng, 1 EndTxn to (n1,s1):1 +dist sender send r41: sending batch 1 DelRng, 1 EndTxn to (n1,s1):1 # Multi-row delete should auto-commit. query B @@ -499,7 +499,7 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%PushTxn%' AND message NOT LIKE '%QueryTxn%' ---- -dist sender send r40: sending batch 1 DelRng, 1 EndTxn to (n1,s1):1 +dist sender send r41: sending batch 1 DelRng, 1 EndTxn to (n1,s1):1 # No auto-commit inside a transaction. statement ok @@ -523,7 +523,7 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%PushTxn%' AND message NOT LIKE '%QueryTxn%' ---- -dist sender send r40: sending batch 1 DelRng to (n1,s1):1 +dist sender send r41: sending batch 1 DelRng to (n1,s1):1 statement ok ROLLBACK @@ -547,8 +547,8 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%PushTxn%' AND message NOT LIKE '%QueryTxn%' ---- -dist sender send r40: sending batch 1 Scan to (n1,s1):1 -dist sender send r40: sending batch 2 Del, 1 EndTxn to (n1,s1):1 +dist sender send r41: sending batch 1 Scan to (n1,s1):1 +dist sender send r41: sending batch 2 Del, 1 EndTxn to (n1,s1):1 # TODO(radu): allow non-side-effecting projections. query B @@ -570,9 +570,9 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%QueryTxn%' AND operation NOT LIKE '%async%' ---- -dist sender send r40: sending batch 1 Scan to (n1,s1):1 -dist sender send r40: sending batch 2 Del to (n1,s1):1 -dist sender send r40: sending batch 1 EndTxn to (n1,s1):1 +dist sender send r41: sending batch 1 Scan to (n1,s1):1 +dist sender send r41: sending batch 2 Del to (n1,s1):1 +dist sender send r41: sending batch 1 EndTxn to (n1,s1):1 # Insert with RETURNING statement with side-effects should not auto-commit. # In this case division can (in principle) error out. @@ -595,9 +595,9 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%QueryTxn%' AND operation NOT LIKE '%async%' ---- -dist sender send r40: sending batch 1 Scan to (n1,s1):1 -dist sender send r40: sending batch 2 Del to (n1,s1):1 -dist sender send r40: sending batch 1 EndTxn to (n1,s1):1 +dist sender send r41: sending batch 1 Scan to (n1,s1):1 +dist sender send r41: sending batch 2 Del to (n1,s1):1 +dist sender send r41: sending batch 1 EndTxn to (n1,s1):1 statement ok INSERT INTO ab VALUES (12, 0); @@ -644,9 +644,9 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%QueryTxn%' AND operation NOT LIKE '%async%' ---- -dist sender send r40: sending batch 2 CPut to (n1,s1):1 -dist sender send r40: sending batch 2 Get to (n1,s1):1 -dist sender send r40: sending batch 1 EndTxn to (n1,s1):1 +dist sender send r41: sending batch 2 CPut to (n1,s1):1 +dist sender send r41: sending batch 2 Get to (n1,s1):1 +dist sender send r41: sending batch 1 EndTxn to (n1,s1):1 query B SELECT count(*) > 0 FROM [ @@ -667,10 +667,10 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%QueryTxn%' AND operation NOT LIKE '%async%' ---- -dist sender send r40: sending batch 1 Scan to (n1,s1):1 -dist sender send r40: sending batch 1 Put to (n1,s1):1 -dist sender send r40: sending batch 1 Scan to (n1,s1):1 -dist sender send r40: sending batch 1 EndTxn to (n1,s1):1 +dist sender send r41: sending batch 1 Scan to (n1,s1):1 +dist sender send r41: sending batch 1 Put to (n1,s1):1 +dist sender send r41: sending batch 1 Scan to (n1,s1):1 +dist sender send r41: sending batch 1 EndTxn to (n1,s1):1 query B SELECT count(*) > 0 FROM [ @@ -692,10 +692,10 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%QueryTxn%' AND operation NOT LIKE '%async%' ---- -dist sender send r40: sending batch 1 Get to (n1,s1):1 -dist sender send r40: sending batch 1 Del to (n1,s1):1 -dist sender send r40: sending batch 1 Scan to (n1,s1):1 -dist sender send r40: sending batch 1 EndTxn to (n1,s1):1 +dist sender send r41: sending batch 1 Get to (n1,s1):1 +dist sender send r41: sending batch 1 Del to (n1,s1):1 +dist sender send r41: sending batch 1 Scan to (n1,s1):1 +dist sender send r41: sending batch 1 EndTxn to (n1,s1):1 # Test with a single cascade, which should use autocommit. statement ok @@ -719,9 +719,9 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%QueryTxn%' AND operation NOT LIKE '%async%' ---- -dist sender send r40: sending batch 1 DelRng to (n1,s1):1 -dist sender send r40: sending batch 1 Scan to (n1,s1):1 -dist sender send r40: sending batch 1 Del, 1 EndTxn to (n1,s1):1 +dist sender send r41: sending batch 1 DelRng to (n1,s1):1 +dist sender send r41: sending batch 1 Scan to (n1,s1):1 +dist sender send r41: sending batch 1 Del, 1 EndTxn to (n1,s1):1 # ----------------------- # Multiple mutation tests @@ -749,9 +749,9 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%QueryTxn%' AND operation NOT LIKE '%async%' ---- -dist sender send r40: sending batch 2 CPut to (n1,s1):1 -dist sender send r40: sending batch 2 CPut to (n1,s1):1 -dist sender send r40: sending batch 1 EndTxn to (n1,s1):1 +dist sender send r41: sending batch 2 CPut to (n1,s1):1 +dist sender send r41: sending batch 2 CPut to (n1,s1):1 +dist sender send r41: sending batch 1 EndTxn to (n1,s1):1 query B SELECT count(*) > 0 FROM [ @@ -774,6 +774,6 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%QueryTxn%' AND operation NOT LIKE '%async%' ---- -dist sender send r40: sending batch 2 CPut to (n1,s1):1 -dist sender send r40: sending batch 2 CPut to (n1,s1):1 -dist sender send r40: sending batch 1 EndTxn to (n1,s1):1 +dist sender send r41: sending batch 2 CPut to (n1,s1):1 +dist sender send r41: sending batch 2 CPut to (n1,s1):1 +dist sender send r41: sending batch 1 EndTxn to (n1,s1):1 diff --git a/pkg/sql/opt/exec/execbuilder/testdata/delete b/pkg/sql/opt/exec/execbuilder/testdata/delete index ba9c146cea33..8a13ad74d631 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/delete +++ b/pkg/sql/opt/exec/execbuilder/testdata/delete @@ -231,9 +231,9 @@ SELECT operation, message FROM [SHOW KV TRACE FOR SESSION] WHERE message LIKE '%DelRange%' OR message LIKE '%DelRng%' ---- batch flow coordinator DelRange /Table/57/1 - /Table/57/2 -dist sender send r40: sending batch 1 DelRng to (n1,s1):1 +dist sender send r41: sending batch 1 DelRng to (n1,s1):1 batch flow coordinator DelRange /Table/57/1/601/0 - /Table/57/2 -dist sender send r40: sending batch 1 DelRng to (n1,s1):1 +dist sender send r41: sending batch 1 DelRng to (n1,s1):1 # Ensure that DelRange requests are autocommitted when DELETE FROM happens on a # chunk of fewer than 600 keys. @@ -249,7 +249,7 @@ SELECT operation, message FROM [SHOW KV TRACE FOR SESSION] WHERE message LIKE '%DelRange%' OR message LIKE '%sending batch%' ---- batch flow coordinator DelRange /Table/57/1/5 - /Table/57/1/5/# -dist sender send r40: sending batch 1 DelRng, 1 EndTxn to (n1,s1):1 +dist sender send r41: sending batch 1 DelRng, 1 EndTxn to (n1,s1):1 # Test use of fast path when there are interleaved tables. diff --git a/pkg/sql/opt/exec/execbuilder/testdata/show_trace_nonmetamorphic b/pkg/sql/opt/exec/execbuilder/testdata/show_trace_nonmetamorphic index 5d4ff63fa2d8..ec0a1460a750 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/show_trace_nonmetamorphic +++ b/pkg/sql/opt/exec/execbuilder/testdata/show_trace_nonmetamorphic @@ -238,7 +238,7 @@ SET tracing = on; INSERT INTO t.kv3 (k, v) VALUES (1,1); SET tracing = off query T SELECT message FROM [SHOW TRACE FOR SESSION] WHERE message LIKE e'%1 CPut, 1 EndTxn%' AND message NOT LIKE e'%proposing command%' ---- -r41: sending batch 1 CPut, 1 EndTxn to (n1,s1):1 +r42: sending batch 1 CPut, 1 EndTxn to (n1,s1):1 node received request: 1 CPut, 1 EndTxn # Check that we can run set tracing regardless of the current tracing state. @@ -314,9 +314,9 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%PushTxn%' AND message NOT LIKE '%QueryTxn%' ---- -dist sender send r41: sending batch 1 CPut to (n1,s1):1 -dist sender send r41: sending batch 1 EndTxn to (n1,s1):1 -dist sender send r41: sending batch 2 CPut, 1 EndTxn to (n1,s1):1 +dist sender send r42: sending batch 1 CPut to (n1,s1):1 +dist sender send r42: sending batch 1 EndTxn to (n1,s1):1 +dist sender send r42: sending batch 2 CPut, 1 EndTxn to (n1,s1):1 # Make another session trace. statement ok @@ -345,9 +345,9 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%PushTxn%' AND message NOT LIKE '%QueryTxn%' ---- -dist sender send r41: sending batch 4 CPut, 1 EndTxn to (n1,s1):1 -dist sender send r41: sending batch 5 CPut to (n1,s1):1 -dist sender send r41: sending batch 1 EndTxn to (n1,s1):1 +dist sender send r42: sending batch 4 CPut, 1 EndTxn to (n1,s1):1 +dist sender send r42: sending batch 5 CPut to (n1,s1):1 +dist sender send r42: sending batch 1 EndTxn to (n1,s1):1 # make a table with some big strings in it. statement ok @@ -366,8 +366,8 @@ WHERE message LIKE '%r$rangeid: sending batch%' AND message NOT LIKE '%PushTxn%' AND message NOT LIKE '%QueryTxn%' ---- -dist sender send r41: sending batch 6 CPut to (n1,s1):1 -dist sender send r41: sending batch 6 CPut to (n1,s1):1 -dist sender send r41: sending batch 6 CPut to (n1,s1):1 -dist sender send r41: sending batch 6 CPut to (n1,s1):1 -dist sender send r41: sending batch 1 EndTxn to (n1,s1):1 +dist sender send r42: sending batch 6 CPut to (n1,s1):1 +dist sender send r42: sending batch 6 CPut to (n1,s1):1 +dist sender send r42: sending batch 6 CPut to (n1,s1):1 +dist sender send r42: sending batch 6 CPut to (n1,s1):1 +dist sender send r42: sending batch 1 EndTxn to (n1,s1):1 diff --git a/pkg/sql/pgwire/pgwire_test.go b/pkg/sql/pgwire/pgwire_test.go index 6208c10fe5ea..662a7c6ab8b2 100644 --- a/pkg/sql/pgwire/pgwire_test.go +++ b/pkg/sql/pgwire/pgwire_test.go @@ -561,7 +561,7 @@ func TestPGPreparedQuery(t *testing.T) { Results("users", "primary", false, 3, "isRole", "N/A", true, false), }}, {"SHOW TABLES FROM system", []preparedQueryTest{ - baseTest.Results("public", "comments", "table", gosql.NullString{}, 0, gosql.NullString{}).Others(32), + baseTest.Results("public", "comments", "table", gosql.NullString{}, 0, gosql.NullString{}).Others(33), }}, {"SHOW SCHEMAS FROM system", []preparedQueryTest{ baseTest.Results("crdb_internal", gosql.NullString{}).Others(4), diff --git a/pkg/sql/tests/system_table_test.go b/pkg/sql/tests/system_table_test.go index 424280af097e..03652c947e68 100644 --- a/pkg/sql/tests/system_table_test.go +++ b/pkg/sql/tests/system_table_test.go @@ -195,6 +195,7 @@ func TestSystemTableLiterals(t *testing.T) { {keys.StatementStatisticsTableID, systemschema.StatementStatisticsTableSchema, systemschema.StatementStatisticsTable}, {keys.TransactionStatisticsTableID, systemschema.TransactionStatisticsTableSchema, systemschema.TransactionStatisticsTable}, {keys.DatabaseRoleSettingsTableID, systemschema.DatabaseRoleSettingsTableSchema, systemschema.DatabaseRoleSettingsTable}, + {keys.TenantUsageTableID, systemschema.TenantUsageTableSchema, systemschema.TenantUsageTable}, } { privs := *test.pkg.GetPrivileges() gen, err := sql.CreateTestTableDescriptor( diff --git a/pkg/sql/tests/testdata/initial_keys b/pkg/sql/tests/testdata/initial_keys index 854db955ff30..cbdac67df188 100644 --- a/pkg/sql/tests/testdata/initial_keys +++ b/pkg/sql/tests/testdata/initial_keys @@ -1,6 +1,6 @@ initial-keys tenant=system ---- -77 keys: +79 keys: /System/"desc-idgen" /Table/3/1/1/2/1 /Table/3/1/3/2/1 @@ -36,6 +36,7 @@ initial-keys tenant=system /Table/3/1/42/2/1 /Table/3/1/43/2/1 /Table/3/1/44/2/1 + /Table/3/1/45/2/1 /Table/5/1/0/2/1 /Table/5/1/1/2/1 /Table/5/1/16/2/1 @@ -72,13 +73,14 @@ initial-keys tenant=system /NamespaceTable/30/1/1/29/"statement_diagnostics_requests"/4/1 /NamespaceTable/30/1/1/29/"statement_statistics"/4/1 /NamespaceTable/30/1/1/29/"table_statistics"/4/1 + /NamespaceTable/30/1/1/29/"tenant_usage"/4/1 /NamespaceTable/30/1/1/29/"tenants"/4/1 /NamespaceTable/30/1/1/29/"transaction_statistics"/4/1 /NamespaceTable/30/1/1/29/"ui"/4/1 /NamespaceTable/30/1/1/29/"users"/4/1 /NamespaceTable/30/1/1/29/"web_sessions"/4/1 /NamespaceTable/30/1/1/29/"zones"/4/1 -34 splits: +35 splits: /Table/11 /Table/12 /Table/13 @@ -113,6 +115,7 @@ initial-keys tenant=system /Table/42 /Table/43 /Table/44 + /Table/45 initial-keys tenant=5 ----