Skip to content

Commit

Permalink
roachtest: add import/mixed-version roachtest
Browse files Browse the repository at this point in the history
Before supporting mixed-versions runs of IMPORT this test would fail
with:
```
importing fixture: importing table history: pq: version mismatch in flow request: 42; this node accepts 35 through 36
```

It now succeeds. Note that this test exercises that IMPORT can run in a
mixed-version cluster, but not during an upgrade of nodes in the
cluster.

Release note: None
  • Loading branch information
pbardea committed Dec 4, 2020
1 parent 331e324 commit 28487c6
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
51 changes: 51 additions & 0 deletions pkg/cmd/roachtest/import.go
Expand Up @@ -168,3 +168,54 @@ func registerImportTPCH(r *testRegistry) {
})
}
}

func successfulImportStep(warehouses, nodeID int) versionStep {
return func(ctx context.Context, t *test, u *versionUpgradeTest) {
u.c.Run(ctx, u.c.Node(nodeID), tpccImportCmd(warehouses))
}
}

func runImportMixedVersion(
ctx context.Context, t *test, c *cluster, warehouses int, predecessorVersion string,
) {
// An empty string means that the cockroach binary specified by flag
// `cockroach` will be used.
const mainVersion = ""
roachNodes := c.All()

t.Status("starting csv servers")

u := newVersionUpgradeTest(c,
uploadAndStartFromCheckpointFixture(roachNodes, predecessorVersion),
waitForUpgradeStep(roachNodes),
preventAutoUpgradeStep(1),

// Upgrade some of the nodes.
binaryUpgradeStep(c.Node(1), mainVersion),
binaryUpgradeStep(c.Node(2), mainVersion),

successfulImportStep(warehouses, 1 /* nodeID */),
)
u.run(ctx, t)
}

func registerImportMixedVersion(r *testRegistry) {
r.Add(testSpec{
Name: "import/mixed-versions",
Owner: OwnerBulkIO,
// Mixed-version support was added in 21.1.
MinVersion: "v21.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)
}
warehouses := 100
if local {
warehouses = 10
}
runImportMixedVersion(ctx, t, c, warehouses, predV)
},
})
}
1 change: 1 addition & 0 deletions pkg/cmd/roachtest/registry.go
Expand Up @@ -41,6 +41,7 @@ func registerTests(r *testRegistry) {
registerGossip(r)
registerHibernate(r)
registerHotSpotSplits(r)
registerImportMixedVersion(r)
registerImportTPCC(r)
registerImportTPCH(r)
registerInconsistency(r)
Expand Down

0 comments on commit 28487c6

Please sign in to comment.