Skip to content

Commit

Permalink
Merge pull request #111152 from cockroachdb/blathers/backport-release…
Browse files Browse the repository at this point in the history
…-23.1-111108

release-23.1: sql/tests: avoid contention in RSG test
  • Loading branch information
rafiss committed Sep 24, 2023
2 parents ffb4d00 + a3a9e15 commit b08ec85
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions pkg/sql/tests/rsg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ func TestRandomSyntaxSchemaChangeColumn(t *testing.T) {
defer leaktest.AfterTest(t)()
defer log.Scope(t).Close(t)

numTables := *flagRSGGoRoutines
roots := []string{
"alter_table_cmd",
}
Expand All @@ -499,13 +500,18 @@ func TestRandomSyntaxSchemaChangeColumn(t *testing.T) {
if err := db.exec(t, ctx, "SET CLUSTER SETTING sql.catalog.descriptor_lease_duration = '30s'"); err != nil {
return err
}
return db.exec(t, ctx, `
CREATE DATABASE ident;
CREATE TABLE ident.ident (ident decimal);
`)
if err := db.exec(t, ctx, `CREATE DATABASE ident;`); err != nil {
return err
}
for i := 0; i < numTables; i++ {
if err := db.exec(t, ctx, fmt.Sprintf(`CREATE TABLE ident.ident%d (ident decimal);`, i)); err != nil {
return err
}
}
return nil
}, func(ctx context.Context, db *verifyFormatDB, r *rsg.RSG) error {
n := r.Intn(len(roots))
s := fmt.Sprintf("ALTER TABLE ident.ident %s", r.Generate(roots[n], 500))
s := fmt.Sprintf("ALTER TABLE ident.ident%d %s", r.Intn(numTables), r.Generate(roots[n], 500))
// Execute with a resettable timeout, where we allow up to N go-routines worth
// of resets. This should be the maximum theoretical time we can get
// stuck behind other work.
Expand Down

0 comments on commit b08ec85

Please sign in to comment.