Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli/zip: emit SQL table data using TSV by default #107474

Merged
merged 1 commit into from Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
@@ -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
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
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
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