Skip to content

Commit

Permalink
cli: add system.settings to debug zip
Browse files Browse the repository at this point in the history
This is handy to figure out whether a setting was explicitly set.
It may not be as elegant as annotating crdb_internal.cluster_settings,
but it is simple, backwards compatible, and something.

Release note (ops change): cockroach debug zip will now include the raw
system.settings table. This table makes it possible to determine whether
a cluster settings has been explicitly set.
  • Loading branch information
ajwerner committed Sep 21, 2021
1 parent d927893 commit 5cf185e
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/cli/testdata/zip/partial1
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ debug zip --concurrency=1 --cpu-profile-duration=0s /dev/null
[cluster] retrieving SQL data for system.descriptor... writing output: debug/system.descriptor.txt... done
[cluster] retrieving SQL data for system.namespace... writing output: debug/system.namespace.txt... done
[cluster] retrieving SQL data for system.scheduled_jobs... writing output: debug/system.scheduled_jobs.txt... done
[cluster] retrieving SQL data for system.settings... writing output: debug/system.settings.txt... done
[cluster] retrieving SQL data for "".crdb_internal.create_statements... writing output: debug/crdb_internal.create_statements.txt... done
[cluster] retrieving SQL data for "".crdb_internal.create_type_statements... writing output: debug/crdb_internal.create_type_statements.txt... done
[cluster] retrieving SQL data for crdb_internal.kv_node_liveness... writing output: debug/crdb_internal.kv_node_liveness.txt... done
Expand Down
1 change: 1 addition & 0 deletions pkg/cli/testdata/zip/partial1_excluded
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ debug zip /dev/null --concurrency=1 --exclude-nodes=2 --cpu-profile-duration=0
[cluster] retrieving SQL data for system.descriptor... writing output: debug/system.descriptor.txt... done
[cluster] retrieving SQL data for system.namespace... writing output: debug/system.namespace.txt... done
[cluster] retrieving SQL data for system.scheduled_jobs... writing output: debug/system.scheduled_jobs.txt... done
[cluster] retrieving SQL data for system.settings... writing output: debug/system.settings.txt... done
[cluster] retrieving SQL data for "".crdb_internal.create_statements... writing output: debug/crdb_internal.create_statements.txt... done
[cluster] retrieving SQL data for "".crdb_internal.create_type_statements... writing output: debug/crdb_internal.create_type_statements.txt... done
[cluster] retrieving SQL data for crdb_internal.kv_node_liveness... writing output: debug/crdb_internal.kv_node_liveness.txt... done
Expand Down
1 change: 1 addition & 0 deletions pkg/cli/testdata/zip/partial2
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ debug zip --concurrency=1 --cpu-profile-duration=0 /dev/null
[cluster] retrieving SQL data for system.descriptor... writing output: debug/system.descriptor.txt... done
[cluster] retrieving SQL data for system.namespace... writing output: debug/system.namespace.txt... done
[cluster] retrieving SQL data for system.scheduled_jobs... writing output: debug/system.scheduled_jobs.txt... done
[cluster] retrieving SQL data for system.settings... writing output: debug/system.settings.txt... done
[cluster] retrieving SQL data for "".crdb_internal.create_statements... writing output: debug/crdb_internal.create_statements.txt... done
[cluster] retrieving SQL data for "".crdb_internal.create_type_statements... writing output: debug/crdb_internal.create_type_statements.txt... done
[cluster] retrieving SQL data for crdb_internal.kv_node_liveness... writing output: debug/crdb_internal.kv_node_liveness.txt... done
Expand Down
1 change: 1 addition & 0 deletions pkg/cli/testdata/zip/testzip
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ debug zip --concurrency=1 --cpu-profile-duration=1s /dev/null
[cluster] retrieving SQL data for system.descriptor... writing output: debug/system.descriptor.txt... done
[cluster] retrieving SQL data for system.namespace... writing output: debug/system.namespace.txt... done
[cluster] retrieving SQL data for system.scheduled_jobs... writing output: debug/system.scheduled_jobs.txt... done
[cluster] retrieving SQL data for system.settings... writing output: debug/system.settings.txt... done
[cluster] retrieving SQL data for "".crdb_internal.create_statements... writing output: debug/crdb_internal.create_statements.txt... done
[cluster] retrieving SQL data for "".crdb_internal.create_type_statements... writing output: debug/crdb_internal.create_type_statements.txt... done
[cluster] retrieving SQL data for crdb_internal.kv_node_liveness... writing output: debug/crdb_internal.kv_node_liveness.txt... done
Expand Down
3 changes: 3 additions & 0 deletions pkg/cli/testdata/zip/testzip_concurrent
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ zip
[cluster] retrieving SQL data for system.scheduled_jobs...
[cluster] retrieving SQL data for system.scheduled_jobs: done
[cluster] retrieving SQL data for system.scheduled_jobs: writing output: debug/system.scheduled_jobs.txt...
[cluster] retrieving SQL data for system.settings...
[cluster] retrieving SQL data for system.settings: done
[cluster] retrieving SQL data for system.settings: writing output: debug/system.settings.txt...
[cluster] retrieving the node status to get the SQL address...
[cluster] retrieving the node status to get the SQL address: ...
[cluster] using SQL address: ...
Expand Down
1 change: 1 addition & 0 deletions pkg/cli/zip.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ var customQuery = map[string]string{
") SELECT * FROM spans, LATERAL crdb_internal.payloads_for_span(span_id)",
"system.jobs": "SELECT *, to_hex(payload) AS hex_payload, to_hex(progress) AS hex_progress FROM system.jobs",
"system.descriptor": "SELECT *, to_hex(descriptor) AS hex_descriptor FROM system.descriptor",
"system.settings": "SELECT *, to_hex(value::bytes) as hex_value FROM system.settings",
}

type debugZipContext struct {
Expand Down
1 change: 1 addition & 0 deletions pkg/cli/zip_cluster_wide.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ var debugZipTablesPerCluster = []string{
"system.descriptor", // descriptors also contain job-like mutation state.
"system.namespace",
"system.scheduled_jobs",
"system.settings", // get the raw settings to determine what's explicitly set.

// The synthetic SQL CREATE statements for all tables.
// Note the "". to collect across all databases.
Expand Down
1 change: 1 addition & 0 deletions pkg/cli/zip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ ORDER BY name ASC`)
"system.descriptor",
"system.namespace",
"system.scheduled_jobs",
"system.settings",
)
sort.Strings(tables)

Expand Down

0 comments on commit 5cf185e

Please sign in to comment.