Skip to content

Commit

Permalink
settings: introduce system.tenant_settings table
Browse files Browse the repository at this point in the history
Release note: None
  • Loading branch information
RaduBerinde authored and ajwerner committed Feb 9, 2022
1 parent 90629ae commit d7e7865
Show file tree
Hide file tree
Showing 44 changed files with 370 additions and 110 deletions.
2 changes: 1 addition & 1 deletion docs/generated/settings/settings-for-tenants.txt
Original file line number Diff line number Diff line change
Expand Up @@ -174,4 +174,4 @@ trace.debug.enable boolean false if set, traces for recent requests can be seen
trace.jaeger.agent string the address of a Jaeger agent to receive traces using the Jaeger UDP Thrift protocol, as <host>:<port>. If no port is specified, 6381 will be used.
trace.opentelemetry.collector string address of an OpenTelemetry trace collector to receive traces using the otel gRPC protocol, as <host>:<port>. If no port is specified, 4317 will be used.
trace.zipkin.collector string the address of a Zipkin instance to receive traces, as <host>:<port>. If no port is specified, 9411 will be used.
version version 21.2-60 set the active cluster version in the format '<major>.<minor>'
version version 21.2-62 set the active cluster version in the format '<major>.<minor>'
2 changes: 1 addition & 1 deletion docs/generated/settings/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,6 @@
<tr><td><code>trace.jaeger.agent</code></td><td>string</td><td><code></code></td><td>the address of a Jaeger agent to receive traces using the Jaeger UDP Thrift protocol, as <host>:<port>. If no port is specified, 6381 will be used.</td></tr>
<tr><td><code>trace.opentelemetry.collector</code></td><td>string</td><td><code></code></td><td>address of an OpenTelemetry trace collector to receive traces using the otel gRPC protocol, as <host>:<port>. If no port is specified, 4317 will be used.</td></tr>
<tr><td><code>trace.zipkin.collector</code></td><td>string</td><td><code></code></td><td>the address of a Zipkin instance to receive traces, as <host>:<port>. If no port is specified, 9411 will be used.</td></tr>
<tr><td><code>version</code></td><td>version</td><td><code>21.2-60</code></td><td>set the active cluster version in the format '<major>.<minor>'</td></tr>
<tr><td><code>version</code></td><td>version</td><td><code>21.2-62</code></td><td>set the active cluster version in the format '<major>.<minor>'</td></tr>
</tbody>
</table>
3 changes: 3 additions & 0 deletions pkg/ccl/backupccl/system_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,9 @@ var systemTableBackupConfiguration = map[string]systemBackupConfiguration{
systemschema.SpanConfigurationsTable.GetName(): {
shouldIncludeInClusterBackup: optOutOfClusterBackup,
},
systemschema.TenantSettingsTable.GetName(): {
shouldIncludeInClusterBackup: optOutOfClusterBackup,
},
}

// GetSystemTablesToIncludeInClusterBackup returns a set of system table names that
Expand Down
9 changes: 9 additions & 0 deletions pkg/ccl/spanconfigccl/spanconfigcomparedccl/testdata/basic
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ configs version=current offset=41
...
/Table/46 database system (host)
/Table/47 database system (host)
/Table/50 database system (host)
/Table/106 num_replicas=7 num_voters=5
/Table/107 num_replicas=7

Expand All @@ -56,6 +57,7 @@ configs version=legacy offset=41
...
/Table/46 database system (host)
/Table/47 database system (host)
/Table/50 range system
/Table/106 num_replicas=7 num_voters=5
/Table/107 num_replicas=7

Expand Down Expand Up @@ -110,5 +112,12 @@ diff
+/Table/38 range system
/Table/39 database system (host)
/Table/40 database system (host)
@@ -42,5 +42,5 @@
/Table/46 database system (host)
/Table/47 database system (host)
-/Table/50 range system
+/Table/50 database system (host)
/Table/106 num_replicas=7 num_voters=5
/Table/107 num_replicas=7

# vim:ft=diff
12 changes: 9 additions & 3 deletions pkg/ccl/spanconfigccl/spanconfigcomparedccl/testdata/multitenant
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ initialize tenant=11
configs version=current offset=43
----
...
/Table/50 database system (host)
/Tenant/10 range default
/Tenant/11 range default

