Skip to content

Commit

Permalink
roachtest/version-upgrade: don't run schema change workload on 19.x r…
Browse files Browse the repository at this point in the history
…eleases

Fixes #47024.

Release note (bug fix):
The schema change workload is meant for testing the behavior of schema
changes on clusters with nodes with min version 19.0. It will deadlock
on earlier versions.
  • Loading branch information
Spas Bojanov committed May 28, 2020
1 parent e148388 commit 33602ee
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 14 deletions.
6 changes: 1 addition & 5 deletions pkg/cmd/roachtest/acceptance.go
Expand Up @@ -51,11 +51,7 @@ func registerAcceptance(r *testRegistry) {
{
name: "version-upgrade",
fn: func(ctx context.Context, t *test, c *cluster) {
predV, err := PredecessorVersion(r.buildVersion)
if err != nil {
t.Fatal(err)
}
runVersionUpgrade(ctx, t, c, predV)
runVersionUpgrade(ctx, t, c, r.buildVersion)
},
// This test doesn't like running on old versions because it upgrades to
// the latest released version and then it tries to "head", where head is
Expand Down
21 changes: 15 additions & 6 deletions pkg/cmd/roachtest/mixed_version_schemachange.go
Expand Up @@ -13,6 +13,8 @@ package main
import (
"context"
"fmt"

"github.com/cockroachdb/cockroach/pkg/util/version"
)

func registerSchemaChangeMixedVersions(r *testRegistry) {
Expand All @@ -25,15 +27,11 @@ func registerSchemaChangeMixedVersions(r *testRegistry) {
MinVersion: "v20.1.0",
Cluster: makeClusterSpec(4),
Run: func(ctx context.Context, t *test, c *cluster) {
predV, err := PredecessorVersion(r.buildVersion)
if err != nil {
t.Fatal(err)
}
maxOps := 100
if local {
maxOps = 10
}
runSchemaChangeMixedVersions(ctx, t, c, maxOps, predV)
runSchemaChangeMixedVersions(ctx, t, c, maxOps, r.buildVersion)
},
})
}
Expand Down Expand Up @@ -63,12 +61,23 @@ func runSchemaChangeWorkloadStep(maxOps int) versionStep {
}

func runSchemaChangeMixedVersions(
ctx context.Context, t *test, c *cluster, maxOps int, predecessorVersion string,
ctx context.Context, t *test, c *cluster, maxOps int, buildVersion version.Version,
) {
predecessorVersion, err := PredecessorVersion(buildVersion)
if err != nil {
t.Fatal(err)
}

// An empty string will lead to the cockroach binary specified by flag
// `cockroach` to be used.
const mainVersion = ""
schemaChangeStep := runSchemaChangeWorkloadStep(maxOps)
if buildVersion.Major() < 20 {
// Schema change workload is meant to run only on versions 19.x or higher.
// If the main version is below 20.0 then then predecessor version is
// below 19.0.
schemaChangeStep = nil
}

u := newVersionUpgradeTest(c,
uploadAndStartFromCheckpointFixture(c.All(), predecessorVersion),
Expand Down
11 changes: 8 additions & 3 deletions pkg/cmd/roachtest/versionupgrade.go
Expand Up @@ -72,7 +72,11 @@ DROP TABLE test.t;
`),
}

func runVersionUpgrade(ctx context.Context, t *test, c *cluster, predecessorVersion string) {
func runVersionUpgrade(ctx context.Context, t *test, c *cluster, buildVersion version.Version) {
predecessorVersion, err := PredecessorVersion(buildVersion)
if err != nil {
t.Fatal(err)
}
// This test uses fixtures and we do not have encrypted fixtures right now.
c.encryptDefault = false

Expand Down Expand Up @@ -159,8 +163,9 @@ func (u *versionUpgradeTest) run(ctx context.Context, t *test) {
}()

for _, step := range u.steps {
step(ctx, t, u)

if step != nil {
step(ctx, t, u)
}
}
}

Expand Down

0 comments on commit 33602ee

Please sign in to comment.