From f13f00829ce6975c3ee5af74ceb867e3fc4432d8 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Tue, 6 Jun 2023 22:25:02 +0000 Subject: [PATCH 1/2] settings: track the origin of the current values This adds an API to the settings package to track the origin of the current value of each setting, such as whether it is set by the the default value, an explicit override or an external override. Release note: none. Epic: none. --- pkg/server/settingswatcher/settings_watcher.go | 13 ++++++++----- pkg/settings/common.go | 11 +++++++++++ pkg/settings/setting.go | 17 +++++++++++++++++ pkg/settings/updater.go | 18 ++++++++++++++++++ pkg/settings/values.go | 10 ++++++++++ 5 files changed, 64 insertions(+), 5 deletions(-) diff --git a/pkg/server/settingswatcher/settings_watcher.go b/pkg/server/settingswatcher/settings_watcher.go index 710de8ed03e1..0154c5bd864b 100644 --- a/pkg/server/settingswatcher/settings_watcher.go +++ b/pkg/server/settingswatcher/settings_watcher.go @@ -292,7 +292,7 @@ func (s *SettingsWatcher) maybeSet(ctx context.Context, name string, sv settings } } else { if !hasOverride { - s.setLocked(ctx, name, sv.val) + s.setLocked(ctx, name, sv.val, settings.OriginExplicitlySet) } } } @@ -309,7 +309,9 @@ type settingsValue struct { const versionSettingKey = "version" // set the current value of a setting. -func (s *SettingsWatcher) setLocked(ctx context.Context, key string, val settings.EncodedValue) { +func (s *SettingsWatcher) setLocked( + ctx context.Context, key string, val settings.EncodedValue, origin settings.ValueOrigin, +) { // Both the system tenant and secondary tenants no longer use this code // path to propagate cluster version changes (they rely on // BumpClusterVersion instead). The secondary tenants however, still rely @@ -335,6 +337,7 @@ func (s *SettingsWatcher) setLocked(ctx context.Context, key string, val setting if err := s.mu.updater.Set(ctx, key, val); err != nil { log.Warningf(ctx, "failed to set setting %s to %s: %v", redact.Safe(key), val.Value, err) } + s.mu.updater.SetValueOrigin(ctx, key, origin) } // setDefaultLocked sets a setting to its default value. @@ -348,7 +351,7 @@ func (s *SettingsWatcher) setDefaultLocked(ctx context.Context, key string) { Value: setting.EncodedDefault(), Type: setting.Typ(), } - s.setLocked(ctx, key, val) + s.setLocked(ctx, key, val, settings.OriginDefault) } // updateOverrides updates the overrides map and updates any settings @@ -384,7 +387,7 @@ func (s *SettingsWatcher) updateOverrides(ctx context.Context) { } // A new override was added or an existing override has changed. s.mu.overrides[key] = val - s.setLocked(ctx, key, val) + s.setLocked(ctx, key, val, settings.OriginExternallySet) } // Clean up any overrides that were removed. @@ -395,7 +398,7 @@ func (s *SettingsWatcher) updateOverrides(ctx context.Context) { // Reset the setting to the value in the settings table (or the default // value). if sv, ok := s.mu.values[key]; ok && !sv.tombstone { - s.setLocked(ctx, key, sv.val) + s.setLocked(ctx, key, sv.val, settings.OriginExplicitlySet) } else { s.setDefaultLocked(ctx, key) } diff --git a/pkg/settings/common.go b/pkg/settings/common.go index 24da5a7dead5..a7987626f540 100644 --- a/pkg/settings/common.go +++ b/pkg/settings/common.go @@ -74,6 +74,15 @@ func (c *common) ErrorHint() (bool, string) { return false, "" } +func (c *common) getSlot() slotIdx { + return c.slot +} + +// ValueOrigin returns the origin of the current value of the setting. +func (c *common) ValueOrigin(ctx context.Context, sv *Values) ValueOrigin { + return sv.getValueOrigin(ctx, c.slot) +} + // SetReportable indicates whether a setting's value can show up in SHOW ALL // CLUSTER SETTINGS and telemetry reports. // @@ -114,6 +123,8 @@ type internalSetting interface { isRetired() bool setToDefault(ctx context.Context, sv *Values) + getSlot() slotIdx + // isReportable indicates whether the value of the setting can be // included in user-facing reports such as that produced by SHOW ALL // CLUSTER SETTINGS. diff --git a/pkg/settings/setting.go b/pkg/settings/setting.go index e7ba6112c1d2..72455441c783 100644 --- a/pkg/settings/setting.go +++ b/pkg/settings/setting.go @@ -79,6 +79,9 @@ type NonMaskedSetting interface { // ErrorHint returns a hint message to be displayed to the user when there's // an error. ErrorHint() (bool, string) + + // ValueOrigin returns the origin of the current value. + ValueOrigin(ctx context.Context, sv *Values) ValueOrigin } // Class describes the scope of a setting in multi-tenant scenarios. While all @@ -142,3 +145,17 @@ const ( // In short: "Go ahead but be careful." Public ) + +// ValueOrigin indicates the origin of the current value of a setting, e.g. if +// it is coming from the in-code default or an explicit override. +type ValueOrigin uint32 + +const ( + // OriginDefault indicates the value in use is the default value. + OriginDefault ValueOrigin = iota + // OriginExplicitlySet indicates the value is has been set explicitly. + OriginExplicitlySet + // OriginExternallySet indicates the value has been set externally, such as + // via a host-cluster override for this or all tenant(s). + OriginExternallySet +) diff --git a/pkg/settings/updater.go b/pkg/settings/updater.go index 4796e01728b7..daf2db006dde 100644 --- a/pkg/settings/updater.go +++ b/pkg/settings/updater.go @@ -72,6 +72,7 @@ type updater struct { type Updater interface { Set(ctx context.Context, key string, value EncodedValue) error ResetRemaining(ctx context.Context) + SetValueOrigin(ctx context.Context, key string, origin ValueOrigin) } // A NoopUpdater ignores all updates. @@ -83,6 +84,8 @@ func (u NoopUpdater) Set(ctx context.Context, key string, value EncodedValue) er // ResetRemaining implements Updater. It is a no-op. func (u NoopUpdater) ResetRemaining(context.Context) {} +func (u NoopUpdater) SetValueOrigin(ctx context.Context, key string, origin ValueOrigin) {} + // NewUpdater makes an Updater. func NewUpdater(sv *Values) Updater { if ignoreAllUpdates { @@ -165,6 +168,13 @@ func (u updater) Set(ctx context.Context, key string, value EncodedValue) error // ResetRemaining sets all settings not updated by the updater to their default values. func (u updater) ResetRemaining(ctx context.Context) { for k, v := range registry { + + if _, hasOverride := u.m[k]; hasOverride { + u.sv.setValueOrigin(ctx, v.getSlot(), OriginExplicitlySet) + } else { + u.sv.setValueOrigin(ctx, v.getSlot(), OriginDefault) + } + if u.sv.NonSystemTenant() && v.Class() == SystemOnly { // Don't try to reset system settings on a non-system tenant. continue @@ -174,3 +184,11 @@ func (u updater) ResetRemaining(ctx context.Context) { } } } + +// SetValueOrigin sets the origin of the value of a given setting. +func (u updater) SetValueOrigin(ctx context.Context, key string, origin ValueOrigin) { + d, ok := registry[key] + if ok { + u.sv.setValueOrigin(ctx, d.getSlot(), origin) + } +} diff --git a/pkg/settings/values.go b/pkg/settings/values.go index 3a953a7a4642..4ad26ef58ea9 100644 --- a/pkg/settings/values.go +++ b/pkg/settings/values.go @@ -61,6 +61,8 @@ type valuesContainer struct { // current context (i.e. it is a SystemOnly setting and the container is for a // tenant). Reading or writing such a setting causes panics in test builds. forbidden [numSlots]bool + + hasValue [numSlots]uint32 } func (c *valuesContainer) setGenericVal(slot slotIdx, newVal interface{}) { @@ -154,6 +156,14 @@ func (sv *Values) setInt64(ctx context.Context, slot slotIdx, newVal int64) { } } +func (sv *Values) setValueOrigin(ctx context.Context, slot slotIdx, origin ValueOrigin) { + atomic.StoreUint32(&sv.container.hasValue[slot], uint32(origin)) +} + +func (sv *Values) getValueOrigin(ctx context.Context, slot slotIdx) ValueOrigin { + return ValueOrigin(atomic.LoadUint32(&sv.container.hasValue[slot])) +} + // setDefaultOverride overrides the default value for the respective setting to // newVal. func (sv *Values) setDefaultOverride(slot slotIdx, newVal interface{}) { From e64b6a447417bd6bc5aca7d6b316f65796ac69ac Mon Sep 17 00:00:00 2001 From: maryliag Date: Tue, 6 Jun 2023 17:16:59 -0400 Subject: [PATCH 2/2] sql: add default_value and is_overridden to cluster settings Fixes https://cockroachlabs.atlassian.net/browse/CRDB-28519 Previously, there was no easy way to see default values for cluster settings. This commit add the column for `default_value` and `origin` to `crdb_internal.cluster_settings` and the `show cluster settings` command. Release note (sql change): Add columns `default_value` and `origin` (default, override, external-override) to the `show cluster settings` command. --- .../testdata/logic_test/crdb_internal_tenant | 4 +- pkg/server/settings_test.go | 2 +- pkg/settings/setting.go | 12 +++++- pkg/sql/crdb_internal.go | 11 +++++- pkg/sql/delegate/show_all_cluster_settings.go | 4 +- .../testdata/logic_test/cluster_settings | 38 +++++++++++++++++++ .../testdata/logic_test/crdb_internal | 4 +- .../testdata/logic_test/crdb_internal_catalog | 2 +- .../logictest/testdata/logic_test/show_source | 18 ++++----- 9 files changed, 76 insertions(+), 19 deletions(-) diff --git a/pkg/ccl/logictestccl/testdata/logic_test/crdb_internal_tenant b/pkg/ccl/logictestccl/testdata/logic_test/crdb_internal_tenant index 89b67b8132c6..c3084bcdb05e 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/crdb_internal_tenant +++ b/pkg/ccl/logictestccl/testdata/logic_test/crdb_internal_tenant @@ -224,10 +224,10 @@ SELECT * FROM crdb_internal.session_trace WHERE span_idx < 0 ---- span_idx message_idx timestamp duration operation loc tag message age -query TTTBT colnames +query TTTBTTT colnames SELECT * FROM crdb_internal.cluster_settings WHERE variable = '' ---- -variable value type public description +variable value type public description default_value origin query TI colnames SELECT * FROM crdb_internal.feature_usage WHERE feature_name = '' diff --git a/pkg/server/settings_test.go b/pkg/server/settings_test.go index 567accfd7b9c..95e3ed18bb86 100644 --- a/pkg/server/settings_test.go +++ b/pkg/server/settings_test.go @@ -276,7 +276,7 @@ func TestSettingsShowAll(t *testing.T) { if len(rows) < 2 { t.Fatalf("show all returned too few rows (%d)", len(rows)) } - const expColumns = 5 + const expColumns = 7 if len(rows[0]) != expColumns { t.Fatalf("show all must return %d columns, found %d", expColumns, len(rows[0])) } diff --git a/pkg/settings/setting.go b/pkg/settings/setting.go index 72455441c783..1b3daae5e4da 100644 --- a/pkg/settings/setting.go +++ b/pkg/settings/setting.go @@ -10,7 +10,10 @@ package settings -import "context" +import ( + "context" + "fmt" +) // Setting is the interface exposing the metadata for a cluster setting. // @@ -159,3 +162,10 @@ const ( // via a host-cluster override for this or all tenant(s). OriginExternallySet ) + +func (v ValueOrigin) String() string { + if v > OriginExternallySet { + return fmt.Sprintf("invalid (%d)", v) + } + return [...]string{"default", "override", "external-override"}[v] +} diff --git a/pkg/sql/crdb_internal.go b/pkg/sql/crdb_internal.go index e718c6538329..bef5f135953e 100644 --- a/pkg/sql/crdb_internal.go +++ b/pkg/sql/crdb_internal.go @@ -2054,7 +2054,9 @@ CREATE TABLE crdb_internal.cluster_settings ( value STRING NOT NULL, type STRING NOT NULL, public BOOL NOT NULL, -- whether the setting is documented, which implies the user can expect support. - description STRING NOT NULL + description STRING NOT NULL, + default_value STRING NOT NULL, + origin STRING NOT NULL -- the origin of the value: 'default' , 'override' or 'external-override' )`, populate: func(ctx context.Context, p *planner, _ catalog.DatabaseDescriptor, addRow func(...tree.Datum) error) error { hasSqlModify, err := p.HasPrivilege(ctx, syntheticprivilege.GlobalPrivilegeObject, privilege.MODIFYSQLCLUSTERSETTING, p.User()) @@ -2093,12 +2095,19 @@ CREATE TABLE crdb_internal.cluster_settings ( strVal := setting.String(&p.ExecCfg().Settings.SV) isPublic := setting.Visibility() == settings.Public desc := setting.Description() + defaultVal, err := setting.DecodeToString(setting.EncodedDefault()) + if err != nil { + return err + } + origin := setting.ValueOrigin(ctx, &p.ExecCfg().Settings.SV).String() if err := addRow( tree.NewDString(k), tree.NewDString(strVal), tree.NewDString(setting.Typ()), tree.MakeDBool(tree.DBool(isPublic)), tree.NewDString(desc), + tree.NewDString(defaultVal), + tree.NewDString(origin), ); err != nil { return err } diff --git a/pkg/sql/delegate/show_all_cluster_settings.go b/pkg/sql/delegate/show_all_cluster_settings.go index 7aa0169f9c4b..6024648c9dc0 100644 --- a/pkg/sql/delegate/show_all_cluster_settings.go +++ b/pkg/sql/delegate/show_all_cluster_settings.go @@ -77,12 +77,12 @@ func (d *delegator) delegateShowClusterSettingList( if stmt.All { return d.parse( - `SELECT variable, value, type AS setting_type, public, description + `SELECT variable, value, type AS setting_type, public, description, default_value, origin FROM crdb_internal.cluster_settings`, ) } return d.parse( - `SELECT variable, value, type AS setting_type, description + `SELECT variable, value, type AS setting_type, description, default_value, origin FROM crdb_internal.cluster_settings WHERE public IS TRUE`, ) diff --git a/pkg/sql/logictest/testdata/logic_test/cluster_settings b/pkg/sql/logictest/testdata/logic_test/cluster_settings index 1437710777c7..7d56f17c8791 100644 --- a/pkg/sql/logictest/testdata/logic_test/cluster_settings +++ b/pkg/sql/logictest/testdata/logic_test/cluster_settings @@ -78,6 +78,44 @@ WHERE variable IN ('sql.defaults.default_int_size') ---- sql.defaults.default_int_size 4 +query TTTT +SELECT variable, value, default_value, origin FROM [SHOW ALL CLUSTER SETTINGS] +WHERE variable IN ('sql.index_recommendation.drop_unused_duration') +---- +sql.index_recommendation.drop_unused_duration 168h0m0s 168h0m0s default + +statement ok +SET CLUSTER SETTING sql.index_recommendation.drop_unused_duration = '10s' + +query TTTT +SELECT variable, value, default_value, origin FROM [SHOW ALL CLUSTER SETTINGS] +WHERE variable IN ('sql.index_recommendation.drop_unused_duration') +---- +sql.index_recommendation.drop_unused_duration 10s 168h0m0s override + +statement ok +RESET CLUSTER SETTING sql.index_recommendation.drop_unused_duration + +query TTTT +SELECT variable, value, default_value, origin FROM [SHOW ALL CLUSTER SETTINGS] +WHERE variable IN ('sql.index_recommendation.drop_unused_duration') +---- +sql.index_recommendation.drop_unused_duration 168h0m0s 168h0m0s default + +user host-cluster-root + +statement ok +ALTER TENANT ALL SET CLUSTER SETTING sql.index_recommendation.drop_unused_duration = '50s' + +user root + +onlyif config 3node-tenant-default-configs +query TTTT +SELECT variable, value, default_value, origin FROM [SHOW ALL CLUSTER SETTINGS] +WHERE variable IN ('sql.index_recommendation.drop_unused_duration') +---- +sql.index_recommendation.drop_unused_duration 50s 168h0m0s external-override + user root statement ok diff --git a/pkg/sql/logictest/testdata/logic_test/crdb_internal b/pkg/sql/logictest/testdata/logic_test/crdb_internal index d3468e5e9818..b8360caa78d4 100644 --- a/pkg/sql/logictest/testdata/logic_test/crdb_internal +++ b/pkg/sql/logictest/testdata/logic_test/crdb_internal @@ -355,10 +355,10 @@ SELECT * FROM crdb_internal.session_trace WHERE span_idx < 0 ---- span_idx message_idx timestamp duration operation loc tag message age -query TTTBT colnames +query TTTBTTT colnames SELECT * FROM crdb_internal.cluster_settings WHERE variable = '' ---- -variable value type public description +variable value type public description default_value origin query TI colnames SELECT * FROM crdb_internal.feature_usage WHERE feature_name = '' diff --git a/pkg/sql/logictest/testdata/logic_test/crdb_internal_catalog b/pkg/sql/logictest/testdata/logic_test/crdb_internal_catalog index a0a4fa1bdc6a..f961c89fd51b 100644 --- a/pkg/sql/logictest/testdata/logic_test/crdb_internal_catalog +++ b/pkg/sql/logictest/testdata/logic_test/crdb_internal_catalog @@ -466,7 +466,7 @@ SELECT id, strip_volatile(descriptor) FROM crdb_internal.kv_catalog_descriptor O 4294967271 {"table": {"columns": [{"id": 1, "name": "database_id", "nullable": true, "type": {"family": "IntFamily", "oid": 20, "width": 64}}, {"id": 2, "name": "database_name", "nullable": true, "type": {"family": "StringFamily", "oid": 25}}, {"id": 3, "name": "schema_id", "nullable": true, "type": {"family": "IntFamily", "oid": 20, "width": 64}}, {"id": 4, "name": "schema_name", "nullable": true, "type": {"family": "StringFamily", "oid": 25}}, {"id": 5, "name": "function_id", "nullable": true, "type": {"family": "IntFamily", "oid": 20, "width": 64}}, {"id": 6, "name": "function_name", "nullable": true, "type": {"family": "StringFamily", "oid": 25}}, {"id": 7, "name": "create_statement", "nullable": true, "type": {"family": "StringFamily", "oid": 25}}], "formatVersion": 3, "id": 4294967271, "name": "create_function_statements", "nextColumnId": 8, "nextConstraintId": 2, "nextIndexId": 2, "nextMutationId": 1, "primaryIndex": {"constraintId": 1, "foreignKey": {}, "geoConfig": {}, "id": 1, "interleave": {}, "partitioning": {}, "sharded": {}}, "privileges": {"ownerProto": "node", "users": [{"privileges": "32", "userProto": "public"}], "version": 2}, "replacementOf": {"time": {}}, "unexposedParentSchemaId": 4294967295, "version": "1"}} 4294967272 {"table": {"columns": [{"id": 1, "name": "aggregated_ts", "type": {"family": "TimestampTZFamily", "oid": 1184}}, {"id": 2, "name": "fingerprint_id", "type": {"family": "BytesFamily", "oid": 17}}, {"id": 3, "name": "app_name", "type": {"family": "StringFamily", "oid": 25}}, {"id": 4, "name": "metadata", "type": {"family": "JsonFamily", "oid": 3802}}, {"id": 5, "name": "statistics", "type": {"family": "JsonFamily", "oid": 3802}}, {"id": 6, "name": "aggregation_interval", "type": {"family": "IntervalFamily", "intervalDurationField": {}, "oid": 1186}}], "formatVersion": 3, "id": 4294967272, "name": "cluster_transaction_statistics", "nextColumnId": 7, "nextConstraintId": 2, "nextIndexId": 2, "nextMutationId": 1, "primaryIndex": {"constraintId": 1, "foreignKey": {}, "geoConfig": {}, "id": 1, "interleave": {}, "partitioning": {}, "sharded": {}}, "privileges": {"ownerProto": "node", "users": [{"privileges": "32", "userProto": "public"}], "version": 2}, "replacementOf": {"time": {}}, "unexposedParentSchemaId": 4294967295, "version": "1"}} 4294967273 {"table": {"columns": [{"id": 1, "name": "aggregated_ts", "type": {"family": "TimestampTZFamily", "oid": 1184}}, {"id": 2, "name": "fingerprint_id", "type": {"family": "BytesFamily", "oid": 17}}, {"id": 3, "name": "transaction_fingerprint_id", "type": {"family": "BytesFamily", "oid": 17}}, {"id": 4, "name": "plan_hash", "type": {"family": "BytesFamily", "oid": 17}}, {"id": 5, "name": "app_name", "type": {"family": "StringFamily", "oid": 25}}, {"id": 6, "name": "metadata", "type": {"family": "JsonFamily", "oid": 3802}}, {"id": 7, "name": "statistics", "type": {"family": "JsonFamily", "oid": 3802}}, {"id": 8, "name": "sampled_plan", "type": {"family": "JsonFamily", "oid": 3802}}, {"id": 9, "name": "aggregation_interval", "type": {"family": "IntervalFamily", "intervalDurationField": {}, "oid": 1186}}, {"id": 10, "name": "index_recommendations", "type": {"arrayContents": {"family": "StringFamily", "oid": 25}, "arrayElemType": "StringFamily", "family": "ArrayFamily", "oid": 1009}}], "formatVersion": 3, "id": 4294967273, "name": "cluster_statement_statistics", "nextColumnId": 11, "nextConstraintId": 2, "nextIndexId": 2, "nextMutationId": 1, "primaryIndex": {"constraintId": 1, "foreignKey": {}, "geoConfig": {}, "id": 1, "interleave": {}, "partitioning": {}, "sharded": {}}, "privileges": {"ownerProto": "node", "users": [{"privileges": "32", "userProto": "public"}], "version": 2}, "replacementOf": {"time": {}}, "unexposedParentSchemaId": 4294967295, "version": "1"}} -4294967274 {"table": {"columns": [{"id": 1, "name": "variable", "type": {"family": "StringFamily", "oid": 25}}, {"id": 2, "name": "value", "type": {"family": "StringFamily", "oid": 25}}, {"id": 3, "name": "type", "type": {"family": "StringFamily", "oid": 25}}, {"id": 4, "name": "public", "type": {"oid": 16}}, {"id": 5, "name": "description", "type": {"family": "StringFamily", "oid": 25}}], "formatVersion": 3, "id": 4294967274, "name": "cluster_settings", "nextColumnId": 6, "nextConstraintId": 2, "nextIndexId": 2, "nextMutationId": 1, "primaryIndex": {"constraintId": 1, "foreignKey": {}, "geoConfig": {}, "id": 1, "interleave": {}, "partitioning": {}, "sharded": {}}, "privileges": {"ownerProto": "node", "users": [{"privileges": "32", "userProto": "public"}], "version": 2}, "replacementOf": {"time": {}}, "unexposedParentSchemaId": 4294967295, "version": "1"}} +4294967274 {"table": {"columns": [{"id": 1, "name": "variable", "type": {"family": "StringFamily", "oid": 25}}, {"id": 2, "name": "value", "type": {"family": "StringFamily", "oid": 25}}, {"id": 3, "name": "type", "type": {"family": "StringFamily", "oid": 25}}, {"id": 4, "name": "public", "type": {"oid": 16}}, {"id": 5, "name": "description", "type": {"family": "StringFamily", "oid": 25}}, {"id": 6, "name": "default_value", "type": {"family": "StringFamily", "oid": 25}}, {"id": 7, "name": "origin", "type": {"family": "StringFamily", "oid": 25}}], "formatVersion": 3, "id": 4294967274, "name": "cluster_settings", "nextColumnId": 8, "nextConstraintId": 2, "nextIndexId": 2, "nextMutationId": 1, "primaryIndex": {"constraintId": 1, "foreignKey": {}, "geoConfig": {}, "id": 1, "interleave": {}, "partitioning": {}, "sharded": {}}, "privileges": {"ownerProto": "node", "users": [{"privileges": "32", "userProto": "public"}], "version": 2}, "replacementOf": {"time": {}}, "unexposedParentSchemaId": 4294967295, "version": "1"}} 4294967275 {"table": {"columns": [{"id": 1, "name": "node_id", "type": {"family": "IntFamily", "oid": 20, "width": 64}}, {"id": 2, "name": "session_id", "nullable": true, "type": {"family": "StringFamily", "oid": 25}}, {"id": 3, "name": "user_name", "nullable": true, "type": {"family": "StringFamily", "oid": 25}}, {"id": 4, "name": "client_address", "nullable": true, "type": {"family": "StringFamily", "oid": 25}}, {"id": 5, "name": "application_name", "nullable": true, "type": {"family": "StringFamily", "oid": 25}}, {"id": 6, "name": "active_queries", "nullable": true, "type": {"family": "StringFamily", "oid": 25}}, {"id": 7, "name": "last_active_query", "nullable": true, "type": {"family": "StringFamily", "oid": 25}}, {"id": 8, "name": "num_txns_executed", "nullable": true, "type": {"family": "IntFamily", "oid": 20, "width": 64}}, {"id": 9, "name": "session_start", "nullable": true, "type": {"family": "TimestampFamily", "oid": 1114}}, {"id": 10, "name": "active_query_start", "nullable": true, "type": {"family": "TimestampFamily", "oid": 1114}}, {"id": 11, "name": "kv_txn", "nullable": true, "type": {"family": "StringFamily", "oid": 25}}, {"id": 12, "name": "alloc_bytes", "nullable": true, "type": {"family": "IntFamily", "oid": 20, "width": 64}}, {"id": 13, "name": "max_alloc_bytes", "nullable": true, "type": {"family": "IntFamily", "oid": 20, "width": 64}}, {"id": 14, "name": "status", "nullable": true, "type": {"family": "StringFamily", "oid": 25}}, {"id": 15, "name": "session_end", "nullable": true, "type": {"family": "TimestampFamily", "oid": 1114}}], "formatVersion": 3, "id": 4294967275, "name": "cluster_sessions", "nextColumnId": 16, "nextConstraintId": 2, "nextIndexId": 2, "nextMutationId": 1, "primaryIndex": {"constraintId": 1, "foreignKey": {}, "geoConfig": {}, "id": 1, "interleave": {}, "partitioning": {}, "sharded": {}}, "privileges": {"ownerProto": "node", "users": [{"privileges": "32", "userProto": "public"}], "version": 2}, "replacementOf": {"time": {}}, "unexposedParentSchemaId": 4294967295, "version": "1"}} 4294967276 {"table": {"columns": [{"id": 1, "name": "id", "nullable": true, "type": {"family": "UuidFamily", "oid": 2950}}, {"id": 2, "name": "node_id", "nullable": true, "type": {"family": "IntFamily", "oid": 20, "width": 64}}, {"id": 3, "name": "session_id", "nullable": true, "type": {"family": "StringFamily", "oid": 25}}, {"id": 4, "name": "start", "nullable": true, "type": {"family": "TimestampFamily", "oid": 1114}}, {"id": 5, "name": "txn_string", "nullable": true, "type": {"family": "StringFamily", "oid": 25}}, {"id": 6, "name": "application_name", "nullable": true, "type": {"family": "StringFamily", "oid": 25}}, {"id": 7, "name": "num_stmts", "nullable": true, "type": {"family": "IntFamily", "oid": 20, "width": 64}}, {"id": 8, "name": "num_retries", "nullable": true, "type": {"family": "IntFamily", "oid": 20, "width": 64}}, {"id": 9, "name": "num_auto_retries", "nullable": true, "type": {"family": "IntFamily", "oid": 20, "width": 64}}, {"id": 10, "name": "last_auto_retry_reason", "nullable": true, "type": {"family": "StringFamily", "oid": 25}}, {"id": 11, "name": "isolation_level", "nullable": true, "type": {"family": "StringFamily", "oid": 25}}, {"id": 12, "name": "priority", "nullable": true, "type": {"family": "StringFamily", "oid": 25}}, {"id": 13, "name": "quality_of_service", "nullable": true, "type": {"family": "StringFamily", "oid": 25}}], "formatVersion": 3, "id": 4294967276, "name": "cluster_transactions", "nextColumnId": 14, "nextConstraintId": 2, "nextIndexId": 2, "nextMutationId": 1, "primaryIndex": {"constraintId": 1, "foreignKey": {}, "geoConfig": {}, "id": 1, "interleave": {}, "partitioning": {}, "sharded": {}}, "privileges": {"ownerProto": "node", "users": [{"privileges": "32", "userProto": "public"}], "version": 2}, "replacementOf": {"time": {}}, "unexposedParentSchemaId": 4294967295, "version": "1"}} 4294967277 {"table": {"columns": [{"id": 1, "name": "query_id", "nullable": true, "type": {"family": "StringFamily", "oid": 25}}, {"id": 2, "name": "txn_id", "nullable": true, "type": {"family": "UuidFamily", "oid": 2950}}, {"id": 3, "name": "node_id", "type": {"family": "IntFamily", "oid": 20, "width": 64}}, {"id": 4, "name": "session_id", "nullable": true, "type": {"family": "StringFamily", "oid": 25}}, {"id": 5, "name": "user_name", "nullable": true, "type": {"family": "StringFamily", "oid": 25}}, {"id": 6, "name": "start", "nullable": true, "type": {"family": "TimestampFamily", "oid": 1114}}, {"id": 7, "name": "query", "nullable": true, "type": {"family": "StringFamily", "oid": 25}}, {"id": 8, "name": "client_address", "nullable": true, "type": {"family": "StringFamily", "oid": 25}}, {"id": 9, "name": "application_name", "nullable": true, "type": {"family": "StringFamily", "oid": 25}}, {"id": 10, "name": "distributed", "nullable": true, "type": {"oid": 16}}, {"id": 11, "name": "phase", "nullable": true, "type": {"family": "StringFamily", "oid": 25}}, {"id": 12, "name": "full_scan", "nullable": true, "type": {"oid": 16}}, {"id": 13, "name": "plan_gist", "nullable": true, "type": {"family": "StringFamily", "oid": 25}}, {"id": 14, "name": "database", "nullable": true, "type": {"family": "StringFamily", "oid": 25}}], "formatVersion": 3, "id": 4294967277, "name": "cluster_queries", "nextColumnId": 15, "nextConstraintId": 2, "nextIndexId": 2, "nextMutationId": 1, "primaryIndex": {"constraintId": 1, "foreignKey": {}, "geoConfig": {}, "id": 1, "interleave": {}, "partitioning": {}, "sharded": {}}, "privileges": {"ownerProto": "node", "users": [{"privileges": "32", "userProto": "public"}], "version": 2}, "replacementOf": {"time": {}}, "unexposedParentSchemaId": 4294967295, "version": "1"}} diff --git a/pkg/sql/logictest/testdata/logic_test/show_source b/pkg/sql/logictest/testdata/logic_test/show_source index 1f11222da883..a4abe7975efd 100644 --- a/pkg/sql/logictest/testdata/logic_test/show_source +++ b/pkg/sql/logictest/testdata/logic_test/show_source @@ -180,23 +180,23 @@ SELECT * FROM [SHOW CLUSTER SETTING sql.defaults.distsql] sql.defaults.distsql off -query TTTBT colnames +query TTTBTTT colnames SELECT * FROM [SHOW ALL CLUSTER SETTINGS] WHERE variable LIKE '%organization' ---- -variable value setting_type public description -cluster.organization · s true organization name +variable value setting_type public description default_value origin +cluster.organization · s true organization name · default -query TTTT colnames +query TTTTTT colnames SELECT * FROM [SHOW CLUSTER SETTINGS] WHERE variable LIKE '%organization' ---- -variable value setting_type description -cluster.organization · s organization name +variable value setting_type description default_value origin +cluster.organization · s organization name · default -query TTTT colnames +query TTTTTT colnames SELECT * FROM [SHOW PUBLIC CLUSTER SETTINGS] WHERE variable LIKE '%organization' ---- -variable value setting_type description -cluster.organization · s organization name +variable value setting_type description default_value origin +cluster.organization · s organization name · default query T colnames SELECT * FROM [SHOW SESSION_USER]