Skip to content

Commit

Permalink
roachtest: set cluster setting separately from index build
Browse files Browse the repository at this point in the history
The nightly roachtest failed with:

    pq: SET CLUSTER SETTING cannot be used inside a multi-statement transaction

This change obeys this edict by issuing the SET CLUSTER SETTING
statement in its own transaction.

Release note: None
  • Loading branch information
stevendanna committed Apr 27, 2022
1 parent 70d1c10 commit 58a5891
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/cmd/roachtest/tests/indexbackfiller.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,11 @@ func registerIndexBackfill(r registry.Registry) {
// Create index using old index backfiller after workload has finished.
time.Sleep(duration / 10)
createStmt := fmt.Sprintf(randTest.createFmt, oldIdx)
alterCmd := `SET CLUSTER SETTING sql.mvcc_compliant_index_creation.enabled = false; %s;`

t.Status("creating index using old index backfiller")
if _, err := db.ExecContext(ctx, fmt.Sprintf(alterCmd, createStmt)); err != nil {
if _, err := db.ExecContext(ctx, `SET CLUSTER SETTING sql.mvcc_compliant_index_creation.enabled = false`); err != nil {
t.Fatal(err)
}
if _, err := db.ExecContext(ctx, createStmt); err != nil {
t.Fatal(err)
}

Expand Down

0 comments on commit 58a5891

Please sign in to comment.