Expand All @@ -26,6 +27,8 @@ diff offset=50
--- gossiped system config span (legacy)
+++ span config infrastructure (current)
...
+/Tenant/10 range default
+/Tenant/11 range default

reconcile tenant=11
----
Expand All @@ -36,16 +39,17 @@ reconcile tenant=11
configs version=current offset=43 limit=5
----
...
/Table/50 database system (host)
/Tenant/10 range default
/Tenant/11 database system (tenant)
/Tenant/11/Table/4 database system (tenant)
/Tenant/11/Table/5 database system (tenant)
/Tenant/11/Table/6 database system (tenant)
...

configs version=legacy offset=43
----
...
/Table/50 range system
/Tenant/10 database system (tenant)
/Tenant/11 database system (tenant)

Expand All @@ -54,6 +58,8 @@ diff offset=48 limit=10
--- gossiped system config span (legacy)
+++ span config infrastructure (current)
...
+/Table/50 database system (host)
+/Tenant/10 range default
/Tenant/11 database system (tenant)
+/Tenant/11/Table/4 database system (tenant)
+/Tenant/11/Table/5 database system (tenant)
Expand All @@ -62,8 +68,6 @@ diff offset=48 limit=10
+/Tenant/11/Table/11 database system (tenant)
+/Tenant/11/Table/12 database system (tenant)
+/Tenant/11/Table/13 database system (tenant)
+/Tenant/11/Table/14 database system (tenant)
+/Tenant/11/Table/15 database system (tenant)
...

# Sanity check that new tenant tables show up correctly.
Expand All @@ -80,6 +84,8 @@ diff offset=48
--- gossiped system config span (legacy)
+++ span config infrastructure (current)
...
+/Table/50 database system (host)
+/Tenant/10 range default
/Tenant/11 database system (tenant)
+/Tenant/11/Table/4 database system (tenant)
+/Tenant/11/Table/5 database system (tenant)
Expand Down
4 changes: 4 additions & 0 deletions pkg/ccl/spanconfigccl/spanconfigreconcilerccl/testdata/basic
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ upsert /Table/4{4-5} database system (host)
upsert /Table/4{5-6} ttl_seconds=7200 ignore_strict_gc=true num_replicas=5 rangefeed_enabled=true
upsert /Table/4{6-7} database system (host)
upsert /Table/4{7-8} database system (host)
upsert /Table/5{0-1} database system (host)

exec-sql
CREATE DATABASE db;
Expand Down Expand Up @@ -83,6 +84,7 @@ upsert /Table/10{7-8} num_replicas=7
state offset=47
----
...
/Table/5{0-1} database system (host)
/Table/10{6-7} num_replicas=7 num_voters=5
/Table/10{7-8} num_replicas=7

Expand Down Expand Up @@ -170,6 +172,8 @@ delete /Table/4{6-7}
upsert /Table/4{6-7} ttl_seconds=100 ignore_strict_gc=true num_replicas=5 rangefeed_enabled=true
delete /Table/4{7-8}
upsert /Table/4{7-8} ttl_seconds=100 ignore_strict_gc=true num_replicas=5 rangefeed_enabled=true
delete /Table/5{0-1}
upsert /Table/5{0-1} ttl_seconds=100 ignore_strict_gc=true num_replicas=5 rangefeed_enabled=true

state offset=5 limit=42
----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ upsert /Table/10{6-7} range default
state offset=47
----
...
/Table/5{0-1} database system (host)
/Table/10{6-7} range default

exec-sql
Expand All @@ -42,6 +43,7 @@ upsert /Table/10{6/3-7} num_replicas=7
state offset=47
----
...
/Table/5{0-1} database system (host)
/Table/106{-/2} num_replicas=7
/Table/106/{2-3} num_replicas=7 num_voters=5
/Table/10{6/3-7} num_replicas=7
Expand All @@ -65,6 +67,7 @@ upsert /Table/10{6/3-7} ttl_seconds=3600 num_replicas=7
state offset=47
----
...
/Table/5{0-1} database system (host)
/Table/106{-/2} ttl_seconds=3600 num_replicas=7
/Table/106/{2-3} ttl_seconds=25 num_replicas=7 num_voters=5
/Table/10{6/3-7} ttl_seconds=3600 num_replicas=7
Expand All @@ -78,6 +81,7 @@ ALTER TABLE db.t CONFIGURE ZONE USING num_replicas = 9
state offset=47
----
...
/Table/5{0-1} database system (host)
/Table/106{-/2} ttl_seconds=3600 num_replicas=9
/Table/106/{2-3} ttl_seconds=25 num_replicas=9 num_voters=5
/Table/10{6/3-7} ttl_seconds=3600 num_replicas=9
Expand Down Expand Up @@ -105,3 +109,4 @@ state offset=46
----
...
/Table/4{7-8} database system (host)
/Table/5{0-1} database system (host)
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ mutations
state offset=47
----
...
/Table/5{0-1} database system (host)
/Tenant/10{-"\x00"} range default
/Tenant/11{-"\x00"} range default

