From 58a58911c7c7fd06022888cf3d4996e4489c5f3b Mon Sep 17 00:00:00 2001 From: Steven Danna Date: Wed, 27 Apr 2022 16:56:45 +0100 Subject: [PATCH] roachtest: set cluster setting separately from index build 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 --- pkg/cmd/roachtest/tests/indexbackfiller.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/cmd/roachtest/tests/indexbackfiller.go b/pkg/cmd/roachtest/tests/indexbackfiller.go index eac2b36e0e9a..ab788c6f31e0 100644 --- a/pkg/cmd/roachtest/tests/indexbackfiller.go +++ b/pkg/cmd/roachtest/tests/indexbackfiller.go @@ -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) }