Skip to content

Commit 6863798

Browse files
craig[bot]kyle-a-wong
andcommitted
Merge #151245
151245: sql: Add DefaultValue field to SetClusterSettings event r=kyle-a-wong a=kyle-a-wong encodes the current default value of a cluster setting when a cluster setting has changed. This is primarily being added to help with debugging when it is unclear what the default setting value may have been at the time of updating the setting. Epic: CRDB-52093 Part of: https://cockroachlabs.atlassian.net/browse/CRDB-50883 Release note: None Co-authored-by: Kyle Wong <[email protected]>
2 parents df1fb6a + abaaeab commit 6863798

File tree

5 files changed

+28
-12
lines changed

5 files changed

+28
-12
lines changed

docs/generated/eventlog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,7 @@ An event of type `set_cluster_setting` is recorded when a cluster setting is cha
634634
|--|--|--|
635635
| `SettingName` | The name of the affected cluster setting. | no |
636636
| `Value` | The new value of the cluster setting. | yes |
637+
| `DefaultValue` | The current default value of the cluster setting. | yes |
637638

638639

639640
#### Common fields

pkg/sql/logictest/testdata/logic_test/event_log

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -482,12 +482,12 @@ AND info NOT LIKE '%sql.testing%'
482482
AND info NOT LIKE '%sql.stats%'
483483
ORDER BY "timestamp", info
484484
----
485-
1 {"ApplicationName": "$ internal-optInToDiagnosticsStatReporting", "EventType": "set_cluster_setting", "SettingName": "diagnostics.reporting.enabled", "Statement": "SET CLUSTER SETTING \"diagnostics.reporting.enabled\" = true", "Tag": "SET CLUSTER SETTING", "User": "node", "Value": "true"}
486-
1 {"EventType": "set_cluster_setting", "SettingName": "sql.crdb_internal.table_row_statistics.as_of_time", "Statement": "SET CLUSTER SETTING \"sql.crdb_internal.table_row_statistics.as_of_time\" = e'-1\\u00B5s'", "Tag": "SET CLUSTER SETTING", "User": "root", "Value": "-00:00:00.000001"}
487-
1 {"EventType": "set_cluster_setting", "SettingName": "feature.vector_index.enabled", "Statement": "SET CLUSTER SETTING \"feature.vector_index.enabled\" = true", "Tag": "SET CLUSTER SETTING", "User": "root", "Value": "true"}
488-
1 {"EventType": "set_cluster_setting", "SettingName": "sql.vecindex.deterministic_fixups.enabled", "Statement": "SET CLUSTER SETTING \"sql.vecindex.deterministic_fixups.enabled\" = true", "Tag": "SET CLUSTER SETTING", "User": "root", "Value": "true"}
489-
1 {"EventType": "set_cluster_setting", "SettingName": "kv.allocator.load_based_lease_rebalancing.enabled", "Statement": "SET CLUSTER SETTING \"kv.allocator.load_based_lease_rebalancing.enabled\" = false", "Tag": "SET CLUSTER SETTING", "User": "root", "Value": "false"}
490-
1 {"EventType": "set_cluster_setting", "SettingName": "kv.allocator.load_based_lease_rebalancing.enabled", "Statement": "SET CLUSTER SETTING \"kv.allocator.load_based_lease_rebalancing.enabled\" = DEFAULT", "Tag": "SET CLUSTER SETTING", "User": "root", "Value": "DEFAULT"}
485+
1 {"ApplicationName": "$ internal-optInToDiagnosticsStatReporting", "DefaultValue": "true", "EventType": "set_cluster_setting", "SettingName": "diagnostics.reporting.enabled", "Statement": "SET CLUSTER SETTING \"diagnostics.reporting.enabled\" = true", "Tag": "SET CLUSTER SETTING", "User": "node", "Value": "true"}
486+
1 {"DefaultValue": "-10s", "EventType": "set_cluster_setting", "SettingName": "sql.crdb_internal.table_row_statistics.as_of_time", "Statement": "SET CLUSTER SETTING \"sql.crdb_internal.table_row_statistics.as_of_time\" = e'-1\\u00B5s'", "Tag": "SET CLUSTER SETTING", "User": "root", "Value": "-00:00:00.000001"}
487+
1 {"DefaultValue": "false", "EventType": "set_cluster_setting", "SettingName": "feature.vector_index.enabled", "Statement": "SET CLUSTER SETTING \"feature.vector_index.enabled\" = true", "Tag": "SET CLUSTER SETTING", "User": "root", "Value": "true"}
488+
1 {"DefaultValue": "false", "EventType": "set_cluster_setting", "SettingName": "sql.vecindex.deterministic_fixups.enabled", "Statement": "SET CLUSTER SETTING \"sql.vecindex.deterministic_fixups.enabled\" = true", "Tag": "SET CLUSTER SETTING", "User": "root", "Value": "true"}
489+
1 {"DefaultValue": "true", "EventType": "set_cluster_setting", "SettingName": "kv.allocator.load_based_lease_rebalancing.enabled", "Statement": "SET CLUSTER SETTING \"kv.allocator.load_based_lease_rebalancing.enabled\" = false", "Tag": "SET CLUSTER SETTING", "User": "root", "Value": "false"}
490+
1 {"DefaultValue": "true", "EventType": "set_cluster_setting", "SettingName": "kv.allocator.load_based_lease_rebalancing.enabled", "Statement": "SET CLUSTER SETTING \"kv.allocator.load_based_lease_rebalancing.enabled\" = DEFAULT", "Tag": "SET CLUSTER SETTING", "User": "root", "Value": "DEFAULT"}
491491
1 {"EventType": "set_cluster_setting", "PlaceholderValues": ["'some string'"], "SettingName": "cluster.label", "Statement": "SET CLUSTER SETTING \"cluster.label\" = $1", "Tag": "SET CLUSTER SETTING", "User": "root", "Value": "'some string'"}
492492