Expand Down Expand Up @@ -70,6 +71,7 @@ upsert /Tenant/10/Table/4{6-7} database system (tenant)
state offset=47
----
...
/Table/5{0-1} database system (host)
/Tenant/10{-/Table/4} database system (tenant)
/Tenant/10/Table/{4-5} database system (tenant)
/Tenant/10/Table/{5-6} database system (tenant)
Expand Down Expand Up @@ -120,6 +122,7 @@ upsert /Tenant/10/Table/10{7-8} range default
state offset=81
----
...
/Tenant/10/Table/4{6-7} database system (tenant)
/Tenant/10/Table/10{6-7} range default
/Tenant/10/Table/10{7-8} range default
/Tenant/11{-"\x00"} range default
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ state offset=46
----
...
/Table/4{7-8} database system (host)
/Table/5{0-1} database system (host)
/Table/10{6-7} ttl_seconds=50

# Make sure future descendants observe the same.
Expand All @@ -139,6 +140,7 @@ state offset=46
----
...
/Table/4{7-8} database system (host)
/Table/5{0-1} database system (host)
/Table/10{6-7} ttl_seconds=50
/Table/10{7-8} ttl_seconds=50

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ mutations discard
state offset=47
----
...
/Table/5{0-1} database system (host)

exec-sql
CREATE DATABASE db;
Expand All @@ -32,6 +33,7 @@ upsert /Table/10{6-7} range default
state offset=47
----
...
/Table/5{0-1} database system (host)
/Table/10{6-7} range default

# All parent schema zone config changes cascade to the entire table's span.
Expand All @@ -48,6 +50,7 @@ upsert /Table/10{6-7} num_replicas=7 num_voters=5
state offset=47
----
...
/Table/5{0-1} database system (host)
/Table/10{6-7} num_replicas=7 num_voters=5

# Apply a zone configuration on one of the partitions, `one_two`, which
Expand All @@ -69,6 +72,7 @@ upsert /Table/10{6/1/3-7} num_replicas=7 num_voters=5
state offset=47
----
...
/Table/5{0-1} database system (host)
/Table/106{-/1/1} num_replicas=7 num_voters=5
/Table/106/1/{1-2} global_reads=true num_replicas=7 num_voters=5
/Table/106/1/{2-3} global_reads=true num_replicas=7 num_voters=5
Expand All @@ -90,6 +94,7 @@ upsert /Table/10{6/1/5-7} num_replicas=7 num_voters=5
state offset=47
----
...
/Table/5{0-1} database system (host)
/Table/106{-/1/1} num_replicas=7 num_voters=5
/Table/106/1/{1-2} global_reads=true num_replicas=7 num_voters=5
/Table/106/1/{2-3} global_reads=true num_replicas=7 num_voters=5
Expand Down Expand Up @@ -125,6 +130,7 @@ upsert /Table/10{6/2-7} num_replicas=7 num_voters=5
state offset=47
----
...
/Table/5{0-1} database system (host)
/Table/106{-/1} num_replicas=7 num_voters=5
/Table/106/1{-/1} num_replicas=7 num_voters=6
/Table/106/1/{1-2} global_reads=true num_replicas=7 num_voters=5
Expand Down Expand Up @@ -158,6 +164,7 @@ upsert /Table/10{6/2-7} num_replicas=7
state offset=47
----
...
/Table/5{0-1} database system (host)
/Table/106{-/1} num_replicas=7
/Table/106/1{-/1} num_replicas=7 num_voters=6
/Table/106/1/{1-2} global_reads=true num_replicas=7
Expand Down Expand Up @@ -185,3 +192,4 @@ delete /Table/10{6/2-7}
state offset=47
----
...
/Table/5{0-1} database system (host)
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,5 @@ full-translate
/Table/4{5-6} ttl_seconds=7200 ignore_strict_gc=true num_replicas=5 rangefeed_enabled=true
/Table/4{6-7} database system (host)
/Table/4{7-8} database system (host)
/Table/5{0-1} database system (host)
/Table/109{-/PrefixEnd} range default
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,4 @@ full-translate
/Table/4{5-6} ttl_seconds=7200 ignore_strict_gc=true num_replicas=5 rangefeed_enabled=true
/Table/4{6-7} database system (host)
/Table/4{7-8} database system (host)
/Table/5{0-1} database system (host)
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ translate database=system
/Table/4{5-6} ttl_seconds=7200 ignore_strict_gc=true num_replicas=5 rangefeed_enabled=true
/Table/4{6-7} database system (host)
/Table/4{7-8} database system (host)
/Table/5{0-1} database system (host)

