Skip to content

Commit 2d82473

Browse files
committed
cli: include system table contention information in redacted debug zips
Previously, when generating a redacted debug zip we would omit information about retries and contended keys, which could make issues involving contention leasing / descriptors / jobs hard to diagnose. For example, it's easily possible for users to collect redacted zips when these situations are occurring and we will not have sufficient information to diagnose them. This patch removes redaction from relevant columns if we know that the keys involve system tables or just harmless stuff like retries/retry reasons. Fixes: cockroachdb#104593 Release note: None
1 parent a4f34e7 commit 2d82473

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

pkg/cli/zip_table_registry.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,12 @@ func (r DebugZipTableRegistry) GetTables() []string {
107107
var zipInternalTablesPerCluster = DebugZipTableRegistry{
108108
"crdb_internal.cluster_contention_events": {
109109
// `key` column contains the contended key, which may contain sensitive
110-
// row-level data.
110+
// row-level data. So, we will only fetch if the table is under the system
111+
// schema.
111112
nonSensitiveCols: NonSensitiveColumns{
112113
"table_id",
113114
"index_id",
115+
"IF(crdb_internal.is_system_table_key(key), crdb_internal.pretty_key(key, 0) ,'redacted') as pretty_key",
114116
"num_contention_events",
115117
"cumulative_contention_time",
116118
"txn_id",
@@ -158,6 +160,8 @@ var zipInternalTablesPerCluster = DebugZipTableRegistry{
158160
"exec_node_ids",
159161
"contention",
160162
"index_recommendations",
163+
"retries",
164+
"last_retry_reason",
161165
},
162166
},
163167
"crdb_internal.cluster_locks": {
@@ -531,14 +535,16 @@ var zipInternalTablesPerCluster = DebugZipTableRegistry{
531535
},
532536
"crdb_internal.transaction_contention_events": {
533537
// `contending_key` column contains the contended key, which may
534-
// contain sensitive row-level data.
538+
// contain sensitive row-level data. So, we will only fetch if the
539+
// table is under the system schema.
535540
nonSensitiveCols: NonSensitiveColumns{
536541
"collection_ts",
537542
"blocking_txn_id",
538543
"blocking_txn_fingerprint_id",
539544
"waiting_txn_id",
540545
"waiting_txn_fingerprint_id",
541546
"contention_duration",
547+
"IF(crdb_internal.is_system_table_key(contending_key), crdb_internal.pretty_key(contending_key, 0) ,'redacted') as contending_pretty_key",
542548
},
543549
},
544550
"crdb_internal.zones": {

0 commit comments

Comments
 (0)