github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/cmd/roachtest/schemachange_random_load.go (about) 1 // Copyright 2020 The Cockroach Authors. 2 // 3 // Use of this software is governed by the Business Source License 4 // included in the file licenses/BSL.txt. 5 // 6 // As of the Change Date specified in that file, in accordance with 7 // the Business Source License, use of this software will be governed 8 // by the Apache License, Version 2.0, included in the file 9 // licenses/APL.txt. 10 11 package main 12 13 import ( 14 "context" 15 "fmt" 16 ) 17 18 func registerSchemaChangeRandomLoad(r *testRegistry) { 19 r.Add(testSpec{ 20 Name: "schemachange/random-load", 21 Owner: OwnerSQLSchema, 22 Cluster: makeClusterSpec(3), 23 Run: func(ctx context.Context, t *test, c *cluster) { 24 maxOps := 5000 25 concurrency := 20 26 if local { 27 maxOps = 1000 28 concurrency = 2 29 } 30 runSchemaChangeRandomLoad(ctx, t, c, maxOps, concurrency) 31 }, 32 Skip: "deadlocks because of pgx bug", 33 }) 34 } 35 36 func runSchemaChangeRandomLoad(ctx context.Context, t *test, c *cluster, maxOps, concurrency int) { 37 loadNode := c.Node(1) 38 roachNodes := c.Range(1, c.spec.NodeCount) 39 t.Status("copying binaries") 40 c.Put(ctx, cockroach, "./cockroach", roachNodes) 41 c.Put(ctx, workload, "./workload", loadNode) 42 43 t.Status("starting cockroach nodes") 44 c.Start(ctx, t, roachNodes) 45 c.Run(ctx, loadNode, "./workload init schemachange") 46 47 runCmd := []string{ 48 "./workload run schemachange --verbose=1", 49 // The workload is still in development and occasionally discovers schema 50 // change errors so for now we don't fail on them but only on panics, server 51 // crashes, deadlocks, etc. 52 // TODO(spaskob): remove when https://github.com/cockroachdb/cockroach/issues/47430 53 // is closed. 54 "--tolerate-errors=true", 55 fmt.Sprintf("--max-ops %d", maxOps), 56 fmt.Sprintf("--concurrency %d", concurrency), 57 } 58 t.Status("running schemachange workload") 59 c.Run(ctx, loadNode, runCmd...) 60 }