493493
onlyif config 3node-tenant-default-configs
@@ -503,10 +503,10 @@ AND info NOT LIKE '%sql.testing%'
503503
AND info NOT LIKE '%sql.stats%'
504504
ORDER BY "timestamp", info
505505
----
506-
1 {"ApplicationName": "$ internal-optInToDiagnosticsStatReporting", "EventType": "set_cluster_setting", "SettingName": "diagnostics.reporting.enabled", "Statement": "SET CLUSTER SETTING \"diagnostics.reporting.enabled\" = true", "Tag": "SET CLUSTER SETTING", "User": "node", "Value": "true"}
507-
1 {"EventType": "set_cluster_setting", "SettingName": "sql.crdb_internal.table_row_statistics.as_of_time", "Statement": "SET CLUSTER SETTING \"sql.crdb_internal.table_row_statistics.as_of_time\" = e'-1\\u00B5s'", "Tag": "SET CLUSTER SETTING", "User": "root", "Value": "-00:00:00.000001"}
508-
1 {"EventType": "set_cluster_setting", "SettingName": "feature.vector_index.enabled", "Statement": "SET CLUSTER SETTING \"feature.vector_index.enabled\" = true", "Tag": "SET CLUSTER SETTING", "User": "root", "Value": "true"}
509-
1 {"EventType": "set_cluster_setting", "SettingName": "sql.vecindex.deterministic_fixups.enabled", "Statement": "SET CLUSTER SETTING \"sql.vecindex.deterministic_fixups.enabled\" = true", "Tag": "SET CLUSTER SETTING", "User": "root", "Value": "true"}
506+
1 {"ApplicationName": "$ internal-optInToDiagnosticsStatReporting", "DefaultValue": "true", "EventType": "set_cluster_setting", "SettingName": "diagnostics.reporting.enabled", "Statement": "SET CLUSTER SETTING \"diagnostics.reporting.enabled\" = true", "Tag": "SET CLUSTER SETTING", "User": "node", "Value": "true"}
507+
1 {"DefaultValue": "-10s", "EventType": "set_cluster_setting", "SettingName": "sql.crdb_internal.table_row_statistics.as_of_time", "Statement": "SET CLUSTER SETTING \"sql.crdb_internal.table_row_statistics.as_of_time\" = e'-1\\u00B5s'", "Tag": "SET CLUSTER SETTING", "User": "root", "Value": "-00:00:00.000001"}
508+
1 {"DefaultValue": "false", "EventType": "set_cluster_setting", "SettingName": "feature.vector_index.enabled", "Statement": "SET CLUSTER SETTING \"feature.vector_index.enabled\" = true", "Tag": "SET CLUSTER SETTING", "User": "root", "Value": "true"}
509+
1 {"DefaultValue": "false", "EventType": "set_cluster_setting", "SettingName": "sql.vecindex.deterministic_fixups.enabled", "Statement": "SET CLUSTER SETTING \"sql.vecindex.deterministic_fixups.enabled\" = true", "Tag": "SET CLUSTER SETTING", "User": "root", "Value": "true"}
510510
1 {"EventType": "set_cluster_setting", "PlaceholderValues": ["'some string'"], "SettingName": "cluster.label", "Statement": "SET CLUSTER SETTING \"cluster.label\" = $1", "Tag": "SET CLUSTER SETTING", "User": "root", "Value": "'some string'"}
511511

512512
# Set and unset zone configs

pkg/sql/set_cluster_setting.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,8 +464,9 @@ func writeSettingInternal(
464464
return logFn(ctx,
465465
0, /* no target */
466466
&eventpb.SetClusterSetting{
467-
SettingName: string(name),
468-
Value: reportedValue,
467+
SettingName: string(name),
468+
Value: reportedValue,
469+
DefaultValue: setting.DefaultString(),
469470
})
470471
}(); err != nil {
471472
return "", err

pkg/util/log/eventpb/json_encode_generated.go

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/util/log/eventpb/misc_sql_events.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ message SetClusterSetting {
3333
string setting_name = 3 [(gogoproto.jsontag) = ",omitempty", (gogoproto.moretags) = "redact:\"nonsensitive\""];
3434
// The new value of the cluster setting.
3535
string value = 4 [(gogoproto.jsontag) = ",omitempty"];
36+
// The current default value of the cluster setting.
37+
string default_value = 5 [(gogoproto.jsontag) = ",omitempty"];
3638
}
3739

3840

0 commit comments

Comments
 (0)