Skip to content

Commit

Permalink
Merge pull request cockroachdb#117254 from cockroachdb/blathers/backp…
Browse files Browse the repository at this point in the history
…ort-release-23.2-116298

release-23.2: roachtest: improve sqlsmith for an elusive setup error
  • Loading branch information
yuzefovich authored Jan 4, 2024
2 parents 10d1c97 + 9c2e484 commit ef4e947
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions pkg/cmd/roachtest/tests/sqlsmith.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,22 @@ WITH into_db = 'defaultdb', unsafe_restore_incompatible_version;
t.Status("executing setup")
t.L().Printf("setup:\n%s", strings.Join(setup, "\n"))
for _, stmt := range setup {
logStmt(stmt)
if _, err := conn.Exec(stmt); err != nil {
if strings.Contains(err.Error(), "does not exist") {
// This is likely to be an elusive 'pq: column
// "crdb_internal_idx_expr" does not exist' error that we
// cannot reproduce. The current hypothesis is that the
// CREATE TABLE statement contains some non-visible
// characters that get lost when printing as a string, so we
// will log this statement as a sequence of integers so that
// later we can reconstruct the stmt precisely.
for _, char := range stmt {
fmt.Fprintf(smithLog, "%d ", char)
}
fmt.Fprint(smithLog, "\n\n")
}
t.Fatalf("error: %s\nstatement: %s", err.Error(), stmt)
} else {
logStmt(stmt)
}
}

Expand Down

0 comments on commit ef4e947

Please sign in to comment.