Skip to content

Commit

Permalink
roachtest: enable schema changes in acceptance/version-upgrade
Browse files Browse the repository at this point in the history
Previously, due to flakes we disabled schema changes inside
the version update test. This patch re-enables them, since
we are confident that the workload itslef is now stable in a
mixed version state.

Fixes: cockroachdb#58489
Release note: None
  • Loading branch information
fqazi committed Mar 17, 2023
1 parent 87c0fd5 commit 4f8987d
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
15 changes: 15 additions & 0 deletions pkg/cmd/roachtest/roachtestutil/mixedversion/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,21 @@ func (h *Helper) Exec(rng *rand.Rand, query string, args ...interface{}) error {
return err
}

// Run performs `cluster.RunE` on a randomly picked node.
func (h *Helper) Run(rng *rand.Rand, cmd ...string) error {
node := h.runner.crdbNodes[rng.Intn(len(h.runner.crdbNodes))]
h.stepLogger.Printf("executing command:\n%s\nNode: %v", cmd, node)
return h.runner.cluster.RunE(h.ctx, option.NodeListOption{node}, cmd...)
}

// InitLegacyWorkload initializes a legacy workload on all nodes.
func (h *Helper) InitLegacyWorkload(workloadPath string, workload string) {
// Stage workload on all nodes as the load node to run workload is chosen
// randomly.
h.runner.cluster.Put(h.ctx, workloadPath, "./workload", h.runner.crdbNodes)
h.runner.cluster.Run(h.ctx, h.runner.crdbNodes, "./workload init", workload)
}

func (h *Helper) Connect(node int) *gosql.DB {
return h.runner.conn(node)
}
Expand Down
19 changes: 18 additions & 1 deletion pkg/cmd/roachtest/tests/versionupgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"math/rand"
"path/filepath"
"runtime"
"sync"
"time"

"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/cluster"
Expand Down Expand Up @@ -102,7 +103,7 @@ func runVersionUpgrade(ctx context.Context, t test.Test, c cluster.Cluster) {
if c.IsLocal() && runtime.GOARCH == "arm64" {
t.Skip("Skip under ARM64. See https://github.com/cockroachdb/cockroach/issues/89268")
}

initWorkload := sync.Once{}
mvt := mixedversion.NewTest(ctx, t, t.L(), c, c.All())
mvt.InMixedVersion("run backup", func(ctx context.Context, l *logger.Logger, rng *rand.Rand, h *mixedversion.Helper) error {
// Verify that backups can be created in various configurations. This is
Expand All @@ -126,6 +127,22 @@ func runVersionUpgrade(ctx context.Context, t test.Test, c cluster.Cluster) {
return nil
},
)
mvt.InMixedVersion(
"test schema change step",
func(ctx context.Context, l *logger.Logger, rng *rand.Rand, h *mixedversion.Helper) error {
initWorkload.Do(func() {
h.InitLegacyWorkload(t.DeprecatedWorkload(), "schemachange")
})
l.Printf("running schema workload step")
runCmd := []string{
"./workload run schemachange --verbose=1",
fmt.Sprintf("--max-ops %d", 10),
fmt.Sprintf("--concurrency %d", 2),
fmt.Sprintf("{pgurl:1-%d}", len(c.All())),
}
return h.Run(rng, runCmd...)
},
)
mvt.AfterUpgradeFinalized(
"check if GC TTL is pinned",
func(ctx context.Context, l *logger.Logger, rng *rand.Rand, h *mixedversion.Helper) error {
Expand Down

0 comments on commit 4f8987d

Please sign in to comment.