Skip to content

Commit

Permalink
cli/zip: emit SQL table data using TSV by default
Browse files Browse the repository at this point in the history
This is a partial revert of 35738d4.

It changes the default value of the `--format` flag back from JSON to
TSV.

Release note (backward-incompatible change):
THIS RELEASE NOTE CANCELS THE CORRESPONDING PREVIOUS BACKWARD-INCOMPATIBLE CHANGE.
New behavior, compatible with previous versions of CockroachDB: the
command `cockroach debug zip` stores data retrieved from SQL tables in
the remote cluster using the TSV format by default.

Release note (cli change): The default value of the `--format`
parameter to `cockroach debug zip` is `tsv`, like other CLI commands
that can extract SQL data.
  • Loading branch information
knz committed Jul 27, 2023
1 parent 4413ec7 commit 38cf825
Show file tree
Hide file tree
Showing 13 changed files with 1,112 additions and 1,128 deletions.
306 changes: 152 additions & 154 deletions pkg/cli/testdata/zip/partial1

Large diffs are not rendered by default.

218 changes: 108 additions & 110 deletions pkg/cli/testdata/zip/partial1_excluded

Large diffs are not rendered by default.

218 changes: 108 additions & 110 deletions pkg/cli/testdata/zip/partial2

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions pkg/cli/testdata/zip/specialnames
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
zip
----
[cluster] retrieving SQL data for crdb_internal.cluster_database_privileges... writing output: debug/crdb_internal.cluster_database_privileges.json... done
[cluster] retrieving SQL data for crdb_internal.table_indexes... writing output: debug/crdb_internal.table_indexes.json... done
[cluster] retrieving SQL data for system.database_role_settings... writing output: debug/system.database_role_settings.json... done
[cluster] retrieving SQL data for system.table_statistics... writing output: debug/system.table_statistics.json... done
[cluster] retrieving SQL data for crdb_internal.cluster_database_privileges... writing output: debug/crdb_internal.cluster_database_privileges.txt... done
[cluster] retrieving SQL data for crdb_internal.table_indexes... writing output: debug/crdb_internal.table_indexes.txt... done
[cluster] retrieving SQL data for system.database_role_settings... writing output: debug/system.database_role_settings.txt... done
[cluster] retrieving SQL data for system.table_statistics... writing output: debug/system.table_statistics.txt... done
172 changes: 86 additions & 86 deletions pkg/cli/testdata/zip/testzip

Large diffs are not rendered by default.

272 changes: 130 additions & 142 deletions pkg/cli/testdata/zip/testzip_concurrent

Large diffs are not rendered by default.

198 changes: 99 additions & 99 deletions pkg/cli/testdata/zip/testzip_external_process_virtualization

Large diffs are not rendered by default.

172 changes: 86 additions & 86 deletions pkg/cli/testdata/zip/testzip_include_range_info

Large diffs are not rendered by default.

370 changes: 185 additions & 185 deletions pkg/cli/testdata/zip/testzip_shared_process_virtualization

Large diffs are not rendered by default.

297 changes: 148 additions & 149 deletions pkg/cli/testdata/zip/unavailable

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pkg/cli/zip.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ func runDebugZip(cmd *cobra.Command, args []string) (retErr error) {

if !cmd.Flags().Changed(cliflags.TableDisplayFormat.Name) {
// Use a streaming format to avoid accumulating all rows in RAM.
sqlExecCtx.TableDisplayFormat = clisqlexec.TableDisplayJSON
sqlExecCtx.TableDisplayFormat = clisqlexec.TableDisplayTSV
}

zr.sqlOutputFilenameExtension = computeSQLOutputFilenameExtension(sqlExecCtx.TableDisplayFormat)
Expand Down
3 changes: 3 additions & 0 deletions pkg/cli/zip_tenant_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,15 @@ import (
"github.com/cockroachdb/cockroach/pkg/testutils/serverutils"
"github.com/cockroachdb/cockroach/pkg/testutils/skip"
"github.com/cockroachdb/cockroach/pkg/util/leaktest"
"github.com/cockroachdb/cockroach/pkg/util/log"
"github.com/cockroachdb/datadriven"
)

// TestTenantZip tests the operation of zip for a tenant server.
func TestTenantZip(t *testing.T) {
defer leaktest.AfterTest(t)()
defer log.Scope(t).Close(t)

skip.UnderRace(t, "test too slow under race")

tenants := []struct {
Expand Down
4 changes: 2 additions & 2 deletions pkg/cli/zip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,8 @@ func eraseNonDeterministicZipOutput(out string) string {
out = re.ReplaceAllString(out, `postgresql://...`)
re = regexp.MustCompile(`(?m)SQL address: .*$`)
out = re.ReplaceAllString(out, `SQL address: ...`)
re = regexp.MustCompile(`(?m)log file:.*$`)
out = re.ReplaceAllString(out, `log file: ...`)
re = regexp.MustCompile(`(?m)^\[node \d+\] \[log file:.*$` + "\n")
out = re.ReplaceAllString(out, ``)
re = regexp.MustCompile(`(?m)RPC connection to .*$`)
out = re.ReplaceAllString(out, `RPC connection to ...`)
re = regexp.MustCompile(`(?m)dial tcp .*$`)
Expand Down

0 comments on commit 38cf825

Please sign in to comment.