Skip to content

Commit

Permalink
workload/schemachange: disable inserts when in 22.1 mixed version state
Browse files Browse the repository at this point in the history
Previously, if we ran in a mixed version state with the schema changer
workload we could run into an optimizer bug (cockroachdb#80820). To address this,
this patch in a mixed version workload disables the insert portion of
the workload.

Release justification: improves test coverage by enabling the mixed
version test
Release note: None
  • Loading branch information
fqazi committed Sep 21, 2022
1 parent f860c46 commit dd954ff
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
6 changes: 0 additions & 6 deletions pkg/cmd/roachtest/tests/mixed_version_schemachange.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,6 @@ func runSchemaChangeWorkloadStep(loadNode, maxOps, concurrency int) versionStep
t.L().Printf("Workload step run: %d", numFeatureRuns)
runCmd := []string{
"./workload run schemachange --verbose=1",
// The workload is still in development and occasionally discovers schema
// change errors so for now we don't fail on them but only on panics, server
// crashes, deadlocks, etc.
// TODO(spaskob): remove when https://github.com/cockroachdb/cockroach/issues/47430
// is closed.
"--tolerate-errors=true",
fmt.Sprintf("--max-ops %d", maxOps),
fmt.Sprintf("--concurrency %d", concurrency),
fmt.Sprintf("{pgurl:1-%d}", u.c.Spec().NodeCount),
Expand Down
12 changes: 12 additions & 0 deletions pkg/workload/schemachange/operation_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -2373,6 +2373,18 @@ func (og *operationGenerator) insertRow(ctx context.Context, tx pgx.Tx) (stmt *o
if err != nil {
return nil, err
}
// If we aren't on 22.2 then disable the insert plugin, since 21.X
// can have schema instrospection queries fail due to an optimizer bug.
skipInserts, err := isClusterVersionLessThan(ctx, tx, clusterversion.ByKey(clusterversion.Start22_2))
if err != nil {
return nil, err
}
// If inserts are to be skipped, we will intentionally, target the insert towards
// a non-existent table, so that they become no-ops.
if skipInserts {
tableExists = false
tableName.SchemaName = "InvalidObjectName"
}
if !tableExists {
return makeOpStmtForSingleError(OpStmtDML,
fmt.Sprintf(
Expand Down

0 comments on commit dd954ff

Please sign in to comment.