Skip to content

Commit

Permalink
roachtest: fix for tpcc tests against older versions
Browse files Browse the repository at this point in the history
Add the `--deprecated-fk-indexes` flag when using a fixture (and not
just `init`).

Note that although this is the right thing to do, we don't have these
fixtures yet. Unfortunately, 20.1 and older aren't able to load
backups created by 20.2 in the first place.

Release note: None
  • Loading branch information
RaduBerinde committed Sep 28, 2020
1 parent d81cc18 commit 64392f1
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions pkg/cmd/roachtest/tpcc.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ func setupTPCC(
c.Put(ctx, cockroach, "./cockroach", workloadNode)
c.Put(ctx, workload, "./workload", workloadNode)

extraArgs := opts.ExtraSetupArgs
if !t.buildVersion.AtLeast(version.MustParse("v20.2.0")) {
extraArgs += " --deprecated-fk-indexes"
}
func() {
db := c.Conn(ctx, 1)
defer db.Close()
Expand All @@ -145,14 +149,13 @@ func setupTPCC(
switch opts.SetupType {
case usingFixture:
t.Status("loading fixture")
c.Run(ctx, workloadNode, tpccFixturesCmd(t, cloud, opts.Warehouses, opts.ExtraSetupArgs))
c.Run(ctx, workloadNode, tpccFixturesCmd(t, cloud, opts.Warehouses, extraArgs))
case usingInit:
t.Status("initializing tables")
cmd := fmt.Sprintf("./workload init tpcc --warehouses=%d %s {pgurl:1}",
opts.Warehouses, opts.ExtraSetupArgs)
if !t.buildVersion.AtLeast(version.MustParse("v20.2.0")) {
cmd += " --deprecated-fk-indexes"
}
cmd := fmt.Sprintf(
"./workload init tpcc --warehouses=%d %s {pgurl:1}",
opts.Warehouses, extraArgs,
)
c.Run(ctx, workloadNode, cmd)
default:
t.Fatal("unknown tpcc setup type")
Expand Down

0 comments on commit 64392f1

Please sign in to comment.