cockroachdb / cockroachdb/cockroach

sql: debug zip omits user-created tables in `crdb_internal.create_statements.txt`

Open
#107,221 1 comment 0 reactions 0 assignees View on GitHub
A-sql-cli-observability C-bug T-sql-foundations
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

I've seen a debug zip from a v22.2.6 cluster where the `crdb_internal.create_statements.txt` file does not contain user-created tables, and the `crdb_internal.create_statements.txt.err` file contains an error:

```
ERROR: type "XXX" does not exist (SQLSTATE 42704)
(1) secondary error attachment
| query: TABLE "".crdb_internal.create_statements
| (1) attached stack trace
| -- stack trace:
| | github.com/cockroachdb/cockroach/pkg/cli.(*debugZipContext).dumpTableDataForZip
| | github.com/cockroachdb/cockroach/pkg/cli/zip.go:364
| | github.com/cockroachdb/cockroach/pkg/cli.(*debugZipContext).collectClusterData.func1
| | github.com/cockroachdb/cockroach/pkg/cli/zip_cluster_wide.go:102
| | github.com/cockroachdb/cockroach/pkg/cli.(*debugZipContext).collectClusterData
| | github.com/cockroachdb/cockroach/pkg/cli/zip_cluster_wide.go:108
| | github.com/cockroachdb/cockroach/pkg/cli.runDebugZip
| | github.com/cockroachdb/cockroach/pkg/cli/zip.go:249
| | github.com/cockroachdb/cockroach/pkg/cli/clierrorplus.MaybeDecorateError.func1
| | github.com/cockroachdb/cockroach/pkg/cli/clierrorplus/decorate_error.go:71
| | github.com/spf13/cobra.(*Command).execute
| | github.com/spf13/cobra/external/com_github_spf13_cobra/command.go:856
| | github.com/spf13/cobra.(*Command).ExecuteC
| | github.com/spf13/cobra/external/com_github_spf13_cobra/command.go:974
| | github.com/spf13/cobra.(*Command).Execute
| | github.com/spf13/cobra/external/com_github_spf13_cobra/command.go:902
| | github.com/cockroachdb/cockroach/pkg/cli.Run
| | github.com/cockroachdb/cockroach/pkg/cli/cli.go:300
| | github.com/cockroachdb/cockroach/pkg/cli.doMain
| | github.com/cockroachdb/cockroach/pkg/cli/cli.go:143
| | github.com/cockroachdb/cockroach/pkg/cli.Main
| | github.com/cockroachdb/cockroach/pkg/cli/cli.go:68
| | main.main
| | main/pkg/cmd/cockroach/main.go:26
| | runtime.main
| | GOROOT/src/runtime/proc.go:250
| | runtime.goexit
| | GOROOT/src/runtime/asm_amd64.s:1594
| Wraps: (2) query: TABLE "".crdb_internal.create_statements
| Error types: (1) *withstack.withStack (2) *errutil.leafError
Wraps: (2) secondary error attachment
| ERROR: type "XXX" does not exist (SQLSTATE 42704)
| (1) secondary error attachment
| | ERROR: type "XXX" does not exist (SQLSTATE 42704)
| | (1) ERROR: type "XXX" does not exist (SQLSTATE 42704)
| | Error types: (1) *pgconn.PgError
| Wraps: (2) ERROR: type "XXX" does not exist (SQLSTATE 42704)
| Error types: (1) *secondary.withSecondaryError (2) *pgconn.PgError
Wraps: (3) ERROR: type "XXX" does not exist (SQLSTATE 42704)
Error types: (1) *secondary.withSecondaryError (2) *secondary.withSecondaryError (3) *pgconn.PgError
```

I have not yet tried to reproduce this, but I'd start by adding a type, dropping the type, and then running the query that collects the contents of the `crdb_internal.create_statements.txt` file in the debug zip.

Jira issue: CRDB-29950

Epic CRDB-61004

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.