# Alter zone config fields on the database to ensure the effects cascade.
exec-sql
Expand Down Expand Up @@ -96,6 +97,7 @@ translate database=system
/Table/4{5-6} ttl_seconds=7200 ignore_strict_gc=true num_replicas=7 rangefeed_enabled=true
/Table/4{6-7} ignore_strict_gc=true num_replicas=7 rangefeed_enabled=true
/Table/4{7-8} ignore_strict_gc=true num_replicas=7 rangefeed_enabled=true
/Table/5{0-1} ignore_strict_gc=true num_replicas=7 rangefeed_enabled=true

# Alter a named range that maps to a pseudo table ID, ensuring that its effects
# are independent.
Expand Down Expand Up @@ -152,3 +154,4 @@ full-translate
/Table/4{5-6} ttl_seconds=7200 ignore_strict_gc=true num_replicas=7 rangefeed_enabled=true
/Table/4{6-7} ignore_strict_gc=true num_replicas=7 rangefeed_enabled=true
/Table/4{7-8} ignore_strict_gc=true num_replicas=7 rangefeed_enabled=true
/Table/5{0-1} ignore_strict_gc=true num_replicas=7 rangefeed_enabled=true
2 changes: 1 addition & 1 deletion pkg/cli/testdata/doctor/test_examine_cluster
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
debug doctor examine cluster
----
debug doctor examine cluster
Examining 43 descriptors and 42 namespace entries...
Examining 44 descriptors and 43 namespace entries...
ParentID 100, ParentSchemaID 101: relation "foo" (105): expected matching namespace entry, found none
Examining 4 jobs...
ERROR: validation failed
6 changes: 4 additions & 2 deletions pkg/cli/testdata/zip/partial1
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,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] 43 ranges found
[node 1] 44 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
Expand Down Expand Up @@ -122,6 +122,7 @@ debug zip --concurrency=1 --cpu-profile-duration=0s /dev/null
[node 1] writing range 41... converting to JSON... writing binary output: debug/nodes/1/ranges/41.json... done
[node 1] writing range 42... converting to JSON... writing binary output: debug/nodes/1/ranges/42.json... done
[node 1] writing range 43... converting to JSON... writing binary output: debug/nodes/1/ranges/43.json... done
[node 1] writing range 44... converting to JSON... writing binary output: debug/nodes/1/ranges/44.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...
Expand Down Expand Up @@ -248,7 +249,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] 43 ranges found
[node 3] 44 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
Expand Down Expand Up @@ -292,5 +293,6 @@ debug zip --concurrency=1 --cpu-profile-duration=0s /dev/null
[node 3] writing range 41... converting to JSON... writing binary output: debug/nodes/3/ranges/41.json... done
[node 3] writing range 42... converting to JSON... writing binary output: debug/nodes/3/ranges/42.json... done
[node 3] writing range 43... converting to JSON... writing binary output: debug/nodes/3/ranges/43.json... done
[node 3] writing range 44... converting to JSON... writing binary output: debug/nodes/3/ranges/44.json... done
[cluster] pprof summary script... writing binary output: debug/pprof-summary.sh... done
[cluster] hot range summary script... writing binary output: debug/hot-ranges.sh... done
Loading

0 comments on commit d7e7865

Please sign in to comment.